Closed
Description
Expected Behaviour
It should be possible to use own model classes for body in APIGatewayProxyEventV2Model
Current Behaviour
When I extend APIGatewayProxyEventV2Model model to include my own model for the body following exception is raised 1 validation error for Event\nbody\n value is not a valid dict (type=type_error.dict)
. I suppose the reason for that is that body of apigw v2 event is a string
Code snippet
from aws_lambda_powertools.utilities.parser import BaseModel
from aws_lambda_powertools.utilities.parser.models import (
APIGatewayProxyEventV2Model
)
class OrderCancelationRequest(BaseModel):
reason: str
orderNo: str
class MyEventModel(APIGatewayProxyEventV2Model):
body: OrderCancelationRequest
Possible Solution
No response
Steps to Reproduce
parse(model=MyEventModel, event=any valid apigw event)
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
No labels