-
Notifications
You must be signed in to change notification settings - Fork 2k
[Bug Reproduce] Can't use undefined as enum value #1367
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
Conversation
**Extracted from graphql#1267** From graphql#836 it looks like both `undefined` and `NaN` could be used as an enum values: ```js const TestEnum = new GraphQLEnumType({ name: 'TestEnum', values: { UNDEFINED: { value: undefined }, NAN: { value: NaN }, }, }); ``` And run this query: ```graphql { undefined: fieldWithEnumInput(input: UNDEFINED) NaN: fieldWithEnumInput(input: NAN) } ``` It will result in: ```json { "data": { "undefined": null, "NaN": null }, "errors": [ { "message": "Argument \"input\" has invalid value UNDEFINED.", "path": [ "undefined" ] } { "message": "Argument \"input\" has invalid value NAN.", "path": [ "NaN" ] } ] } ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why, but this is now causing test failures. I might be able to dig in later today.
@mjmahone Yes it known issue with graphql-js/src/utilities/coerceValue.js Lines 26 to 45 in 43c0d46
Correctly handling This PR is |
Resolved in #2148 |
Extracted from #1267
From #836 it looks like both
undefined
andNaN
could be used as an enum values:And run this query:
It will result in: