I not understand how correct reference to other schema. I used ajv, and have next two schema
First schema incorrect-email.json:
{
"title": "Не корректный email",
"properties": {
"status": {
"description": "Статус операции",
"type": "integer",
"enum": [68]
},
"error": {
"$ref":"error.json"
}
},
"required":["status", "error"],
"additionalProperties": false
}
Second schema error.json:
{
"type": "array",
"minItems": 2,
"items": {
"type": "object",
"properties": {
"description_ru": {
"description": "Информация об ошибке на русском языке",
"type": "string"
},
"description_en": {
"description": "Информация об ошибке на английском языке",
"type": "string"
}
},
"additionalProperties": false
}
}
After run test i get this error
Error: can't resolve reference error.json from id # Mine validation method:
var valid = ajv.validate(require("../schema/login/incorrect-email.json"), data);
Me need reference to local schema error.json, not remote server and etc. Please tell me, where i can added id in this schemas and $ref for correct parse with ajv