I am trying to document an existing use of JSON using json-schema. The system permits the following two possabilities for one of the object attributes.
Either
Use anyOf
to assert that the property must conform to one or another schema.
{
"type": "object",
"properties": {
"tracking_number": {
"anyOf": [
{ "$ref": "#/definitions/tracking_number" },
{ "type": "array", "items": { "$ref": "#/definitions/tracking_number" }
]
},
"definitions": {
"tracking_number": { "type": "integer" }
}
}