I defined the following schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schemas/test",
"type": "object",
"properties": {
"A": {
"type": "string"
}
},
"oneOf": [
{
"properties": {
"B": {
"type": "integer"
},
"C": {
"type": "boolean"
}
}
},
{
"properties": {
"D": {
"type": "string"
}
}
}
]
}
The idea is that the schema contains A, and either B,C or D. None of the elements are required.
The following instance fails to validate:
{
"A": "world"
}