Validate JSON data with schemas, types, required fields, formats, composition, and API contracts.
Lessons
Require data to match at least one subschema.
anyOf is easiest to learn by reading the example, changing it, and observing the result.
{
"type": "object",
"properties": {
"contact": {
"anyOf": [
{ "type": "string", "format": "email" },
{ "type": "string", "pattern": "^\\+?[0-9]{7,15}$" }
]
}
}
}Practice the anyOf example in a small scratch file, then explain what changed and why.