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
Even though I'm using data validation, I would like to still be able to return Response objects, which means I can still use all the other features of the event handler, including compression, headers, status codes, etc.
Current Behaviour
Right now, I can't return a Response object from my API. To do so, I would have to change the method signature, which would defeat the data validation middleware.
Code snippet
classModel(BaseModel):
name: strage: int# WHEN a handler is defined with a body parameter@app.post("/")defhandler(user: Model) ->Model:
returnuser# can't return anything else
Expected Behaviour
Even though I'm using data validation, I would like to still be able to return
Response
objects, which means I can still use all the other features of the event handler, including compression, headers, status codes, etc.Current Behaviour
Right now, I can't return a
Response
object from my API. To do so, I would have to change the method signature, which would defeat the data validation middleware.Code snippet
Possible Solution
Where Response becomes a generic class, and mypy will validate that it matches the type in the
body
.Steps to Reproduce
Check the code snippet above.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.7
Packaging format used
PyPi
Debugging logs
No response
The text was updated successfully, but these errors were encountered: