Json模式相对于当前的$ref;id";
我已经搜索了SO和JSON模式文档几天了,但是我很难让我的JSON模式引用在同一目录中的多个文件中工作 我的根架构将是一个Json模式相对于当前的$ref;id";,json,jsonschema,Json,Jsonschema,我已经搜索了SO和JSON模式文档几天了,但是我很难让我的JSON模式引用在同一目录中的多个文件中工作 我的根架构将是一个对象之一: { "$schema": "http://json-schema.org/draft-04/schema", "id": "http://localhost/json-editor/schema/function.json", "title": "Function", "oneOf": [ { "$ref": "./fn_md5
对象之一:
{
"$schema": "http://json-schema.org/draft-04/schema",
"id": "http://localhost/json-editor/schema/function.json",
"title": "Function",
"oneOf": [
{
"$ref": "./fn_md5.json"
},
{
"$ref": "fn_sha1.json"
}
]
}
现在,在阅读了文档和这里的大多数问题之后,我假设/fn_md5.json
和fn_sha1.json
将被解析为http://localhost/json-editor/schema/fn_....json
(其中,…
当然代表各自的名称)。但是,解析器一直在查看http://localhost/json-editor/fn_....json
,它似乎与应用程序的url(在my上运行)相关
我是否理解模式和id
错误,或者可能是编辑器的URL解析器出错
谢谢 要查找所需的相对引用,请使用$id,如下所示:
{
"$schema": "http://json-schema.org/draft-04/schema",
"id": "http://localhost/json-editor/schema/function.json",
"$id":"https://www.baseurl.com/"
"title": "Function",
"oneOf": [
{
"$id": "./fn_md5.json"
},
{
"$id": "fn_sha1.json"
}
]
}
来源:应该像你说的那样解决。这似乎是解析器的问题。