-
Notifications
You must be signed in to change notification settings - Fork 61
Error Schema must be an object or a boolean, NULL given in #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello, try to modify the files like so:
{
"$id": "http://test/cTest.json#",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"title": {
"$ref": "title.json"
},
"code": {
"$ref": "title.json"
}
},
"required": ["title", "code"],
"additionalProperties": false
}
{
"$id": "http://test/title.json#",
"type": "string",
"minLength": 2,
"pattern": "^(.*)$"
} And this should be enough. |
Well, I cannot reproduce the issue even with your original files. Are you sure you are using the latest version of |
Yes, I am using the latest version. I installed it last week |
@PavelKoll I cannot reproduce your issue. cd ~
mkdir issue-25
cd issue-25
composer require opis/json-schema
touch index.php
# put the index.php content with nano or similar
touch cTest.json
# put the cTest.json content with nano or similar
touch title.json
# put the title.json content with nano or similar
php index.php
# The output is: $data is valid |
I'll try to install it again |
I don't know where the error was, but I installed the opis/json-schema again and everything works |
Hi, I have this script for validation
index.php
this JSON schema cTest.json
and this title.json
These 3 files are in the same folder.
Script shows this error:
Fatal error: Uncaught Opis\JsonSchema\Exception\InvalidSchemaException: Schema must be an object or a boolean, NULL given in /Data/Projects/test/vendor/opis/json-schema/src/Schema.php:63
Stack trace:
#0 /Data/Projects/test/vendor/opis/json-schema/src/Loaders/File.php(63): Opis\JsonSchema\Schema->__construct(NULL, 'http://test/titl...')
#1 /Data/Projects/test/vendor/opis/json-schema/src/Validator.php(419): Opis\JsonSchema\Loaders\File->loadSchema('http://test/titl...')
#2 /Data/Projects/test/vendor/opis/json-schema/src/Validator.php(322): Opis\JsonSchema\Validator->validateRef(Object(stdClass), 'TEST workcenter', Array, Array, Object(Opis\JsonSchema\Schema), NULL, Object(Opis\JsonSchema\ValidationResult))
#3 /Data/Projects/test/vendor/opis/json-schema/src/Validator.php(1908): Opis\JsonSchema\Validator->validateSchema(Object(stdClass), 'TEST workcenter', Array, Array, Object(Opis\JsonSchema\Schema), Object(stdClass), Object(Opis\JsonSchema\ValidationResult))
#4 /Data/Projects/test/vendor/opis/json-schema/src/Validator.php(946): Opi in /Data/Projects/test/vendor/opis/json-schema/src/Schema.php on line 63
What am I doing wrong?
Thank you.
The text was updated successfully, but these errors were encountered: