aws-cloudformation / aws-cloudformation/cloudformation-cli
cfn validate does not show a clear message to fix the schema
- Dominant language
- Python
- Stars
- 336
- Forks
- 172
- Avg merge
- 3d 5m
- Merged PRs (30d)
- 3
Description
I ran `cfn validate` against a [resource schema](https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-redshift/blob/master/clustersubnetgroup/aws-redshift-clustersubnetgroup.json) with issues that should be caught by [this fix](https://github.com/aws-cloudformation/cloudformation-cli/pull/642). But the message is confusing. The message should be clear in what has to be fixed and that the schema is **not** valid.
```
cfn validate
[Warning] Resource spec validation would fail from next major version. Provider should mark additionalProperties as false if the property is of object type and has properties or patternProperties defined in it. Please fix the warnings: 'additionalProperties' is a required property
Failed validating 'required' in schema['properties']['definitions']['patternProperties']['^[A-Za-z0-9]{1,64}$']['allOf'][0]['dependencies']['properties']:
{'$comment': 'An object cannot have both defined and undefined '
'properties; therefore, patternProperties is not allowed '
'when properties is specified. Provider should mark '
'additionalProperties as false if the property is of '
'object type and has properties defined in it.',
'not': {'required': ['patternProperties']},
'required': ['additionalProperties']}
On instance['definitions']['Tag']:
{'description': 'A key-value pair to associate with a resource.',
'properties': {'Key': {'description': 'The key name of the tag. You '
'can specify a value that is 1 '
'to 127 Unicode characters in '
'length and cannot be prefixed '
'with aws:. You can use any of '
'the following characters: the '
'set of Unicode letters, '
'digits, whitespace, _, ., /, '
'=, +, and -.',
'maxLength': 127,
'minLength': 1,
'type': 'string'},
'Value': {'description': 'The value for the tag. You '
'can specify a value that is '
'1 to 255 Unicode characters '
'in length and cannot be '
'prefixed with aws:. You can '
'use any of the following '
'characters: the set of '
'Unicode letters, digits, '
'whitespace, _, ., /, =, +, '
'and -.',
'maxLength': 255,
'minLength': 1,
'type': 'string'}},
'required': ['Value', 'Key'],
'type': 'object'}
Resource schema is valid.
```
Contributor guide
Assessment
This issue has not been assessed yet.