我正在使用 ajv 来验证正文请求。随着每一个请求的到来,ajv 工作正常,但它总是记录消息' $ref:在路径“#”的架构中忽略的关键字'
我有 2 个架构,login.json和login.defs.json
login.defs.json定义一个通用的模式定义,login.json引用它。
登录.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"$id": "http://blog-js.com/login.schema#",
"$ref": "login.defs#/definitions/login"
}
login.defs.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://blog-js.com/login.defs#",
"additionalProperties": false,
"definitions": {
"login": {
"type": "object",
"required": [
"account",
"password"
],
"properties": {
"account": {
"description": "The account or email of user",
"type": "string",
"minLength": 1,
"maxLength": 255
},
"password": {
"description": "The password of user",
"type": "string",
"minLength": 1,
"maxLength": 32
}
}
}
}
}
请告诉我我做错了什么?