Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/utils/serverless-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ Notes:

- `cloudformation-schema.js` intentionally diverges from upstream: it removes
implicit YAML timestamp resolution and re-registers `!!timestamp` as an
explicit type (https://github.com/oss-serverless/osls/issues/438). Preserve
this when re-syncing.
explicit type (https://github.com/oss-serverless/osls/issues/438), and it
adds the `!Transform` and `!GetStackOutput` short forms that upstream lacks
(https://github.com/oss-serverless/osls/issues/450). Preserve this when
re-syncing.
- `config.js` is a locally owned fork. It intentionally keeps the synchronous
`get('frameworkId')` and `get('meta.created_at')` lookups that Bref v2/v3 use
for best-effort telemetry if a future compatibility shim routes
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/serverless-utils/cloudformation-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const functionNames = [
'FindInMap',
'GetAtt',
'GetAZs',
'GetStackOutput',
'If',
'ImportValue',
'Join',
Expand All @@ -20,6 +21,7 @@ const functionNames = [
'Select',
'Split',
'Sub',
'Transform',
];

const yamlType = (name, kind) => {
Expand Down
13 changes: 13 additions & 0 deletions test/unit/lib/utils/serverless-utils/cloudformation-schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@ describe('serverless-utils/cloudformation-schema', () => {
it('should construct a Date for an explicit timestamp tag', () => {
expect(load('date: !!timestamp 2020-12-12').date).to.be.instanceOf(Date);
});

it('should construct the Transform and GetStackOutput short forms', () => {
expect(
load(
'value: !Transform\n Name: AWS::Include\n Parameters:\n Location: s3://bucket/x.yml'
).value
).to.deep.equal({
'Fn::Transform': { Name: 'AWS::Include', Parameters: { Location: 's3://bucket/x.yml' } },
});
expect(
load('value: !GetStackOutput\n StackName: producer\n OutputName: VpcId').value
).to.deep.equal({ 'Fn::GetStackOutput': { StackName: 'producer', OutputName: 'VpcId' } });
});
});