I have a set of options for validation:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "parsePosition Validator",
"type": "object",
"properties": {
"option1": {
"type": "array",
"items": {
"tpye": "number"
},
"minItems": 3
},
"option2": {
"type": "array",
"items": {
"tpye": "number"
},
"minItems": 3
},
"option3": {
"oneOf": [
{
"type": "array",
"items": {
"tpye": "number"
},
"minItems": 3
},
{
"x": { "type":"number" },
"y": { "type":"number" },
"z": { "type":"number" },
"required": ["x","y","z"]
}
}
},
"oneOf": [
{ "required":["option1"] },
{ "required":["option2"] },
{ "required":["option3"] }
]
}
Essentially the input of the json can be any of the three options. My issue arises when trying to validate option3. Possible inputs could be:
{
"option3": [1,2,3]
}
or
{
"option3": {
"x": 1,
"y": 2,
"z": 3
}
}
However, when I use the array rather than objects, the validator does not throw an issue with an empty array or an array of incorrect size.
Am I missing something?