Skip to content

wrong handling of "required": false #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paranoiq opened this issue Nov 28, 2012 · 0 comments
Closed

wrong handling of "required": false #21

paranoiq opened this issue Nov 28, 2012 · 0 comments

Comments

@paranoiq
Copy link
Contributor

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

hakre pushed a commit to hakre/json-schema that referenced this issue Mar 26, 2015
wrong handling of "required": false (closes jsonrainbow#21)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants