0
我正在创建JsonSchema(v4)。 我试图根据其父项中的另一个属性的值来创建一个所需的属性。json模式 - 根据另一个字段值需要字段
父
- 用户
- 亚型
- 地址
儿童
- 地址
- 一号线
- 2号线
- 的companyName(如果需要用户亚型公司)
怎么能这样做? 我有这样的事情现在......
{
"User": {
"title": "User",
"type": "object",
"id": "#User",
"properties": {
"subtype": {
"type": "string"
},
"address": {
"$ref": "Address"
}
}
}
"Address": {
"title": "Address",
"type": "object",
"id": "#Address",
"properties": {
"line1": {
"type": "string"
},
"line2": {
"type": "string"
},
"companyName": {
"type": "string"
}
},
"required": ["line1", "line2"]
}
}
亚型是一个任意字符串,所以不同亚型的完整列表是不可能的。
非常感谢你这么多! – neljamin