Cannot understand one thing, why swag init
command is generating everything, except SecurityDefinition
block
For example, this is my code on main function:
// @title Swagger API
// @version 1.0
// @description This is a documentation for PlatOps Core tool.
// @termsOfService http://platops.com/
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host test.com
// @BasePath /v2
// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
And how I'm using :
// GetUser godoc
// @Summary Retrieves users list
// @Tags users
// @Accept json
// @Produce json
// @Success 200 {object} string
// @Failure 400,404 {object} string
// @Failure 500 {object} string
// @Router /api/users/ [get]
// @Security Bearer
From this, it's generating everything, this path also, but no SecurityDefinition block inside.
I'm trying to implement this one: https://github.com/swaggo/swag#security
P.S. If I put already generated text on the generated doc file, it's working... so why it cannot generate it?
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"name": "Bearer",
"in": "header"
},
}