-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Example:
$loader = new \Opis\JsonSchema\Loaders\File('', ['./']);
$validator = new Validator(null, $loader);
$result = $validator->schemaValidation($data, $schema);
expected behavior: $result->isValid()
is either true or false
actual behavior:
Fatal error: Uncaught Opis\JsonSchema\Exception\SchemaNotFoundException: Schema '/tester.json' was not found or could not be loaded in ../vendor/opis/json-schema/src/Validator.php on line 416
Reason:
src/Loaders/File.php:54
strpos($uri, $this->prefix)
breaks, if $this->prefix
is empty
Bonus: The documentation is slightly incorrect, the constructor has to be called with an array as second parameter.
https://docs.opis.io/json-schema/1.x/php-loader.html -> "File loader"
$loader = new \Opis\JsonSchema\Loaders\File(
"http://example.com/",
"/path/to/schemas"
);