Skip to content

Commit

Permalink
feat(Variables): Recognize : in address to support output source
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Nov 8, 2021
1 parent a591008 commit 723927f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions lib/configuration/variables/parse.js
Expand Up @@ -426,11 +426,6 @@ module.exports = (inputValue) => {
contextVariables
);
finalizeSource();
} else if (char === ':') {
throw new ServerlessError(
`Invalid variable address at index ${sourceStart} in "${value}"`,
'INVALID_VARIABLE_ADDRESS'
);
}
break;
case 'afterAddressString':
Expand Down
12 changes: 6 additions & 6 deletions test/unit/lib/configuration/variables/parse.test.js
Expand Up @@ -32,6 +32,12 @@ describe('test/unit/lib/configuration/variables/parse.test.js', () => {
{ sources: [{ type: 'type', address: { value: 'address' } }] },
]));

// ${type:address:with:colons}
it('should support type and address with colons', () =>
expect(parse('${type:address:with:colons}')).to.deep.equal([
{ sources: [{ type: 'type', address: { value: 'address:with:colons' } }] },
]));

// ${type(param)}
it('should support param', () =>
expect(parse('${type(param)}')).to.deep.equal([
Expand Down Expand Up @@ -394,12 +400,6 @@ describe('test/unit/lib/configuration/variables/parse.test.js', () => {
.to.throw(ServerlessError)
.with.property('code', 'INVALID_VARIABLE_TYPE'));

// ${type:foo:bar}
it('should reject ":" strings in address literal', () =>
expect(() => parse('${type:foo:bar}'))
.to.throw(ServerlessError)
.with.property('code', 'INVALID_VARIABLE_ADDRESS'));

// ${type:address
it('should detect not closed variable', () => {
expect(() => parse('${type:address'))
Expand Down

0 comments on commit 723927f

Please sign in to comment.