| layout | default |
|---|---|
| title | Basics |
| parent | Features |
| nav_order | 1 |
This page covers the fundamental concepts of YAML Schema, including empty schemas, boolean schemas, and basic type validation.
An empty schema accepts any valid YAML value:
# SchemaValid examples:
42"I'm a string"an:
- arbitrarily
- nested
data: structureA schema with the value true accepts any value:
# Schema
trueValid examples:
42"I'm a string"an:
- arbitrarily
- nested
data: structureA schema with the value false rejects all values:
# Schema
falseInvalid examples:
42"I'm a string"an:
- arbitrarily
- nested
data: structureYAML Schema supports the following types:
stringnumberintegerbooleannullobjectarray
If you specify an unsupported type, validation will fail:
# Schema
type: fooError: Unsupported type: Expected type: string, number, integer, boolean, null, object, or array, but got: foo
# Schema
type: stringValid examples:
"""I'm a string"Invalid examples:
42an:
- arbitrarily
- nested
data: structure# Schema
type: numberValid examples:
423.14Invalid examples:
"I'm a string"an:
- arbitrarily
- nested
data: structure# Schema
type: object
properties:
foo:
type: string
bar:
type: numberValid examples:
foo: "I'm a string"
bar: 42foo: "I'm a string"Invalid examples:
foo: 42
bar: "I'm a string"Error: [1:6] .foo: Expected a string, but got: Value(Integer(42))
Note: Missing properties are allowed by default unless required properties are specified.