Validate JSON data with schemas, types, required fields, formats, composition, and API contracts.
Lessons
Compare Draft 7, 2019-09, and 2020-12.
JSON Schema Drafts is easiest to learn by reading the example, changing it, and observing the result.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Lesson",
"type": "object",
"required": ["slug", "title"],
"properties": {
"slug": { "type": "string", "pattern": "^[a-z0-9-]+$" },
"title": { "type": "string", "minLength": 3 }
}
}Practice the JSON Schema Drafts example in a small scratch file, then explain what changed and why.