-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Feature Request] Schema validation on an API Gateway Request #364
Comments
SAM CLI does not do any schema validation on the request like API Gateway does. Marking this as a feature request and will update the title to reflect the request. |
Note that in addition to not supporting schema validation, template mapping for requests and responses are also not supported -- would including request and response mapping be bundled with schema validation? I can align how I extract payload data between the gateway integration and sam local via a request template of |
Would love to see this as a feature. It would be great to be able to use API Gateway with AWS SAM but if even one API needs integration then it feels cleaner to manually manage all of them. |
Any update on this? Bit of a gap in my integration tests if I can't test the validation |
Adding
And in API GW console, under URL Query String Parameters, it shows this warning:
This makes us to need to updated RequestParameters in template (in order to have updated Swagger specs) and to update Lambda business logic (to perform validation). So it's extra work and can lead to inconsistency. |
This would be nice to be able to run integration tests locally. Without validation included it really keeps you thinking about validation in lambda code. |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
At a minimum, it would be really helpful for this to be flagged in the debug logs. I spent hours tweaking my OpenAPI file assuming that I was doing something wrong in the |
You have this bug if you use the console, but if you use CLI you must not have this problem.
or for version 2 : |
+10 |
* refactor for test command + some unit test fixes * remove some test command changes which accidentally went into refactor one * remove some test command changes which accidentally went into refactor one * sam test implementation and some groundwork * when neither payload nor payload_file is provided, it will use sys.stdin to read the payload * fix typo * use protocol instead of complex callable * use utf-8 for encoding * fix typo * use protocol instead of complex callable * address comments * address comments * feat(Accelerate): CI Fixes (aws#368) * Reverted pylint to 2.6.x * Disables PyLint for Generic * Updated boto3-stubs * Fixed Another PyLint Generic Issue * Fixed Test Typing Issues * Fixed Python3.7 and 3.8 re.escape Test Issue * Added ECR Login * fix unit tests * address comments * address comments * address comments * update log message * flip the flag back once we have new log group is created * feat: sam test lambda implementation (aws#366) * sam test lambda implementation * when neither payload nor payload_file is provided, it will use sys.stdin to read the payload * use utf-8 for encoding * fix typo * use protocol instead of complex callable * address comments & update with ability to pipe file input into test execution * feat: sam test sqs implementation (aws#367) * sam test sqs implementation * when neither payload nor payload_file is provided, it will use sys.stdin to read the payload * use utf-8 for encoding * fix typo * use protocol instead of complex callable * address comments & update with ability to pipe file input into test execution * address comments & update sqs test executor * added extra debug logging * address comments * address comments * make black Co-authored-by: Cosh_ <[email protected]>
Thanks for your interest in this feature. We are hesitant to merge this today because with the current resources we would not be able to commit to maintaining this feature in the long run - maintain feature parity and fix issues with the implementation in a timely manner. Given the reaction we can see that this is important to the community and we recommend one of the two alternatives -
|
It's curious that this is advertised heavily in the AWS documentation and by TAMs and solution architects as a solution to test and develop serverless applications yet there aren't enough resources for the project. In the past, there have been other things of this nature that have completely deterred us from using serverless and SAM specifically. It doesn't feel great to hear, as an AWS customer, that a technology so front and center doesn't have enough resources dedicated to it. I don't think idea number 1 is an acceptable solution because it is important to be able to emulate this feature locally for development and testing. It also helps to "sell" this technology to developers who are averse to using serverless because of this problem of not being able to troubleshoot and emulate things locally. As an AWS advocate at my company, this has been a main failure point to convince teams to leverage the technology. I think I could live with the second suggestion, but it doesn't feel super great either. Looking forward to see movement on this issue in the future. |
+1 |
+1 |
Thank you for the interest. To support this today in cloud, you can use |
|
No serious, enterprise-grade company would consider even touching AWS SAM, not with the current features, nor the dismissive attitude, as if this was an optional thing. |
I defined a schema to validate API request. It works fine in API Gateway but sam local doesn't execute the request validation. The lambda function is then executed with incorrect payload.
Is it the normal behavior ? Will it be implemented ?
The text was updated successfully, but these errors were encountered: