Skip to content

Basic example is not working #2

@etki

Description

@etki

As taken from readme:

$validator = new Validator();
$schema = (object) ['minLength' => 3];
$validator->dataValidation("abc", $schema);
PHP Fatal error:  Uncaught Opis\JsonSchema\Exception\InvalidSchemaException: Schema must be an object or a boolean, NULL given in /home/etki/Workspace/ama-team.github.io/php/elasticsearch-schema/vendor/opis/json-schema/src/Validator.php:295
Stack trace:
#0 /home/etki/Workspace/ama-team.github.io/php/elasticsearch-schema/vendor/opis/json-schema/src/Validator.php(87): Opis\JsonSchema\Validator->validateSchema('abc', 'abc', Array, Array, Object(Opis\JsonSchema\Schema), NULL, Object(Opis\JsonSchema\ValidationResult))
#1 /home/etki/Workspace/ama-team.github.io/php/elasticsearch-schema/vendor/opis/json-schema/src/Validator.php(107): Opis\JsonSchema\Validator->schemaValidation('abc', Object(Opis\JsonSchema\Schema), 1, NULL)

Fast debugging has shown that $schema->resolve() returns null because schema->id was set to urn:5a4509dde8a0f#, but the required reference in schema->internal was urn:/5a4509dde8a0f# (had extra slash).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions