我正在尝试使用从另一个 json 模式导入定义,$ref但出现以下错误:
can't resolve reference ../base/definitions.schema.json#/definitions/datetime from id #
{
"$schema": "http://json-schema.org/draft-06/schema#",
“定义”:{
“约会时间”: {
“类型”:“字符串”
},
“姓名”: {
“类型”:“字符串”
},
}
}
{
"$schema": "http://json-schema.org/draft-06/schema#",
“特性”: {
“活动”:{“类型”:“布尔”},
"created_at": { "$ref": "../base/definitions.schema.json#/definitions/datetime" },
“名称”:{“$ref”:“../base/base/definitions.schema.json#/definitions/name”},
“updated_at”:{“$ref”:“../base/definitions.schema.json#/definitions/datetime”}
},
“必需”:[“名称”],
“类型”:“对象”
}
目录结构:
api - 根据 -- 定义.schema.json - 国家 --国家.schema.json
我通过使用绝对路径、fileurl 和其他几种路径组合尝试了几种组合。不知道发生了什么。
模式验证器:ajv@5.1.1