Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityBlocking
MessageMapping values are not allowed in this context.
CodeYAMLSEMANTIC_V001
TypeValidation
Rule SystemSemantic
Broad CategoryMapping Values
Tagsyaml 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.

For More Information