Bug: PydanticSerializer for idempotency utility does not support Optional return types #5589
Labels
bug
Something isn't working
idempotency
Idempotency utility
pending-release
Fix or implementation already in dev waiting to be released
Expected Behaviour
The
PydanticSerializer
with theidempotent_function
decorator should support an optional return or raise a clear error message (along with doc updates)Current Behaviour
When using the
PydanticSerializer
with theidempotent_function
decorator, if the return can beNone
(Optional
orMyModel | None
), the utility will throw an error.Code snippet
Possible Solution
Allow for optional returns (maybe check for this scenario) or raise an error message that explains this limitation (update docs too)
Steps to Reproduce
Use idempotent decorator with PydanticSerializer. Set return type to
Optional
orMyModel | None
.Powertools for AWS Lambda (Python) version
2.43
AWS Lambda function runtime
3.11
Packaging format used
PyPi
Debugging logs
The text was updated successfully, but these errors were encountered: