Skip to content

Support for "const"? #506

Closed
Closed
@martin-helmich

Description

@martin-helmich

I just noticed that the Validator class does not appear to support the const keyword as specified in section 6.1.3 of the spec. Is this intentional?

Given a few pointers where to start, I'd also be prepared to open a PR to add support for this feature.

$schema = [
        "properties" => [
                "foo" => [
                        "type" => "string",
                        "const" => "foo"
                ]
        ]
];

$doc = ["foo" => "bar"];

$validator = new JsonSchema\Validator();
$validator->validate($doc, $schema);

// expected: false, actual: true
var_dump($validator->isValid());

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