Skip to content

wrong handling of "required": false #21

Closed
@paranoiq

Description

@paranoiq

consider following schema fragmet:

{
    "type": "object",
    "properties": {
        "foo": {
            "type": "object",
            "required": false,
            "properties": {
                "bar": {
                    "type": "string",
                    "required": true
                }
            }
        },
        ...
}

if "foo" is not present in validated data, validation will fail with message foo.bar is missing and it is required

but when "foo" does not exist (and it does not need to!) it is no reason to validate its also non-existing child "bar". "bar" should be validated only if "foo" exists

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