Open guhan121 opened 2 years ago
Just run into same issue.
The docs and implementation seem to be contradictory for AND/OR operators in security tags.
https://github.com/swaggo/swag/blob/807dd1ff15b1aeb068fd41bf2f83f6352a7240a2/operation.go#L741-L768
While I believe the grouping of the AND security methods would make more sense (// @Security securityMethod1 && securitymethod2
) than grouping OR, the current godoc spec would mean that ORs are present on the same line and grouped in the same map element (contradictory to what swagger yaml spec specifies).
Since Swagger YAML expects the output to contain the security methods grouped with AND in the same YAML element, converting it after creating the map incorrectly would be quite tedious.
Could we switch to an && grouping in the next major release? (breaking change)
// @Security: securityMethod1[option1,option2] && securityMethod2
// @Security: securityMethod3
would translate to
security:
- securityMethod1:
- option1
- option2
securityMethod2:
- securityMethod3:
Describe the bug A clear and concise description of what the bug is.
want generate like blow in yaml
but generate this
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Your swag version e.g. 1.4.1
Your go version e.g. 1.12.0
Desktop (please complete the following information):
Additional context Add any other context about the problem here.
https://swagger.io/docs/specification/2-0/authentication/api-keys/