【发布时间】:2022-01-13 19:35:34
【问题描述】:
大家!我感谢您的帮助。这是我第一次创建架构,它涉及航班数据,但我遇到了多个错误,因为在某些记录中,它不涉及特定字段(在本例中为 dst_airport)。
这是我包含的内容:
"dst_airport": {
"type": "object",
"properties": {
"airport_id": {
"type": "number"
},
"name": {
"type": "string"
},
"city": {
"type": "string"
},
"country": {
"type": "string"
},
"iata": {
"type": "string"
},
"iaco": {
"type": "string"
},
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
},
"altitude": {
"type": "number"
},
"timezone": {
"type": "number"
},
"dst": {
"type": "string"
},
"tz_id": {
"type": "string"
},
"type": {
"type": "string"
},
"source": {
"type": "string"
},
"anyOf": [
{
"required": [
"dst_airport"
]
}
]
}
}
我添加了我在网上找到的试图修复它的 anyof 部分,但我认为它实际上并没有起到任何作用。
有人可以帮忙吗?谢谢!
【问题讨论】:
标签: python json validation schema