diff --git a/aws_lambda_powertools/utilities/parser/models/apigw.py b/aws_lambda_powertools/utilities/parser/models/apigw.py index ed975e88e81..44ddda6e4f1 100644 --- a/aws_lambda_powertools/utilities/parser/models/apigw.py +++ b/aws_lambda_powertools/utilities/parser/models/apigw.py @@ -68,7 +68,7 @@ class APIGatewayEventRequestContext(BaseModel): routeKey: Optional[str] operationName: Optional[str] - @root_validator + @root_validator(allow_reuse=True) def check_message_id(cls, values): message_id, event_type = values.get("messageId"), values.get("eventType") if message_id is not None and event_type != "MESSAGE": diff --git a/aws_lambda_powertools/utilities/parser/models/cloudwatch.py b/aws_lambda_powertools/utilities/parser/models/cloudwatch.py index 26eeef5b56f..a0fd3e37239 100644 --- a/aws_lambda_powertools/utilities/parser/models/cloudwatch.py +++ b/aws_lambda_powertools/utilities/parser/models/cloudwatch.py @@ -28,7 +28,7 @@ class CloudWatchLogsDecode(BaseModel): class CloudWatchLogsData(BaseModel): decoded_data: CloudWatchLogsDecode = Field(None, alias="data") - @validator("decoded_data", pre=True) + @validator("decoded_data", pre=True, allow_reuse=True) def prepare_data(cls, value): try: logger.debug("Decoding base64 cloudwatch log data before parsing") diff --git a/aws_lambda_powertools/utilities/parser/models/kinesis.py b/aws_lambda_powertools/utilities/parser/models/kinesis.py index fa84674727a..8979d3f102f 100644 --- a/aws_lambda_powertools/utilities/parser/models/kinesis.py +++ b/aws_lambda_powertools/utilities/parser/models/kinesis.py @@ -18,7 +18,7 @@ class KinesisDataStreamRecordPayload(BaseModel): data: bytes # base64 encoded str is parsed into bytes approximateArrivalTimestamp: float - @validator("data", pre=True) + @validator("data", pre=True, allow_reuse=True) def data_base64_decode(cls, value): try: logger.debug("Decoding base64 Kinesis data record before parsing") diff --git a/aws_lambda_powertools/utilities/parser/models/sns.py b/aws_lambda_powertools/utilities/parser/models/sns.py index 76bd82531f4..856757c5464 100644 --- a/aws_lambda_powertools/utilities/parser/models/sns.py +++ b/aws_lambda_powertools/utilities/parser/models/sns.py @@ -25,7 +25,7 @@ class SnsNotificationModel(BaseModel): Timestamp: datetime SignatureVersion: str - @root_validator(pre=True) + @root_validator(pre=True, allow_reuse=True) def check_sqs_protocol(cls, values): sqs_rewritten_keys = ("UnsubscribeURL", "SigningCertURL") if any(key in sqs_rewritten_keys for key in values):