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: Validating allowed null value fails #126

Closed
heneke opened this issue Dec 16, 2017 · 3 comments
Closed

Enum: Validating allowed null value fails #126

heneke opened this issue Dec 16, 2017 · 3 comments

Comments

@heneke
Copy link

heneke commented Dec 16, 2017

Consider the following enum schema:

"enum": [null, "foo", "bar"]

A valid null value in the JSON instance will be considered invalid, because the null is not added to the set of possible values.

@heneke
Copy link
Author

heneke commented Dec 16, 2017

Sorry, it is added, but validation fails nevertheless.

@heneke
Copy link
Author

heneke commented Dec 17, 2017

See #127

erosb added a commit that referenced this issue Dec 17, 2017
erosb added a commit that referenced this issue Dec 17, 2017
`EnumSchema#toJavaValue()` - which is supposed to unwrap an org.json value to be a "plain java" value didn't handle the
`JSONObject#NULL` -> `null` conversion, so this is fixed now.

Also adding a more proper test for checking what enum values are loaded during the schema loading process.
@erosb
Copy link
Contributor

erosb commented Dec 17, 2017

Fixed in 60cbcca .
Thank you for reporting it and submitting a possible patch.

@heneke heneke closed this as completed Dec 18, 2017
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