Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser): add support to Pydantic v2 - INITIAL DRAFT #2731

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws_lambda_powertools/utilities/parser/models/apigw.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def check_message_id(cls, values):
raise ValueError("messageId is available only when the `eventType` is `MESSAGE`")
return values

# validator to normalize requestTimeEpoch
@validator("requestTimeEpoch", pre=True)
def normalize_timestamp(cls, value):
date_utc = datetime.fromtimestamp(int(value) / 1000, tz=timezone.utc)
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_powertools/utilities/parser/models/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class KafkaRecordModel(BaseModel):
headers: List[Dict[str, bytes]]

# validators
_decode_key = validator("key", allow_reuse=True)(base64_decode) # type: ignore[type-var]
_decode_key = validator("key", allow_reuse=True)(base64_decode) # type: ignore[type-var, unused-ignore]

@validator("value", pre=True, allow_reuse=True)
def data_base64_decode(cls, value):
Expand Down