echo-swagger icon indicating copy to clipboard operation
echo-swagger copied to clipboard

securityDefinitions are not parsed

Open adrian-sturm opened this issue 1 year ago • 1 comments

I have added securityDefinitions.apikey to my api doc annotations and used the security definition on a route.

What I expected: The route will have the lock-symbol-button rendered on its right side, where I can click on to fill out auth data for the protected route. Additionally, a green "Authorize" Button is rendered at the top of the swaggerUI page where I can configure auth methods as well.

What I got: The little lock-symbol is rendered on my route, but there is no action when I click on it. There is no "Authorize" Button neither. When I check the generated swagger.json, I can see that there is an empty security entry on my route:

"security": [
                    {
                        "ApiKeyAuth": []
                    }
                ],

But no security config whatsoever at the root level (where host, info etc are defined). My guess is therefore that swaggo did not parse my securityDefinition annotation at all.

You can see a minimum setup to reproduce this issue in this repository: https://github.com/adrian-sturm/swaggo-test

adrian-sturm avatar Nov 22 '22 10:11 adrian-sturm