feat(event_handler): add route-level custom response validation in OpenAPI utility #6341
Conversation
… error status code.
…lidation_error_http_code
|
n.b. |
Try to run |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6341 +/- ##
========================================
Coverage 96.33% 96.33%
========================================
Files 243 243
Lines 11763 11797 +34
Branches 871 878 +7
========================================
+ Hits 11332 11365 +33
Misses 337 337
- Partials 94 95 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Looking at this now. |
leandrodamascena
left a comment
There was a problem hiding this comment.
Hi @amin-farjadi! Super thanks for this another PR. It took me a few more days than I expected to review this PR because I had some internal priorities.
Overall this PR is pretty good, but there is 1 critical item that needs to be fixed before I can do a final review and merge.
Please let me know if you need any help.
|
@leandrodamascena I think it's all done. appreciate a review. p.s. found a lil bug whilst testing the openapi schema — #6435 |
|
leandrodamascena
left a comment
There was a problem hiding this comment.
Hey @amin-farjadi! Thanks a lot for another super nice PR and addressing all the comments!
APPROVED!!
…enAPI utility (#6341) * feat(api-gateway-resolver): Add option for custom response validation error status code. * feat(docs): Added doc for custom response validation error responses. * feat(unit-test): Add tests for custom response validation error. * fix: Formatting. * fix(unit-test): fix failed CI. * feat(unit-test): add tests for incorrect types and invalid configs * refactor: rename response_validation_error_http_status to response_validation_error_http_code * refactor(tests): move unit tests into openapi_validation functional test file * feat: add route-specific custom response validation and tests * fix: except Route implementation * fix: put custom_response_validation_http_code before middleware * feat: route's custom response validation must take precedence over app's. * feat: added more tests. * refactor: improved error messagee and tests' descriptions. * feat: updated docs. * move veritifcation method of route custom http code to BaseRouter. * fix: add validate function for route http code to APIGatewayResolver not Router * feat: add custom_response_validation_http_code to the routes of Bedrock * fix: make mypy happy * fix: address comments * fix(openapi): add response for response validation error and definition for it * minor changes * minor changes --------- Co-authored-by: Amin Farjadi <amin.farjadi@eonnext.com> Co-authored-by: Leandro Damascena <lcdama@amazon.pt>

Issue number: #6245
Summary
Adds custom http code for when response validation fails per route.
Changes
custom_response_validation_http_codeargument forRouteroutemethod inRouterandAPIGatewayResolver_validate_route_response_validation_error_http_codemethod toAPIGatewayResolverhas_route_custom_response_validationargument to the_serialize_responsemethod in OpenAPIValidationMiddlewareresponse_validation_error_response_definitionto open api typesUser experience
After the merge of #6189, users could add custom response validation error http code at the app level
Now, users can customise the response validation http code at route level as well as at app level
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.