-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
Only instantiate specification once #1819
Conversation
@@ -31,7 +32,7 @@ def __init__( | |||
@classmethod | |||
def from_operation( | |||
cls, | |||
operation: AbstractOperation, | |||
operation: t.Union[AbstractOperation, Specification], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't immediately understand where this is coming from: why can this now be a Specification
object as well? The variable name is pretty confusing now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I understand it can be confusing 😅. This is because the security is defined both on the Operation
and the Specification
object, since it is defined at both these levels in the spec. For normal operations, the Operation
is used. But for the add_auth_on_not_found
, we create a dummy SecurityOperation
based on the Specification
.
I will add a comment explaining this.
examples/helloworld/hello.py
Outdated
@@ -9,7 +9,7 @@ def post_greeting(name: str) -> str: | |||
|
|||
app = connexion.FlaskApp(__name__, specification_dir="spec/") | |||
app.add_api("openapi.yaml", arguments={"title": "Hello World Example"}) | |||
app.add_api("swagger.yaml", arguments={"title": "Hello World Example"}) | |||
# app.add_api("swagger.yaml", arguments={"title": "Hello World Example"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remant from local testing?
# app.add_api("swagger.yaml", arguments={"title": "Hello World Example"}) | |
app.add_api("swagger.yaml", arguments={"title": "Hello World Example"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
3393107
to
5a1e535
Compare
Fixes #1801
I had to make quite a few additional changes to satisfy mypy.