Получается, что это можно сделать, используя подсхемы и предикаты https://json-schema.org/understanding-json-schema/reference/conditionals.html
{
"$id": "https://sibytes.datagovernor.com/dataset.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "dataset",
"type": "object",
"properties": {
"dataset_type": {
"enum": ["Table","View"],
"description": "This is the type of physical object that the dataset describes."
}
},
"dataset_properties": {
"allOf": [
{
"if": {
"properties": {"dataset_type":{"const": "Table"}}
},
"then": {
"properties": {
"dataset_properties" : {
"$ref": "dataset.table.schema.json#/definitions/dataset_properties"
}
}
}
},
{
"if": {
"properties": {"dataset_type":{"const": "View"}}
},
"then": {
"properties": {
"dataset_properties" : {
"$ref": "dataset.view.schema.json#/definitions/dataset_properties"
}
}
}
}
]
},
"required": ["dataset_type","dataset_properties"]
}