Skip to content

An error occurred while verifying the array #525

Closed
@zh-five

Description

@zh-five
        $data = [1,3,4];
        $schema = [
            "type"  => "array",
            "items" => [
                "type"      => "string",
                "minLength" => 5,
            ],
            'minItmes' => 1,
        ];

        // Validate
        $validator = new JsonSchema\Validator();
        $validator->check($data, (object)$schema );

        if ($validator->isValid()) {
            echo "The supplied JSON validates against the schema.\n";
        } else {
            echo "JSON does not validate. Violations:\n";
            foreach ($validator->getErrors() as $error) {
                echo sprintf("[%s] %s\n", $error['property'], $error['message']);
            }
        }

//output
//The supplied JSON validates against the schema.

test by PHP5.6

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