Skip to content

Error when trying to use cast and coerce #321

Closed
@iongion

Description

@iongion

Using json-schema 4.0, for this code that respects documentation on github repo home page:

            $validator = new Validator(
                Constraint::CHECK_MODE_TYPE_CAST | Constraint::CHECK_MODE_COERCE
            );

The error is:

Uncaught TypeError: Argument 1 passed to JsonSchema\Constraints\Constraint::__construct() must be an instance of JsonSchema\Constraints\Factory, integer given .... defined in vendor\justinrainbow\json-schema\src\JsonSchema\Constraints\Constraint.php:40

I've noticed now it expects a factory, how can it be solved as I have no clue on how to pass the factory

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