Open Ninos opened 1 year ago
Seems that the $ref is not resolved correctly, if used in sub-properties.
$ref
My schema looks something like this:
{ "type": "string", "format": "select", "enum": { "$ref": "/some/example/subPath" } }
After validating, I get following error:
enum must be a non-empty array
My validator looks very "primitive":
$resolver = new SomeCustomResolver(); $schemaLoader = new SchemaLoader(null, $resolver); $validator = new Validator($schemaLoader); // $path is also a relative url, e.g. /some/example/mainPath $validator->validate($data, $path);
The custom resolver is working fine. I get the correct schema for the mainPath & also moving $ref to parent object works fine (jumps to https://github.com/opis/json-schema/blob/master/src/Parsers/SchemaParser.php#L490 correctly), for example:
{ "type": "string", "format": "select", "enum": ["test1", "test2"], "$ref": "/some/example/subPath" }
But I need it inside enum... May enum validation throws an error before resolving & replacing $ref property?
enum
Seems that the
$ref
is not resolved correctly, if used in sub-properties.My schema looks something like this:
After validating, I get following error:
My validator looks very "primitive":
The custom resolver is working fine. I get the correct schema for the mainPath & also moving
$ref
to parent object works fine (jumps to https://github.com/opis/json-schema/blob/master/src/Parsers/SchemaParser.php#L490 correctly), for example:But I need it inside
enum
... May enum validation throws an error before resolving & replacing$ref
property?