valid-block-mapping-key
Overview
This rule belongs to the yaml-semantic-validation ruleset and states that:
A block mapping is a series of entries consisting of key-value pairs. Key and value of a pair must be separated by a colon : and a space. There must be no other content between the key and the value.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Blocking |
| Message | Mapping values are not allowed in this context. |
| Code | YAMLSEMANTIC_V001 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Mapping Values |
| Tags | yaml data semantic preliminary checks validation yaml key key value pairs maps mapping objects |
Suggested Fixes
- A (key,value) pair separated with ':' and a space is expected at this point. Any other entity is not allowed.
- Ensure the (key,value) pair is nested inside the parent property with two spaces if it is not a root property.
- Ensure the (key,value) pair is indented properly as compared to other sibling properties (if any).
- Ensure there is no trailing comma after the value.
- Ensure any preceding quoted value in the file was closed properly.