55import graphql .Assert ;
66import graphql .Internal ;
77import graphql .PublicApi ;
8+ import graphql .execution .ValuesResolver ;
89import graphql .language .AstPrinter ;
9- import graphql .language .AstValueHelper ;
10+ import graphql .language .Value ;
1011import graphql .schema .FieldCoordinates ;
1112import graphql .schema .GraphQLArgument ;
1213import graphql .schema .GraphQLCodeRegistry ;
@@ -162,10 +163,10 @@ public enum TypeKind {
162163 Object type = environment .getSource ();
163164 if (type instanceof GraphQLArgument ) {
164165 GraphQLArgument inputField = (GraphQLArgument ) type ;
165- return inputField .getDefaultValue () != null ? print (inputField .getDefaultValue (), inputField .getType ()) : null ;
166+ return inputField .getDefaultValue () != null ? printDefaultValue (inputField .getDefaultValue (), inputField .getType ()) : null ;
166167 } else if (type instanceof GraphQLInputObjectField ) {
167168 GraphQLInputObjectField inputField = (GraphQLInputObjectField ) type ;
168- return inputField .getDefaultValue () != null ? print (inputField .getDefaultValue (), inputField .getType ()) : null ;
169+ return inputField .getDefaultValue () != null ? printDefaultValue (inputField .getDefaultValue (), inputField .getType ()) : null ;
169170 }
170171 return null ;
171172 });
@@ -182,8 +183,11 @@ public enum TypeKind {
182183 register (__InputValue , "description" , descriptionDataFetcher );
183184 }
184185
185- private static String print (Object value , GraphQLInputType type ) {
186- return AstPrinter .printAst (AstValueHelper .astFromValue (value , type ));
186+ private static String printDefaultValue (Object value , GraphQLInputType type ) {
187+ if (value instanceof Value ) {
188+ return AstPrinter .printAst ((Value ) value );
189+ }
190+ return AstPrinter .printAst (ValuesResolver .externalInputValueToLiteralLegacy (value , type ));
187191 }
188192
189193
0 commit comments