Validate JSON data with schemas, types, required fields, formats, composition, and API contracts.
Lessons
Create named reference targets inside a schema.
The $anchor Keyword is easiest to learn by reading the example, changing it, and observing the result.
{
"$defs": {
"name": {
"$anchor": "nameDef",
"type": "string",
"minLength": 1
}
},
"properties": {
"firstName": { "$ref": "#nameDef" },
"lastName": { "$ref": "#nameDef" }
}
}Practice the The $anchor Keyword example in a small scratch file, then explain what changed and why.