I’m adding to a json schema (version draft-07) where I want a property to be defined as one of a list of the results of a specific property that is stored in many json files accessible via my intranet.
So, a simpler example would be: assume the intranet site is “https://mycompany.com/inventory/teams.json” and the property I wish to build an enum from is called “slug”, then this should be a valid definition for the schema:
"teams": {
"description": "An array of teams in the inventory",
"type": "array",
"items": {
"type": "string",
"oneOf": [
{
"const": {
"$ref": "https://mycompany.com/inventory/teams.json#/slug"
}
}
]
}
}
In the example above, I would expect that a valid result would only be one of the “slug” properties from any object on that page. Do correct me if I’m wrong.
Now, the harder problem I have is that I wish to reference this property where each json object is itself a subpage to “https://mycompany.com/inventory/teams.json”. Is there a way to reference all of those?
For example, would
"$ref": "https://mycompany.com/inventory/teams.json/*/#/slug"
or something similar work?