【发布时间】:2014-07-06 22:54:30
【问题描述】:
我有一个 json 文档,其中的一部分可以是 null 也可以是子对象,如下所示:
[{
"owner":null
},
{
"owner":{
"id":1
}
}]
问题是是否可以使用 ref 在 json 模式草案 v4 中对此进行建模?
我想要的是这样的
{
"type":"object",
"properties":{
"owner":{
"type":["null", "object"],
"$ref":"#/definitions/id"
}
},
"definitions":{
"id":{
"type":"object",
"properties":{
"id":{
"type":"number"
}
}
}
}
}
【问题讨论】:
标签: jsonschema