【发布时间】:2017-12-31 12:44:54
【问题描述】:
我正在尝试为现有 JSON 数据文件构建 JSON 模式 (draft-06)。架构已经变得很大以适合单个文件,我正在尝试将其分解为多个文件。但是我不断收到错误can't resovle refrence sectionTableSchema.txt from id http://somesite/section
我制作了以下文件并将它们放在同一目录中。这些文件未托管在网络服务器上。
settingsSchema.txt:
{
"title":"Settings",
"$schema":"http://json-schema.org/draft-06/schema#",
"$id":"http://somesite/settingsSchema.txt",
"properties":{
"section":{
...
...
...
"$id":"/section",
"items":{
"oneOf":[
{"$ref":"#/sectionTableSchema.txt"},
{"$ref":"#/sectionNonTableSchema.txt"}
]
},
"type":"array"
}
},
"type":"object"
}
sectionTableSchema.txt
{
"$schema":"http://json-schema.org/draft-06/schema#",
"$id":"http://somesite/sectionTableSchema.txt",
"definitions":{},
"properties":{
....
....
....
}
"type":"object"
}
我认为我的部分问题是我对 $id 和 $ref 关键字的理解不足以了解绝对 uri、相对 uri、json 指针等之间发生的情况。
【问题讨论】:
标签: json validation schema