fix(openapi): correct response validation for falsy objects#7990
Open
amin-farjadi wants to merge 3 commits intoaws-powertools:developfrom
Open
fix(openapi): correct response validation for falsy objects#7990amin-farjadi wants to merge 3 commits intoaws-powertools:developfrom
amin-farjadi wants to merge 3 commits intoaws-powertools:developfrom
Conversation
|
Not all issues are linked correctly. Please link each issue to the PR either manually or using a closing keyword in the format If mentioning more than one issue, separate them with commas: i.e. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7990 +/- ##
===========================================
- Coverage 96.73% 96.63% -0.10%
===========================================
Files 278 278
Lines 13654 13656 +2
Branches 1086 1086
===========================================
- Hits 13208 13197 -11
- Misses 327 338 +11
- Partials 119 121 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue number: closes #5887, #6216
Summary
Fix openapi response validation behaviour on Falsy return objects.
Changes
in
openapi_validation.py,OpenAPIResponseValidationMiddlewareclass:_handle_responsemethod modified_serialize_responsemethod modified_serialize_responsemethod renamed to_serialize_response_with_validationin
test_openapi_validation_middleware.py:test_validation_error_none_returned_non_optional_typeto cover issue Bug: Open API Validation not validating response serialization when body is Falsy. #5887test_validation_error_different_list_returned_non_optional_typeandtest_validate_list_responseto cover Bug: Upgrade to 3.7.0 breaks List response validation in APIGatewayRestResolver #6216in
test_http_resolver_pydantic.py:test_async_handler_with_validationmarked to skip due to issue Bug(HttpResolverLocal): OpenAPIResponseValidationMiddleware is not working as intended #7981User experience
Now Falsy response will be validated againt the OpenAPI return field (is there is any).
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.