@@ -59,9 +59,10 @@ ${getDataClassMembers({ node, schema, config, completableFuture: true })}
5959 }
6060
6161 const potentialMatchingInputType = schema . getType ( `${ name } Input` ) ?. astNode ;
62- const typeWillBeConsolidated =
63- potentialMatchingInputType ?. kind === Kind . INPUT_OBJECT_TYPE_DEFINITION &&
64- inputTypeHasMatchingOutputType ( potentialMatchingInputType , schema ) ;
62+ const typeWillBeConsolidated = inputTypeHasMatchingOutputType (
63+ schema ,
64+ potentialMatchingInputType ,
65+ ) ;
6566 const outputRestrictionAnnotation = typeWillBeConsolidated
6667 ? ""
6768 : "@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT])\n" ;
@@ -85,7 +86,7 @@ function getDataClassMembers({
8586
8687 return node . fields
8788 ?. map ( ( fieldNode ) => {
88- const typeToUse = buildTypeMetadata ( fieldNode . type , schema , config ) ;
89+ const typeMetadata = buildTypeMetadata ( fieldNode . type , schema , config ) ;
8990 const shouldOverrideField =
9091 ! completableFuture &&
9192 node . interfaces ?. some ( ( i ) => {
@@ -98,19 +99,20 @@ function getDataClassMembers({
9899 const fieldDefinition = buildFieldDefinition (
99100 fieldNode ,
100101 node ,
102+ schema ,
101103 config ,
102104 completableFuture ,
103105 ) ;
104- const completableFutureDefinition = `java.util.concurrent.CompletableFuture<${ typeToUse . typeName } ${ typeToUse . isNullable ? "?" : "" } >` ;
105- const defaultDefinition = `${ typeToUse . typeName } ${ isExternalField ( fieldNode ) ? ( typeToUse . isNullable ? "?" : "" ) : typeToUse . defaultValue } ` ;
106+ const completableFutureDefinition = `java.util.concurrent.CompletableFuture<${ typeMetadata . typeName } ${ typeMetadata . isNullable ? "?" : "" } >` ;
107+ const defaultDefinition = `${ typeMetadata . typeName } ${ isExternalField ( fieldNode ) ? ( typeMetadata . isNullable ? "?" : "" ) : typeMetadata . defaultValue } ` ;
106108 const field = indent (
107109 `${ shouldOverrideField ? "override " : "" } ${ fieldDefinition } : ${ completableFuture ? completableFutureDefinition : defaultDefinition } ` ,
108110 2 ,
109111 ) ;
110112 const annotations = buildAnnotations ( {
111113 config,
112114 definitionNode : fieldNode ,
113- resolvedType : typeToUse ,
115+ typeMetadata ,
114116 } ) ;
115117 return `${ annotations } ${ field } ` ;
116118 } )
0 commit comments