-
Notifications
You must be signed in to change notification settings - Fork 822
Enum default_value serialization issue #691
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
Comments
@nikordaris in your first example it should be |
@jkimbo using the value breaks the graphql enum spec. Introspection doesn't provide the value of an enum, only the name. This means that the value is never used once it gets to the client side. By setting the default_value to the enum value, the default_value becomes invalid as input for the enum on the client. This is an oversight of the spec in my opinion but graphql-js implements enum such that serializing the enum grabs the name instead of the value. graphene is not consistent with graphql-js which is considered the standard implementation. But that is why i tried setting the value to a string that is the same as the name but the parser for default_value for enum's doesn't parse string values correctly for enum. it includes escaped quotes in the value. |
Looks like you're right, there is an issue with representing the a default value of an Enum in graphiql. The issue is probably in https://github.com/graphql-python/graphql-core which is pretty much a direct port of graphql-js |
Ok, i'll create an issue in graphql-core as well to see what they think about it |
Thanks @nikolas , I'm going to close this issue in favour of the one in the graphql-core repo. |
Uh oh!
There was an error while loading. Please reload this page.
Using graphene 2.0.1
This results in the defaultValue being
"\"FOO\""
. This does not follow the graphql spec for enums and breaks with third party introspection. Specifically i'm trying to stitch a graphene remote schema and the invalid defaultValue results in a null returned in the merged schema (using graphql-tools).This also doesn't work with using MyEnum.FOO.value for default_value nor setting it specifically to the string "FOO"
I tried looking for how default_value gets resolved for enums but haven't been able to track it down. I think if we can just get the string value for default_value to not include the escaped string quotes then my schema stitching will work. I haven't been able to figure out how to define an enum so that this will happen.
The text was updated successfully, but these errors were encountered: