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

fix(parser): parse sqs record body field as JSON and S3Schema in S3SqsEventNoificationRecordSchema #3529

Conversation

cyrildewit
Copy link
Contributor

Summary

This pull request alters the Zod schema S3SqsEventNoificationRecordSchema to automatically parse the JSON encoded S3 event (S3Schema) within the "body" field of an SQS record. This makes sure that the S3 event payload is validated against the S3Schema and it allows us to immediately work with a typed evennt object.

The idea was initially raised/discussed in this discussion #3449 and was later converted into a feature request #3525. More context can be found there.

Changes

  • Wrap S3Schema with the JSONStringified helper in the body field of S3SqsEventNotificationRecordSchema

Issue number: #3525


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@pull-request-size pull-request-size bot added the size/S PR between 10-29 LOC label Jan 25, 2025
@boring-cyborg boring-cyborg bot added parser This item relates to the Parser Utility tests PRs that add or change tests labels Jan 25, 2025
Copy link

boring-cyborg bot commented Jan 25, 2025

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@github-actions github-actions bot added the feature PRs that introduce new features or minor changes label Jan 27, 2025
@cyrildewit cyrildewit force-pushed the feature/issue-3525-parse-json-stringified-body-field-of-S3SqsEventNotificationRecordSchema branch from ffa115a to 188d7fb Compare February 1, 2025 00:41
@cyrildewit cyrildewit changed the title feat(parser): parse sqs record body field as JSON and S3Schema in S3SqsEventNoificationRecordSchema fix(parser): parse sqs record body field as JSON and S3Schema in S3SqsEventNoificationRecordSchema Feb 1, 2025
@cyrildewit cyrildewit marked this pull request as ready for review February 1, 2025 00:42
@cyrildewit cyrildewit requested review from a team as code owners February 1, 2025 00:42
@github-actions github-actions bot added the bug Something isn't working label Feb 1, 2025
…dy-field-of-S3SqsEventNotificationRecordSchema
Copy link

sonarqubecloud bot commented Feb 1, 2025

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to work on this PR, highly appreciated.

And congrats for your first PR in this project getting merged!

@dreamorosi dreamorosi merged commit bcd4b9f into aws-powertools:main Feb 1, 2025
38 checks passed
Copy link

boring-cyborg bot commented Feb 1, 2025

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature PRs that introduce new features or minor changes parser This item relates to the Parser Utility size/S PR between 10-29 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Parse records as JSON and S3Schema in S3SqsEventNotificationRecordSchema
2 participants