I've read through the RFCs regarding JSON Schema and JSON pointers, but I'm still struggling to understand how to correctly reference other documents.
Lets say I have the following files (on disk):
/foo/bar/schema/base.json
/foo/bar/schema/model/model.json
The base.json like this:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "/schema/base",
"title": "Base Response",
"description": "Schema descriptions of common properties of a response",
"type": [ "object" ],
"definitions": {
"data": {
"descrpition": "The response data is encapsulated within here",
"example": "true",
"type": [ "object", "array", "boolean", "null" ]
}
},
"properties": {
"data": { "$ref" : "#/definitions/data" }
}
}
The model.json file is something like this:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "/schema/model/model",
"type": "object",
"$ref": "/schema/base.json"
}
The $ref value in the model.json is what I am asking about. My understanding of the standard was that between the id and $ref of the document, we should be able to find the document.
Alternatively, I wondered whether something like:
"$ref": "../../base.json"
Would work?
But neither of those solutions seem to work using either Python or PHP libraries I've tried. I'm not sure where I'm going wrong?