Skip to content

Method convertJsonPointerIntoPropertyPath() does not exist in class JsonSchema\Constraints\BaseConstraint #654

Closed
@emmanuelGuiton

Description

@emmanuelGuiton

The class JsonSchema\Constraints\BaseConstraint uses a method convertJsonPointerIntoPropertyPath() that is not defined though the class is not abstract and it does not extend any other.
See https://github.com/justinrainbow/json-schema/blob/f4f0c3457811006f861c466a10c6c24f3e92f9ae/src/JsonSchema/Constraints/BaseConstraint.php#L52

Thus, using the addError method on a JsonSchema\Validator instance throws an error :

php > require_once "target/vendor/autoload.php";
php > $validator = new JsonSchema\Validator();
php > $validator->addError(null,'An error message.');
PHP Warning:  Uncaught Error: Call to undefined method JsonSchema\Validator::convertJsonPointerIntoPropertyPath() in /home/nanu/git/rtms/libraries/core/target/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php:49
Stack trace:
#0 php shell code(1): JsonSchema\Constraints\BaseConstraint->addError()
#1 {main}
  thrown in /home/nanu/git/rtms/libraries/core/target/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php on line 49

Note that the convertJsonPointerIntoPropertyPath() method is defined in the JsonSchema\Constraints\Constraint abstract class. The latter extends JsonSchema\Constraints\BaseConstraint. Moving the method in this class solves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions