swagger-api / swagger-api/swagger-codegen
No authorization headers available in generated API
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I have my security definitions in the preamble section of my swagger.yaml like so:
securityDefinitions:
Bearer:
description: |
For accessing the API a valid JWT token must be passed in all the queries in
the 'Authorization' header.
A valid JWT token is generated by the API and retourned as answer of a call
to the route /login giving a valid user & password.
The following syntax must be used in the 'Authorization' header :
Bearer: header.payload.signature
type: apiKey
name: Authorization
in: header
And the protected routes have this:
description: |
blah blah
tags:
- Tag
security:
- Bearer: []
Generated code does not have this apiKey header in the Method that is included.
Any help is appreciated.
Thanks,
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the securityDefinitions and protected-route entries in swagger.yaml, then trace how those settings are represented in the generated Method. Reproduce the report with the shown Bearer apiKey configuration and compare a protected method with the generated output. Done means the generated method exposes the Authorization header for the protected route.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100