You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the falsy valuation of the response body in the _handle_response method of the OpenAPIValidationMiddleware class with a more robust class/type comparison.
Steps to Reproduce
save snippet above to a file
install the following dependencies
"aws-lambda-powertools>=3.4.1"
"pydantic>=2.10.5"
"pytest>=8.3.4"
run the file
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:
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
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: