Skip to content

Not proper "oneOf" handling #76

Closed
Closed
@antonCPU

Description

@antonCPU
{
    "oneOf": [
        {
            "type": "object",
            "properties": {
                "key": {
                    "type": "string"
                },
                "test1": {
                    "type": "string"
                }
            },
            "required": ["key", "test1"]
        },
        {
            "type": "object",
            "properties": {
                "key": {
                    "type": "string"
                },
                "test2": {
                    "type": "string"
                }
            },
            "required": ["key", "test2"]
        }
    ]
}

This schema will pass for:

{
     "test2" : "ok"
}

Because of array_unique() usage in JsonSchema\Constraints\Constraint::getErrors().
When the second schema will be checked a list of errors will contain "key" and "test1" errors. During checking will be added another error with "key" required, but array_unique() will erase it, so this schema will pass a criteria in JsonSchema\Constraints\Underfined::validateOfProperties() as a result.

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