I want the common parts of json schema to be captured in a file and then reference this file from the main schema file. So basically instead of 1 big json schema file, multiple files which reference each other. Am using json-schema-validator lib to validate.
E.g.:
$ ls schemas/
response_schema.json results_schema.json
$ cat schemas/response_schema.json
{
"$schema": "http://json-schema.org/draft-04/schema",
"type": "object",
"required": [ "results" ],
"properties": {
"results": "####Reference results_schema.json file here somehow####"
}
}
$ cat schemas/results_schema.json
{
"$schema": "http://json-schema.org/draft-04/schema",
"type": "array",
"items": {
"type": "object",
"required": ["type", "name"],
"properties": {
"name": { "type": "string" },
"dateOfBirth": { "type": "string" }
}
}
}