-
Notifications
You must be signed in to change notification settings - Fork 413
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
Bug: Open API Validation not validating response serialization when body is Falsy. #5887
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hey @amin-farjadi! Thanks for opening this, will check that. |
Hey @amin-farjadi , we were able to reproduce the bug, and we'll work on it. Thank you! |
Assigning to @anafalcao to see if it is possible to deliver in this current iteration. |
|
This is now released under 3.7.0 version! |
Reopening this since it created a regression: #6216 |
Expected Behaviour
When:
enable_validation=True
and,X
(e.g. a Pydantic model) and,Expected:
raise a 422 (
HTTPStatus.UNPROCESSABLE_ENTITY
) as the result of error in response serializationCurrent Behaviour
If function's return value is Falsy, the route is resolved to a 200 OK.
Code snippet
Possible Solution
Replace the falsy valuation of the response body in the
_handle_response
method of theOpenAPIValidationMiddleware
class with a more robust class/type comparison.Steps to Reproduce
Powertools for AWS Lambda (Python) version
latest, 3.4.1
AWS Lambda function runtime
3.12
Packaging format used
PyPi
Debugging logs
The text was updated successfully, but these errors were encountered: