File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,13 @@ public Object parseValue(Object input) {
100100
101101 @ Override
102102 public Object parseLiteral (Object input ) {
103- return ((FloatValue ) input ).getValue ().doubleValue ();
103+ if (input instanceof IntValue ) {
104+ return ((IntValue ) input ).getValue ().doubleValue ();
105+ } else if (input instanceof FloatValue ) {
106+ return ((FloatValue ) input ).getValue ().doubleValue ();
107+ } else {
108+ return null ;
109+ }
104110 }
105111 });
106112
Original file line number Diff line number Diff line change @@ -115,8 +115,10 @@ class ScalarsTest extends Specification {
115115 Scalars.GraphQLFloat . getCoercing(). parseLiteral(literal) == result
116116
117117 where :
118- literal | result
119- new FloatValue (42.3 ) | 42.3d
118+ literal | result
119+ new FloatValue (42.3 ) | 42.3d
120+ new IntValue (42 ) | 42.0d
121+ new StringValue (" foo" ) | null
120122 }
121123
122124 @Unroll
You can’t perform that action at this time.
0 commit comments