-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swagger v2 - no security parsing #71
Comments
Hi @djcuvcuv that's interesting, and yes appears to be a bug in this module. FYI the code for I can see now, on closer reading of https://swagger.io/docs/specification/2-0/authentication/ that this is in fact incorrect and the logic should be
security:
- somethingElse: [] then look for an auth middleware under the key security:
- somethingElse: [read, write] then look for an auth middleware under the key I'll double check how this works in Open API v3 as well and get back to you. In the meantime please ensure you are upgraded to version |
Thanks very much @davesag. It is an interesting and subtle thing but essential for those that want 99% of their APIs to use the global security, and only add the empty security ("no security") stanza to the exempt 1%. Ah ok, I did not know this was updated in the latest version. I will go ahead and give that a try as well. And for what it is worth, I am using swagger v2.0, but do intend at some point to join the openAPI v3.0 party in the not so far future. Thanks again! |
Hi @djcuvcuv just letting you know I will have a proper fix for this ready soon. I am just cleaning up the unit tests now. |
…oth swagger v2 and openapi v3 documents
[bug fix, #71] global security vs path level security
This is now resolved in version 3.1.1. Please upgrade. |
@davesag Thanks very much for your quick turnaround on this. Much appreciated! |
I noticed that the normalize security functionality seems to misinterpret
security: []
as being an empty and therefore invalid security reference; however, it is documented in swagger.io as being the way in which to signify that a particular API has "no security." In other words, when using a globally-applied security definition, one can addsecurity: []
to the APIs which should be exempt from the globally-applied security definition. swagger.io has documented it here:https://swagger.io/docs/specification/2-0/authentication/
^see the "ping" API under the "Global security can be overridden..." section.
The error that is thrown on app startup time by swagger routes express is as follows:
The text was updated successfully, but these errors were encountered: