-
-
Notifications
You must be signed in to change notification settings - Fork 141
Description
Intro
I have a doubt about a current implementation choice of graphql over http.
Problem
Enum values are not accepted when passed along the query. But they are accepted when parametrized and passed as variables
Example
This doesn't work
{
field(enum_arg: "ENUM_VALUE") {
another_field
}
}
Assuming enum_arg
has an graphql enum type and ENUM_VALUE
is a valide Enum.name
for the given python Enum
sublcass.
But this apparently equivalent example does work
query MyQuery($arg: ArgType!) {
field(enum_arg: $arg) {
another_field
}
}
with variables :
{
"arg": "ENUM_VALUE"
}
does work.
Additional details
I went down and explore graphql-core source code and this is expected behaviour and it also has a test at https://github.com/graphql-python/graphql-core/blob/master/tests/type/test_enum.py#L257-L270
So i'm now sure this is expected behaviour.
Now my question is why is this the expected behaviour?
Is there any graphql/python concept that i am missing that explains this?
Thanks in advance for your effort writing and maintaining graphql-core
!