Skip to main content

YAML/schema matching

The value must be a valid YAML matching a YAML schema.

Parameter table

paramunitrequireddescription
keyyesThe key of the YAML value to validate.
schemayesThe YAML schema to validate against.

How to setup

This rule checks whether the YAML value associated with the specified (key) matches the specified YAML (schema). A YAML schema outlines the valid keys, data types, and hierarchical relationships allowed within a YAML document. The YAML schema is considered as an extension of JSON Schema Draft 4. The Schema describes the structure and format of the YAML data. If the YAML data does not match the schema, the rule will fail.

For more information about YAML schemas, check out the documentation.

Creator tips

A YAML Schema refers to a set of rules and conventions that define the structure and constraints of YAML documents. YAML (YAML Ain't Markup Language) is a human-readable data serialization format often used for configuration files and data exchange between languages with different data structures. A YAML schema outlines the valid keys, data types, and hierarchical relationships allowed within a YAML document. This rule can be used to validate your YAML data against a YAML schema.

To build a valid YAML that matches the schema, you have to follow the YAML syntax and the rules defined in the schema. For more information about YAML syntax, check out the documentation. you can also refer to the examples.

Examples

valuevalidschemadescription
name: John
age: 30
type: object
properties:
name:
type: string
age:
type: integer
The YAML data matches the schema.
name: John
age: thirty
type: object
properties:
name:
type: string
age:
type: integer
The YAML data does not match the schema.