Definitions

Definitions let you declare a reusable schema once under $defs and reference it from multiple fields via $ref. This avoids repetition and makes it easier to update shared schemas in one place.

$defs

$defs is a JSON Schema keyword that holds named schemas in one place. Definitions do not validate anything on their own — they only take effect when referenced via $ref. They are ideal for any schema you want to reuse in multiple places without duplicating it.

$ref

$ref points to a definition using a JSON Pointer path. The path for a top-level definition named Address is #/$defs/Address. The field that uses $ref must match the definition exactly — it inherits all the definition's constraints.

Value (billing / shipping)StatusNote
{ "street": "1 Main St", "city": "NY" }
valid
matches the Address definition
"1 Main St"
invalid
a string does not match the Address object