File tree Expand file tree Collapse file tree
test/groovy/graphql/execution Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public Object coerce(Object input) {
2525
2626 @ Override
2727 public Object coerceValue (Object input ) {
28- return getValueByValue (input );
28+ return getValueByName (input );
2929 }
3030
3131 @ Override
@@ -38,10 +38,9 @@ public Object coerceLiteral(Object input) {
3838 }
3939 };
4040
41- private Object getValueByValue (Object value ) {
42- for (GraphQLEnumValueDefinition valueDefinition : valueDefinitionMap .values ()) {
43- if (value .equals (valueDefinition .getValue ())) return valueDefinition .getValue ();
44- }
41+ private Object getValueByName (Object value ) {
42+ GraphQLEnumValueDefinition enumValueDefinition = valueDefinitionMap .get (value );
43+ if (enumValueDefinition .getValue () != null ) return enumValueDefinition .getValue ();
4544 throw new GraphQLException ("" );
4645 }
4746
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ class ValuesResolverTest extends Specification {
201201 where :
202202 inputValue || outputValue
203203 " A_TEST" || " A_TEST"
204- 1 || 1
204+ " VALUE_TEST " || 1
205205
206206 }
207207}
You can’t perform that action at this time.
0 commit comments