【发布时间】:2017-11-09 22:57:10
【问题描述】:
我有两个 json 模式:
//person schema
{
"id": "/person",
"type": "object",
"properties": {
"name": {"type": "string"},
"baseFields": {"$ref": "/baseFields"}
},
"additionalProperties": false
}
//baseFields schema
{
"id": "/baseFields",
"type": "object",
"properties": {
"age": {"type": "string"},
"hobby": {"type": "string"}
},
"additionalProperties": false
}
以下对象将通过“person scema”验证:
{
"name":"person1",
"baseFields":{
"age":"33",
"hobby":"diving"
}
}
我需要的是下面的对象来通过'person scema'验证:
{
"name":"person1",
"age":"33",
"hobby":"diving"
}
我需要它,因为我很少有与几个不同架构相关的字段
谢谢
【问题讨论】:
标签: schema jsonschema json-schema-validator