-
Notifications
You must be signed in to change notification settings - Fork 401
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
feat(event_handler): support Header parameter validation in OpenAPI schema #3687
feat(event_handler): support Header parameter validation in OpenAPI schema #3687
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #3687 +/- ##
===========================================
+ Coverage 95.53% 95.58% +0.04%
===========================================
Files 215 215
Lines 10088 10136 +48
Branches 862 1865 +1003
===========================================
+ Hits 9638 9688 +50
+ Misses 340 339 -1
+ Partials 110 109 -1 ☔ View full report in Codecov by Sentry. |
|
@rubenfonseca this PR is ready to review. I want to highlight one point that you may want to change/refactor. According to the RFC, headers are case insensitive, so I lower the header names when resolving them in the DataClass and lower the parameter name as well when validating the OpenAPI schema. Even this is against Python standards, but a customer can create a function like this: @app.get("/hello")
def get(
HeADer1: Annotated[
str,
Header(
description="This is multi value header parameter.",
),
],
):
"""Return validated multi-value header values."""
return HeADer1 We must be able to compare "HeADer1" with the header name "header1" or "Heder1" or "HEader1". Thanks |
|
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.
This is great work, I only need to check the documentation now.
As we spoke during peer review, try to see if we can move the .lower
inside the Header's class alias setter. This way we can remove some if/elses in the code and streamline the feature.
Great work Leandro!
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.
Great job with the code, much cleaner! Just left some final comments on the documentation.
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Issue number: #3661
Summary
Changes
This pull request aims to enhance the OpenAPI schema by allowing the definition of headers as part of API specifications. An API call may require that custom headers be sent with an HTTP request. OpenAPI lets you define custom request headers as in: header parameters.
Key Changes:
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.