I would like to define a JSON schema for an array that can contain two different objects (type A and type B). Only exactly the following combinations should be allowed:
[ A ]
[ A, B ]
[ B, A ]
[ B ]
my current schema draft
"myArray": {
"type": "array",
"minItems": 1,
"maxItems": 2,
"items": {
"oneOf": [
{
"title": "TypeA",
...
},
{
"title": "TypeB",
...
}
]
}
},
So far I have this schema, but this would also make an array with two times A valid. How can I specify the above condition?