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

parsing of JSONschema: null enum value is thrown away #3098

Closed
rienafairefr opened this issue Jan 31, 2019 · 0 comments
Closed

parsing of JSONschema: null enum value is thrown away #3098

rienafairefr opened this issue Jan 31, 2019 · 0 comments

Comments

@rienafairefr
Copy link

issue coming from downstream (swagger-parser and openapi-generator)
A value of null in a JSON schema enum should be perfectly valid if I'm reading the spec correctly, but it's not added to the enum value when parsing:

schema:
  enum: [A, B, C, null]
  type: string

results in the schema having getEnum() of ["A", "B", "C"] instead of ["A", "B", "C", null].
This bug was introduced by #2510 @frantuma. A cast value of null might be that the passed value does not cast to the intended type, but it might also mean the value is actually null, and this case shouldn't be discarded.

@rienafairefr rienafairefr changed the title parsing of json schema: null enum value are thrown away parsing of json schema: null enum value is thrown away Jan 31, 2019
@rienafairefr rienafairefr changed the title parsing of json schema: null enum value is thrown away parsing of JSONschema: null enum value is thrown away Jan 31, 2019
frantuma added a commit that referenced this issue Feb 1, 2019
fix #3098 - fix null enum item handling
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

1 participant