Comments (4)
Bingo. I was missing the following from my API Spec:
security:
- bearerAuth: []
After including it, Specmatic started to autogenerate an Authorization header. I was then able to use System.setProperty("bearerAuth", "abcdef");
to set my own token.
It may be worth updating https://specmatic.in/documentation/authentication.html to include some extra detail on setting the security
as well as the security scheme.
Thanks!
from specmatic.
The API Spec is being generated using SpringDoc. I do have Stoplight installed and it didn't flag the unused security scheme 😞 Thanks again.
from specmatic.
Hi @noelmccrory, thanks for reaching out.
Looks like you are trying to run contract tests with a specification that has a security scheme defined.
Can you confirm if you are applying this security scheme to the APIs you are trying to test? Here's the documentation on how you can apply the defined security scheme to your APIs.
It would help us if you post a specification that would help us replicate the problem.
from specmatic.
@noelmccrory Glad you figured it out!
Just curious if you use any linters, if yes, it might have highlighted this issue in the spec in your IDE itself.
For example, in the following screenshot the Swagger Editor is telling me that I have not used the defined security scheme anywhere -
While technically Specmatic is operating correctly based on the OpenAPI spec, what we can do is, add the suggestion of using linters in our documentation to help users find out any spec level issues (e.g. unused security scheme) to get early feedback.
Closing this issue for now. Please feel free to reopen if necessary.
from specmatic.
Related Issues (20)
- When trying to use exclude endpoint without successCriteria it throws error. HOT 2
- test issue - to be deleted
- Support for OpenAPI Specification - 'format' property for 'password' and 'email' HOT 2
- Stubbing Apache Pulsar HOT 2
- Getting Error -> Error: Java heap space\n' HOT 4
- Specmatic Stubs picks up 400 Examples and fails due to it. HOT 3
- How to Mock when running specmatic for Python.
- Support for File Path Resolution in $ref Property in Specmatic HOT 2
- Regex in router specmatic considering multiple endpoints which are not actual endpoints present in service. HOT 2
- API response not being validated with OpenAPI Response's example HOT 1
- Timeout cannot be set to more than 10s using --timeout. HOT 2
- The named examples are not being picked up correctly when there is no response example for 204 responses.
- Specmatic should throw error instead of did not run when schema is invalid. HOT 4
- Use SpecmaticJUnitSupport as a JUnit Extension HOT 9
- Specmatic unable to parse valid DateTime HOT 2
- Specmatic Stub does not generate correct response for single JSON string HOT 3
- Specmatic stub is generating incorrect response for JSON string value in http-response body HOT 1
- Proxy command not working on Specmatic Docker Image
- Comparison to microcks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from specmatic.