-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 - Creating ability to add validators to api gw method without needing a model #2450
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
203 changes: 203 additions & 0 deletions
203
tests/translator/input/api_request_parameters_with_validator.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
Resources: | ||
HtmlFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: / | ||
Method: get | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
ValidateBody: true | ||
ValidateParameters: true | ||
|
||
HtmlFunctionNoValidation: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /no-validation | ||
Method: get | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
ValidateBody: false | ||
ValidateParameters: false | ||
|
||
HtmlFunctionMixinValidation: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /mixin | ||
Method: get | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
ValidateBody: true | ||
ValidateParameters: false | ||
|
||
HtmlFunctionOnlyBodyDefinition: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /only-body-true | ||
Method: get | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
ValidateBody: true | ||
|
||
HtmlFunctionOnlyRequestDefinition: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /only-request-true | ||
Method: get | ||
RequestValidators: | ||
ValidateParameters: true | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
|
||
HtmlFunctionOnlyRequestDefinitionFalse: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /only-request-false | ||
Method: get | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
ValidateParameters: false | ||
|
||
HtmlFunctionOnlyBodyDefinitionFalse: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /only-body-false | ||
Method: get | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
ValidateBody: false | ||
|
||
HtmlFunctionApiRequestParameterAndValidators: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /only-body-false-and-validator | ||
Method: get | ||
RequestValidators: | ||
ValidateParameters: true | ||
RequestParameters: | ||
- method.request.header.Authorization: | ||
Required: true | ||
Caching: true | ||
|
||
HtmlFunctionApiRequestParameterValidatorsAndModelBody: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /only-body-false-and-validator-and-model | ||
Method: get | ||
RequestValidators: | ||
ValidateParameters: false | ||
RequestParameters: | ||
- method.request.header.Authorization: | ||
Required: true | ||
Caching: true | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
ValidateBody: true | ||
ValidateParameters: true | ||
|
||
HtmlFunctionNotDefinedValidation: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: s3://sam-demo-bucket/member_portal.zip | ||
Handler: index.gethtml | ||
Runtime: nodejs12.x | ||
Events: | ||
GetHtml: | ||
Type: Api | ||
Properties: | ||
RestApiId: HtmlApi | ||
Path: /not-defined | ||
Method: get | ||
RequestModel: | ||
Model: User | ||
Required: true | ||
|
||
HtmlApi: | ||
Type: AWS::Serverless::Api | ||
Properties: | ||
StageName: Prod | ||
Models: | ||
User: | ||
type: object | ||
properties: | ||
username: | ||
type: string |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I am not sure if this should be the correct behaviour. I found it confusing, if the customer defined set the validation to
True
in theRequestModel
but toFalse
in theRequestValidators
, why should we disable the validations. I think it is not a good customer experience.