也许这可以帮助你:
{
"properties": {
"Story_Taller": {
"type": "array",
"maxItems": 1,
"items": {
"properties": {
"Chapter": {
"type": "string"
},
"Story": {
"type": "string"
}
},
"additionalProperties": false
}
},
"Team_Table": {
"type": "array",
"maxItems": 1,
"items": {
"properties": {
"Name": {
"type": "string"
},
"Match": {
"type": "string"
},
"Won": {
"type": "string"
}
},
"additionalProperties": false
}
}
},
"oneOf": [
{
"title": "Story_Taller",
"required": [
"Story_Taller"
]
},
{
"title": "Team_Table",
"required": [
"Team_Table"
]
}
]
}
简而言之:
在您的 JSON 中,必须有一个“Story_Taller”或“Team_Table”属性,最多包含 1 个项目
"oneOf": [ ... ]
两个数组的属性都由项定义
“Story_Taller”必须具有“Chapter”和“Story”且没有附加属性。“Team_Table”必须具有“Name”、“Match”、“Won”且没有其他属性。所有这些都被定义为字符串。