Description
Hi there,
As far as I know, this would be considered a feature request because I haven't found a way to do in via any features available in the current Draft-07 JSON Schema. The title of this issue sounds slightly strange, but the idea is extremely simple.
Consider the following JSON:
{
"favorite_animal": 32,
"animals": [
{
"id": 57,
"name": "Llama"
},
{
"id": 32,
"name": "Red Panda"
},
{
"id": 95,
"name": "Otter"
}
]
}
My aim is to have some schema-driven way of asserting that favorite_animal
maps to an id
of one of the objects in the animals
array. Specifically, it must map to exactly one id
, but depending on how this is implemented, it could be implemented in the spirit of the oneOf
, anyOf
, and allOf
family of keywords.
Is this already possible via some means of $ref
and whatnot, or am I out of luck? If the latter, is this use case seem practical and useful enough to warrant crafting functionality for it in JSON Schema?
Thanks,
Caleb
Metadata
Metadata
Assignees
Labels
Type
Projects
Status