You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that this was caused by some incomplete white space parsing on getSecurityDefinitionKey:
parseGeneralAPIInfoV3 iterates over comments and does strings.TrimSpace but then passes the raw comments to parseSecAttributesV3.
getSecurityDefinitionKey then receives the same slice (named lines), which will check for a prefix, split by a space, etc.
The problem is that fmt will add a tab at before the annotation (and the space between key and value may also contain spaces/tabs if the user or fmt decide to do so):
// @securityDefinitions.apikey cookieAuth
// @in header
// @name Authorization
// @description some description
To Reproduce
Steps to reproduce the behavior:
Create security definitions with a tab prefixing the annotation and/or between key and value, ex: // @securityDefinitions
swag fmt
swag init --v3.1
Expected behavior
Expected security schemes to have a key.
Your swag version
v2.0.0-rc4
Your go version
1.22.1
The text was updated successfully, but these errors were encountered:
Describe the bug
Ran into the bug after trying out v2 on the latest rc.
When generating the docs, my security scheme was missing a key:
I found that this was caused by some incomplete white space parsing on
getSecurityDefinitionKey
:parseGeneralAPIInfoV3
iterates over comments and doesstrings.TrimSpace
but then passes the raw comments toparseSecAttributesV3
.getSecurityDefinitionKey
then receives the same slice (namedlines
), which will check for a prefix, split by a space, etc.fmt
will add a tab at before the annotation (and the space between key and value may also contain spaces/tabs if the user or fmt decide to do so):// @securityDefinitions.apikey cookieAuth
// @in header
// @name Authorization
// @description some description
To Reproduce
Steps to reproduce the behavior:
// @securityDefinitions
Expected behavior
Expected security schemes to have a key.
Your swag version
v2.0.0-rc4
Your go version
1.22.1
The text was updated successfully, but these errors were encountered: