aws-cloudformation / aws-cloudformation/cloudformation-cli
cfn validate does not show a clear message to fix the schema
- Lingua principale
- Python
- Stelle
- 336
- Fork
- 172
- Merge medio
- 3g 5m
- PR unite (30g)
- 3
Descrizione
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.
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start by running cfn validate against the linked Redshift resource schema and inspect the validation path that produces both the warning and the final success message. Done means invalid schema input receives a clear explanation of what to fix and is not reported as valid.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100