-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description for API Key Security Definition. #1030
Comments
I was wondering how this is supposed to work when apiKey authentication doesn't support description. |
I used a description tag inside a API Key definition on a production swagger files. For showing a tip when typing the API Token on the input text field.
|
I read on the OpenAPI 2.0 specification that on the security definitions are fixed fields, on you can define a description for the security definition, where the type and description applies for basic, apiKey and oauth2 authentication here specifies it. |
@pomaretta Thanks for clarifying this. Please feel free to contribute with a PR regarding this matter. |
Can you show me your definition, I tried all day and but couldn't make this work
|
Hi @nxvinh222, simply adding this to your swagger, ensure that if you are using swag init to generate doc files, write this definition on the docs.go, on the document variable, otherwise you are setting up this definition on the .json or .yaml that doesn't apply to the final result.
|
Here I use iris web server as example:
} add swagger/index.html
Reference: https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/installation.md |
Hi, for OpenAPI 2.0 just enter the following comments and generate the docs by swag init.
On Swagger UI in a browser, you must specify the bearer in the value field of the authorization pop up: |
This doesn't work, because the |
Thanks @JohnSalazar, works perfectly, even with a global |
Is your feature request related to a problem? Please describe.
I have a Bearer API Key security definition, due to Swagger 2.0, the user have to type "Bearer TOKEN" into the Authorize option.
Describe the solution you'd like
On the security definition of the API Key, define a description for it.
Describe alternatives you've considered
This cannot be set through the generation. Maybe changing the docs.go to get this feature.
Additional context
I know the tag "// @description" will conflict with the Swagger API description, maybe with "@securityDefinitions.apiKey.description" can solve this conflict.
The text was updated successfully, but these errors were encountered: