Can someone tell me how to make the JustinRainbow Json schema validator be able to find references.
This is the schema of foobar I'm trying to validate:
{
"title": "foobar schema",
"type": "object",
"properties": {
"pagination": {
"$ref": "#/definitions/pagination"
}
},
"required": ["pagination"]
}
And the definition of the pagination schema is contained in a separate file on my computer.
Trying to validate that without telling the JSON validator how to resolve references like this:
$uriRetriever = new JsonSchema\Uri\UriRetriever();
$refResolver = new JsonSchema\RefResolver($uriRetriever, $uriResolver);
$schema = $refResolver->resolve("file://".realpath(__DIR__."/foobar.json"));
Gives an error message:
File: file://features/foobar.json is found, but could not resolve fragment: #/definitions/pagination (JsonSchema\Exception\UnresolvableJsonPointerException)
Which is fair enough as there is no way for the validator to know how to find the file that contains the pagination schema definition....so how can I tell the RefResolver how to find the definition of the pagination schema?
I would prefer to be able to resolve the file through the local filesystem, rather than having to use URL's on a webserver.