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
Describe the bug
I have run into an issue when declaring tagGroups in the general API information.
When using // @x-tagGroups [{"name":"General","tags":["lanes","video-recommendations"]}]
it gives the error annotation @x-taggroups need a value
When looking into it it seems you already fixed this issue for the operation side of it, but not for the general API parser.
What happens is that the attribute gets extracted and lowercased from the commentline
In the switch case for ParseGeneralAPIInfo in parser.go the default action tries to split the comment using this lowercased attribute:
default:
prefixExtension:="@x-"iflen(attribute) >5 { // Prefix extension + 1 char + 1 space + 1 charifattribute[:len(prefixExtension)] ==prefixExtension {
varvalueJSONinterface{}
// HERE IS THE ISSUEsplit:=strings.SplitAfter(commentLine, attribute+" ")
iflen(split) <2 {
returnfmt.Errorf("annotation %s need a value", attribute)
}
For camelcased @x-tentions (or any x-tentions using Upper case) it always returns an error because it tries to split the commentLine using the lowercased version of the attribute, which does not match because it still contains upper cases.
It works when using // @x-taggroups (so all lower case) but this does not give a working swagger doc with camelcased x-tentions.
To Reproduce
Steps to reproduce the behavior:
Use // @x-tagGroups [{"name":"General","tags":["lanes","video-recommendations"]}] as a general API doc
run swag init
See error annotation @x-taggroups need a value
Expected behavior
Use // @x-tagGroups [{"name":"General","tags":["lanes","video-recommendations"]}] as a general API doc
Describe the bug
I have run into an issue when declaring tagGroups in the general API information.
When using
// @x-tagGroups [{"name":"General","tags":["lanes","video-recommendations"]}]
it gives the error
annotation @x-taggroups need a value
When looking into it it seems you already fixed this issue for the operation side of it, but not for the general API parser.
What happens is that the attribute gets extracted and lowercased from the commentline
so in this example it becomes
@x-taggroups
.In the switch case for
ParseGeneralAPIInfo
inparser.go
the default action tries to split the comment using this lowercased attribute:For camelcased @x-tentions (or any x-tentions using Upper case) it always returns an error because it tries to split the commentLine using the lowercased version of the attribute, which does not match because it still contains upper cases.
It works when using
// @x-taggroups
(so all lower case) but this does not give a working swagger doc with camelcased x-tentions.To Reproduce
Steps to reproduce the behavior:
// @x-tagGroups [{"name":"General","tags":["lanes","video-recommendations"]}]
as a general API docswag init
annotation @x-taggroups need a value
Expected behavior
// @x-tagGroups [{"name":"General","tags":["lanes","video-recommendations"]}]
as a general API docswag init
Your swag version
e.g. 1.7
Your go version
e.g. 1.13.8
Desktop:
The text was updated successfully, but these errors were encountered: