【发布时间】:2017-10-17 13:03:42
【问题描述】:
使用以下站点:http://jeremydorn.com/json-editor/ 并在架构部分粘贴以下代码:
{
"type": "object",
"Title": "Pets",
"definitions": {
"petType": {
"oneOf": [
{
"$ref": "#definitions/cat"
},
{
"$ref": "#definitions/dog"
}
]
},
"cat": {
"sounds": {
"enum": [
"meow",
"ghh"
]
}
},
"dog": {
"sounds": {
"enum": [
"woof",
"grr"
]
}
}
},
"properties": {
"productType": {
"type": "string",
"enum": [
"cats",
"dogs"
]
},
"sounds": {
"type": "string",
"enum": [
{ "$ref":"#definitions/petType" }
]
}
}
}
目标是使用匹配的宠物声音进行第二次下拉。但是如何正确地做参考呢?
【问题讨论】:
标签: json enums jsonschema