Skip to content
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

"enum" does not work within "items" #426

Closed
erayd opened this issue May 23, 2017 · 5 comments
Closed

"enum" does not work within "items" #426

erayd opened this issue May 23, 2017 · 5 comments
Labels

Comments

@erayd
Copy link
Contributor

erayd commented May 23, 2017

Tested using the following against 2d404b8 on 6.0.0-dev. "two" is not defined in the enum, but is still considered valid. This should actually be an error.

Other constraints within items seem to work fine.

{
    "testArray": ["one", "two", "three"]
}
{
    "type": "object",
    "properties": {
        "testArray": {
            "type": "array",
            "items": {
                "type": "string",
                "enum": ["one", "three"]
            }
        }
    }
}
steve@neith /tmp $ ~/dev/json-schema/bin/validate-json --verbose test.json schema.json
OK. The supplied JSON validates against the schema.
@erayd erayd mentioned this issue May 23, 2017
@Merenptah
Copy link

Hi,

this issue can also be found in the actual version 5.2.7. Would anybody mind fixing it in there?

@jj40308
Copy link

jj40308 commented Oct 1, 2018

Hi,
5.2.7 & 6.x.x-dev branch can be fixed this situation by
https://github.com/justinrainbow/json-schema/search?q=0254213bb945ade4b4c3a8f292352759f2ab6e8d&type=Commits
, it would be great if v6.0.0 released... (v6.0.0 also contains keyword const ...)

@guilliamxavier
Copy link
Contributor

This seems to have been fixed since then, at least with 5.2.10 I get the expected error:

JSON does not validate. Violations:
[testArray[1]] Does not have a value in the enumeration ["one","three"]

@DannyvdSluijs
Copy link
Collaborator

I've been looking into this report but neither on the main (aliased as 6.0.0-dev) or 5.x.x branches is the above reproducible. I've also check the latest tag (v5.2.13) for which I also cannot reproduce.

@erayd erayd added the Bug label Apr 11, 2024
@erayd
Copy link
Contributor Author

erayd commented Apr 11, 2024

@DannyvdSluijs Thanks - will close as fixed.

@erayd erayd closed this as completed Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants