-
Notifications
You must be signed in to change notification settings - Fork 421
fix(event_handler): always add 422 response to the schema #3995
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
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.
Hey @rubenfonseca! The PR appears to be in a very good shape, with all functionality working as expected. I'm wondering if it's beneficial to include additional tests to safeguard against unintentional overriding of the client-defined 422 response when setting it specifically in the route definition.
What do you think?
great idea |
|
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.
APPROVED!
Issue number: #3600
Summary
Changes
This PR makes sure that the 422 error is always added to the OpenAPI schema, even when the user is customizing the response.
It also fixes the default schema of the 422 error to not have a "msg" field, for security reasons.
Also took the opportunity to simplify the code to make it easier to read.
User experience
After this PR, the user can still customize the openapi responses, while maintaining the 422 error that is generated when there is a validation error.
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.