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): set APIGatewayProxyEventSchema body and query string keys to be nullable #2465

Merged

Conversation

blytheaw
Copy link
Contributor

@blytheaw blytheaw commented May 1, 2024

Summary

The APIGatewayProxyEventSchema has incorrect types for these request keys: body, queryStringParameters, and multiValueQueryStringParameters.

The above fields are incorrectly validating against z.optional() (undefined) when they are not present in the request, but API Gateway actually sends these values as null in this case.

Changes

This PR addresses the issue by changing the Zod schemas to use z.nullable() instead. Unit tests are updated to reflect the change.

Issue number: #2461


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.

@blytheaw blytheaw requested review from a team as code owners May 1, 2024 16:27
@boring-cyborg boring-cyborg bot added parser This item relates to the Parser Utility tests PRs that add or change tests labels May 1, 2024
Copy link

boring-cyborg bot commented May 1, 2024

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

@pull-request-size pull-request-size bot added the size/S PR between 10-29 LOC label May 1, 2024
Copy link

sonarcloud bot commented May 1, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@dreamorosi dreamorosi requested a review from am29d May 1, 2024 17:00
@dreamorosi dreamorosi linked an issue May 1, 2024 that may be closed by this pull request
@github-actions github-actions bot added the bug Something isn't working label May 1, 2024
Copy link
Contributor

@am29d am29d left a comment

Choose a reason for hiding this comment

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

Hey @blytheaw , thanks for raising the issue and the PR, much appreciated!

@am29d am29d merged commit 7ce5b3c into aws-powertools:main May 2, 2024
19 checks passed
Copy link

boring-cyborg bot commented May 2, 2024

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 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.

Bug: APIGatewayProxyEventSchema incorrect schemas
2 participants