-
Notifications
You must be signed in to change notification settings - Fork 406
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
fix(event_handler): security scheme unhashable list when working with router #4421
fix(event_handler): security scheme unhashable list when working with router #4421
Conversation
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.
one tiny change, a few suggestions to improve tests, and one major question to prevent another bug
Adding a summary shortly after our call that led to important discoveries |
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.
last changes before merging the PR.
- Suggested a multi-expression and slightly better perf for hashing (along w/ explanation)
- Suggested a change in tests to make it more explicit that there is a
setup
for OpenAPI until we have a new API to solve the ambiguity - We're missing a test for Security Scheme mismatch. Top-level says
ApiKey
but path level uses aJWT
.
If you've got time, it'd be great to already address other pieces we missed prior to this PR
- An OpenAPI Schema specific exception, not
ValueError
. The exceptions we're returning can be more actionable too (we can start with the security scheme)
Thank you so much for the hard work on this <3
For anyone reading this later... As part of the security scheme bug fix review (#4421), we found that the responsibilities between OpenAPI and SwaggerUI are ambiguous, leading to confusion among customers and maintainers at times. As of now, these are common use cases:
We're confusing customers on 1 and 2, because How do we fix it in a backwards compatible way?
|
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.
Thanks for the review and suggestions @heitorlessa!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4421 +/- ##
===========================================
- Coverage 96.38% 96.36% -0.02%
===========================================
Files 214 219 +5
Lines 10030 10502 +472
Branches 1846 1944 +98
===========================================
+ Hits 9667 10120 +453
- Misses 259 270 +11
- Partials 104 112 +8 ☔ View full report in Codecov by Sentry. |
checking in 👀 ;) |
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.
THANK YOU for working out the missing tests <3
Made last round of suggestions and another accidental bug in the validator. We can merge afterwards
Quality Gate passedIssues Measures |
Issue number: #4375
Summary
Changes
This pull request ensures that the
get_openapi_json_schema
method can correctly generate the OpenAPI JSON schema for routes that include security parameters when using theAPIGatewayHttpRouter
.Previously, when the security parameter was included in a router, any endpoint would return an "Internal Server Error".
Example
app.py
router.py
User experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.