Description
I have the following example schema:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"data",
"test"
],
"properties": {
"data": {
"$id": "#/properties/data",
"type": "integer",
"title": "The Data Schema",
"default": 0,
"examples": [
123
]
},
"test": {
"$id": "#/properties/test",
"type": "object",
"title": "The Test Schema",
"required": [
"blah"
],
"properties": {
"blah": {
"$id": "#/properties/test/properties/blah",
"type": "integer",
"title": "The Blah Schema",
"default": 0,
"examples": [
1
]
}
}
}
}
}
Which I then load as per the following example:
$schemaStorage = new SchemaStorage();
$schemaStorage->addSchema('file://mySchema', $jsonSchemaObject);
I can then grab a fragment from the schema if I know the $id of a property:
print_r($schemaStorage->resolveRef('file://mySchema#/properties/test/properties/blah'));
How can I extract the fragment from the schema without knowing the $id but I know the path? For example getErrors() returns the path, not the ref or $id. For all schemas the path will exist if defined but the $id is optional.
See https://json-schema.org/understanding-json-schema/structuring.html#structuring
The reason for this requirement is that I am looking for a way to get access to user defined property keywords of a schema (which are allowed as per spec and correctly ignored by this implementation - see http://json-schema.org/latest/json-schema-core.html#rfc.section.6.4 )
Thanks.