-
Notifications
You must be signed in to change notification settings - Fork 146
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): enhance API Gateway schemas #2665
Conversation
@am29d - for when you're back. Many of the test events used in the unit tests are not in line with what I observed and reported in the API Gateway tests discussed in the linked issue. If possible, I'd ask you to please review my comment here, and if you agree replace the API Gateway event payloads with the ones I logged from API Gateway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for going through all the requests and adding the docs!
One minor ask: can we change to kebab-case apigw-proxy.ts
for consistency?
I agree to change the test events with the ones you have generated. The previous events were afaik from the docs, which we imported from PT python.
I have refactored the unit tests for API Gateway to use the events I recorded in the linked issue. I have put the new test events in dedicated folders and used a slightly different way of reading the files. This new method only reads the files needed for that specific test suite instead of performing i/o to read all the events for each test. Moving forward we should probably roll out this change across all other schemas/envelopes to improve test runtime. Finally, I couldn't test the WebSocket API but I suspect there might be an opportunity to split the I say this because some of the fields in the |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on refactoring the test event read operation. I remember having a mental todo but forgot about that. Great improvement!
Summary
Changes
As discussed in the linked issue, the schemas for API Gateway in the Parser utility had some inconsistencies and missing schemas.
In the issue I tested all the integration types and auth that I could think of for API Gateway and observed the payloads for each. I have used these payloads (that are in the issue) to inform the changes in this PR.
This PR fixes this by making the following changes:
APIGatewayRequestAuthorizerEventSchema
for Lambda Authorizer Request type in API Gateway v1 (REST)APIGatewayTokenAuthorizerEventSchema
for Lambda Authorizer Token type in API Gateway v1 (REST)APIGatewayRequestAuthorizerEventV2Schema
for Lambda Authorizer in API Gateway v2 (HTTP)APIGatewayProxyEventSchema
to conform with the actual event payload (see linked issue)APIGatewayProxyEventV2Schema
to conform with the actual event payload (see linked issue)Additionally, while working on this I have also made three other changes that are not strictly related to the issue at hand but still interest the code I touched
Issue number: #2624
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.