swagger-api / swagger-api/swagger-codegen
Custom function property for security scheme is ignored
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
When writing a definition file to convert, I want to be able to specify the function called when a bearer token is passed. To do this, I provide the x-bearerInfoFunc property in the security scheme. However, after generating the swagger.yaml, this property is ignored and the default function name is inserted instead.
Swagger-codegen version: 3.0.10
Here is the definition I am providing:
...
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
x-bearerInfoFunc: <module path>.my_controller.my_function_name
...
And this is how it is rendered in swagger.yaml:
...
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
x-bearerInfoFunc: <module path>.authorization_controller.check_bearerAuth
...
Command line used for generation:
java -jar swagger-codegen-cli-3.0.10.jar generate -i ./<module path>/swagger/definitions.yaml -l python-flask -o python-flask-server
Is this a bug/oversight, or is there a reason why this property is ignored?
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
Reproduce the issue with swagger-codegen 3.0.10 using the provided definition file and the python-flask generation command, then compare the security scheme in the input with the generated swagger.yaml. Done means the supplied x-bearerInfoFunc value is preserved instead of being replaced by the generated default function name; add a regression test if the relevant test location can be identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, java, openapi, python
- Domain
- api, authentication, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100