Enum not converted to Enum type when fetched from DataFetchingEvironment arguments when Query Default Value is used · Issue #444 · graphql-java-kickstart/graphql-java-tools · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enum not converted to Enum type when fetched from DataFetchingEvironment arguments when Query Default Value is used #444
This works perfectly fine if I am providing the values to the query. However, when I don't provide value(s) and the default value is used, when the resolver gets the arguments from the DataFetchingEnvironment they come out as Strings and not their Enum type, this causes a ClassCastException: class java.lang.String cannot be cast to class com.example.enumerrorexample.StatusEnum
If this is me not understanding something could someone please let me know what I am doing wrong.
Fixed in 11.1.1 by #572: default values are now passed to graphql-java with defaultValueLiteral, so enum defaults are coerced to enum values instead of Strings. env.getArgument("fooStatus") returns StatusEnum values when the default is used. A regression test for list-of-enum defaults was added in 349d56a (EnumDefaultValueTest).
Activity
kumartheashwani commentedon Jan 25, 2021
@vojtapol Is this issue resolved? Can I take this bug if no one is working on it.
Add regression tests for fixed issues
oryan-block commentedon Oct 3, 2026
Fixed in 11.1.1 by #572: default values are now passed to graphql-java with
defaultValueLiteral, so enum defaults are coerced to enum values instead of Strings.env.getArgument("fooStatus")returnsStatusEnumvalues when the default is used. A regression test for list-of-enum defaults was added in 349d56a (EnumDefaultValueTest).