Define & Validate APIsValidation RulesetsData Rulesets
YAML Data Syntax Validation
Syntax validation checks performed on provided YAML data to check its conformance to standards.
| Property | Value |
|---|---|
| Ruleset ID | yaml-syntax-validation |
| Code prefix | YAMLSYNTAX_V |
| Type | Validation |
| Default severity | Blocking |
| Rule system | Syntax |
| Rules | 11 |
Mapping Values
| Code | Rule | Severity | What it checks |
|---|---|---|---|
YAMLSYNTAX_V001 | mapping-value-not-allowed | Blocking | Mapping values (key-value pairs) should only be used where the YAML specification allows it and the key-value pairs must start and terminate correctly. |
YAMLSYNTAX_V002 | required-mapping-value-colon-separation | Blocking | The key and value of a mapping (key-value pair) must be separated by a colon :. There must be a space between the colon : and the value. |
YAMLSYNTAX_V003 | no-reserved-keywords-in-unquoted-mapping-key | Blocking | The key content of the key-value pair (or mapping) must not use null unless it is intended to be a property name in which case it must be enclosed in quotes. Similarly, use of any other YAML reserved keywords must be avoided as key names unless they be enclosed in quotes. |
Scalars
| Code | Rule | Severity | What it checks |
|---|---|---|---|
YAMLSYNTAX_V050 | escaped-quoted-scalar | Blocking | A quoted scalar value must be escaped properly. A scalar value (like a number, string, etc.) can be quoted in two styles: single or double. The double-quoted style provides escape sequences. The single-quoted style is useful when escaping is not needed. If your scalar value needs escaping, use double quotes and appropriate escape sequences. |
YAMLSYNTAX_V051 | valid-quoted-scalar-termination | Blocking | A scalar value (like a number, string, etc.) can be quoted in two styles: single quotes or double quotes. Whatever style is picked for the scalar must be used consistently for it i.e. use either single quotes or double quotes but not both. There must be a quote before the value and after the value. |
Indentation
| Code | Rule | Severity | What it checks |
|---|---|---|---|
YAMLSYNTAX_V100 | valid-character-before-token-start | Blocking | A YAML token must be indented with spaces. Any other character used before the YAML token like tabs \t, etc. is not allowed |
YAMLSYNTAX_V101 | no-tab-indentation | Blocking | A YAML token must be indented with spaces. Tab indentation using \t is not allowed and should be replaced with spaces. |
Directives
| Code | Rule | Severity | What it checks |
|---|---|---|---|
YAMLSYNTAX_V150 | required-directive-name | Blocking | Directives are instructions to the YAML processor. They are identified by their name which is required and cannot be empty or null. |
YAMLSYNTAX_V151 | valid-yaml-directive-version-number | Blocking | The %YAML directive specifies the version of YAML the document conforms to. Documents explicitly specifying a YAML directive must only use a valid YAML version number after the directive name e.g. %YAML 1.2. |
Anchors
| Code | Rule | Severity | What it checks |
|---|---|---|---|
YAMLSYNTAX_V175 | resolvable-node-anchor | Blocking | A node can be anchored using & followed by an anchor name. This anchored node can then be referenced by an alias node using * followed by the anchor name. The anchor name used by the alias node must be valid and an anchored node of that name must exist. |
Miscellaneous
| Code | Rule | Severity | What it checks |
|---|---|---|---|
YAMLSYNTAX_V200 | valid-yaml | Blocking | YAML data must follow standards defined in the official YAML specification. |