Examples¶
These examples show the compact .ysd form. Each link opens the complete packaged example in the interactive editor.
Required and optional fields¶
name is required.
The optional fields demonstrate a JSON Schema format, an integer range, and a
list whose items come from a fixed set.
Dependent fields¶
postOfficeBox?: +Str :need(streetAddress)
extendedAddress?: +Str :need(streetAddress)
streetAddress?: +Str
locality: +Str
region: +Str
postalCode?: +Str
countryName: +Str
When either extended address field is present, streetAddress is required.
The relationship maps to JSON Schema dependentRequired.
Alternatives and external references¶
deviceType: +Str
.one:
- .xref: https://example.com/smartphone.schema.json
deviceType?: +Str ==smartphone
- .xref: https://example.com/laptop.schema.json
deviceType?: +Str ==laptop
Exactly one branch must match. Each branch combines a discriminating constant with an external schema reference.
Open Device Type in the editor
Named definitions¶
Definitions begin with + and can be referenced anywhere in the document.
Lists and maps¶
tags is a non-empty list of unique strings.
The two map forms accept arbitrary string keys with string or unrestricted
values.
Real-world schema¶
The Harbor Next Helm chart example demonstrates nested definitions, maps, lists, ranges, annotations, and open subtrees in a production-sized schema.