Skip to content

Commit

Permalink
fix(schema): AWS::Serverless::Api.MethodSettings should be a list
Browse files Browse the repository at this point in the history
Fixes a mistake in the SAM schema. AWS::Serverless::Api.MethodSettings should be a list of MethodSetting objects, not a single object.

fixes awslabs#242
  • Loading branch information
Graham Jenson authored and PaulMaddox committed Nov 30, 2019
1 parent e8ebc42 commit a1f340a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cloudformation/serverless/aws-serverless-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Api struct {
// MethodSettings AWS CloudFormation Property
// Required: false
// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi
MethodSettings interface{} `json:"MethodSettings,omitempty"`
MethodSettings []interface{} `json:"MethodSettings,omitempty"`

// Name AWS CloudFormation Property
// Required: false
Expand Down
3 changes: 2 additions & 1 deletion generate/sam-2016-10-31.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@
"MethodSettings": {
"Documentation": "https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi",
"Required": false,
"PrimitiveType": "Json",
"PrimitiveItemType": "Json",
"Type": "List",
"UpdateType": "Immutable"
},
"EndpointConfiguration": {
Expand Down
5 changes: 4 additions & 1 deletion schema/sam.go
Original file line number Diff line number Diff line change
Expand Up @@ -52120,7 +52120,10 @@ var SamSchema = `{
"type": "string"
},
"MethodSettings": {
"type": "object"
"items": {
"type": "object"
},
"type": "array"
},
"Name": {
"type": "string"
Expand Down
5 changes: 4 additions & 1 deletion schema/sam.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -52117,7 +52117,10 @@
"type": "string"
},
"MethodSettings": {
"type": "object"
"items": {
"type": "object"
},
"type": "array"
},
"Name": {
"type": "string"
Expand Down
14 changes: 7 additions & 7 deletions test/yaml/aws-serverless-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ Resources:
CacheClusterEnabled: true
CacheClusterSize: test-cache-cluster-size
Variables:
NAME: VALUE
NAME: VALUE

ServerlessApiWithDefinitionUriAsS3Location:
Type: AWS::Serverless::Api
Properties:
Name: test-name
StageName: test-stage-name
DefinitionUri:
DefinitionUri:
Bucket: test-bucket
Key: test-key
Version: 1
CacheClusterEnabled: true
CacheClusterSize: test-cache-cluster-size
Variables:
NAME: VALUE
NAME: VALUE

ServerlessApiWithDefinitionBodyAsJSON:
Type: AWS::Serverless::Api
Expand All @@ -40,27 +40,27 @@ Resources:
CacheClusterEnabled: true
CacheClusterSize: test-cache-cluster-size
Variables:
NAME: VALUE
NAME: VALUE

ServerlessApiWithDefinitionBodyAsYAML:
Type: AWS::Serverless::Api
Properties:
Name: test-name
StageName: test-stage-name
DefinitionBody:
DefinitionBody:
DefinitionKey: test-definition-value
CacheClusterEnabled: true
CacheClusterSize: test-cache-cluster-size
Variables:
NAME: VALUE
NAME: VALUE

ServerlessApiWithMethodSettingsAsYAML:
Type: AWS::Serverless::Api
Properties:
Name: test-name
StageName: test-stage-name
MethodSettings:
LoggingLevel: ERROR
- LoggingLevel: ERROR
MetricsEnabled: true
CacheClusterEnabled: true
CacheClusterSize: test-cache-cluster-size
Expand Down

0 comments on commit a1f340a

Please sign in to comment.