-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cfnspec): make EndpointConfiguration of AWS::Serverless::Api a un…
…ion type A recent update to the SAM spec (#15311) changed the EndpointConfiguration property of AWS::Serverless::Api to have a complex type. However, that is a breaking change compared to the previous, string, type. I consulted with the SAM team, and it turns out the property accepts both a string and the complex type. Given that, patch our SAM spec to make EndpointConfiguration a union type.
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import '@aws-cdk/assert-internal/jest'; | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as sam from '../lib'; | ||
|
||
describe('AWS::Serverless::Api', () => { | ||
let stack: cdk.Stack; | ||
beforeEach(() => { | ||
stack = new cdk.Stack(); | ||
}); | ||
|
||
test('can be created by passing a complex type to EndpointConfiguration', () => { | ||
new sam.CfnApi(stack, 'Api', { | ||
stageName: 'prod', | ||
definitionBody: { | ||
body: 'definitionBody', | ||
}, | ||
endpointConfiguration: { | ||
type: 'GLOBAL', | ||
}, | ||
}); | ||
|
||
expect(stack).toHaveResourceLike('AWS::Serverless::Api', { | ||
StageName: 'prod', | ||
EndpointConfiguration: { | ||
Type: 'GLOBAL', | ||
}, | ||
}); | ||
}); | ||
|
||
test('can be created by passing a string to EndpointConfiguration', () => { | ||
new sam.CfnApi(stack, 'Api', { | ||
stageName: 'prod', | ||
definitionBody: { | ||
body: 'definitionBody', | ||
}, | ||
endpointConfiguration: 'GLOBAL', | ||
}); | ||
|
||
expect(stack).toHaveResourceLike('AWS::Serverless::Api', { | ||
StageName: 'prod', | ||
EndpointConfiguration: 'GLOBAL', | ||
}); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
packages/@aws-cdk/cfnspec/spec-source/901_SAM_Api_EndpointConfiguration_patch.json
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,29 @@ | ||
{ | ||
"ResourceTypes": { | ||
"AWS::Serverless::Api": { | ||
"Properties": { | ||
"EndpointConfiguration": { | ||
"patch": { | ||
"description": "Make the EndpointConfiguration property of AWS::Serverless::Api have a union type", | ||
"operations": [ | ||
{ | ||
"op": "add", | ||
"path": "/PrimitiveTypes", | ||
"value": ["String"] | ||
}, | ||
{ | ||
"op": "add", | ||
"path": "/Types", | ||
"value": ["EndpointConfiguration"] | ||
}, | ||
{ | ||
"op": "remove", | ||
"path": "/Type" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |