Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Fix List<ParameterValue> regex #96

Merged
merged 2 commits into from
Nov 20, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic
Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Merge PR #96, fix invalid List<ParameterValue> validation

## [1.3.4] - 2017-11-19
### Changed
Expand Down
7 changes: 7 additions & 0 deletions src/test/validatorTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,13 @@ describe('validator', () => {
expect(result['errors']['crit'][0]).to.have.property('message', 'Required property FunctionName missing for type AWS::Lambda::Version');
expect(result['errors']['crit'][1]).to.have.property('message', 'Required property FunctionName missing for type AWS::Lambda::Version');
});

it('a list of an extended parameter type should be properly mocked without causing an exception', () => {
const input = 'testData/valid/yaml/issue-94-list-security-group.yaml';
let result = validator.validateFile(input);
expect(result).to.have.deep.property('templateValid', true);
expect(result['errors']['crit']).to.have.lengthOf(0);
})
});

describe('parameters-validation', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function guessParameterValue(parameterName: string, parameter: any): string | st
} else {
const rawParameterType = parameter['Type'];

const listMatch = /^List<(\w+)>$/.exec(rawParameterType);
const listMatch = /^List<(.+)>$/.exec(rawParameterType);
let isList: boolean;
let parameterType: string;

Expand Down
7 changes: 7 additions & 0 deletions testData/valid/yaml/issue-94-list-security-group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ExistingSecurityGroups:
Type: List<AWS::EC2::SecurityGroup::Id>
Resources:
Bucket:
Type: AWS::S3::Bucket