11import {
2- FieldNode ,
32 FragmentDefinitionNode ,
43 getNullableType ,
54 GraphQLError ,
@@ -15,7 +14,7 @@ import {
1514 TypeMetaFieldDef ,
1615 TypeNameMetaFieldDef ,
1716} from 'graphql' ;
18- import { collectFields , collectSubFields } from './collectFields.js' ;
17+ import { collectFields , collectSubFields , FieldDetails } from './collectFields.js' ;
1918import { getOperationASTFromRequest } from './getOperationASTFromRequest.js' ;
2019import { ExecutionRequest , ExecutionResult } from './Interfaces.js' ;
2120import { Maybe } from './types.js' ;
@@ -204,7 +203,7 @@ function visitRoot(
204203function visitObjectValue (
205204 object : Record < string , any > ,
206205 type : GraphQLObjectType ,
207- fieldNodeMap : Map < string , FieldNode [ ] > ,
206+ fieldNodeMap : Map < string , FieldDetails [ ] > ,
208207 schema : GraphQLSchema ,
209208 fragments : Record < string , FragmentDefinitionNode > ,
210209 variableValues : Record < string , any > ,
@@ -230,7 +229,7 @@ function visitObjectValue(
230229 }
231230
232231 for ( const [ responseKey , subFieldNodes ] of fieldNodeMap ) {
233- const fieldName = subFieldNodes [ 0 ] . name . value ;
232+ const fieldName = subFieldNodes [ 0 ] . fieldNode . name . value ;
234233 let fieldType = fieldMap [ fieldName ] ?. type ;
235234 if ( fieldType == null ) {
236235 switch ( fieldName ) {
@@ -257,6 +256,7 @@ function visitObjectValue(
257256 addPathSegmentInfo ( type , fieldName , newPathIndex , fieldErrors , errorInfo ) ;
258257 }
259258
259+ // TODO: for fragment arguments we might need to update the variable-values here.
260260 const newValue = visitFieldValue (
261261 object [ responseKey ] ,
262262 fieldType ,
@@ -322,7 +322,7 @@ function updateObject(
322322function visitListValue (
323323 list : Array < any > ,
324324 returnType : GraphQLOutputType ,
325- fieldNodes : Array < FieldNode > ,
325+ fieldNodes : Array < FieldDetails > ,
326326 schema : GraphQLSchema ,
327327 fragments : Record < string , FragmentDefinitionNode > ,
328328 variableValues : Record < string , any > ,
@@ -350,7 +350,7 @@ function visitListValue(
350350function visitFieldValue (
351351 value : any ,
352352 returnType : GraphQLOutputType ,
353- fieldNodes : Array < FieldNode > ,
353+ fieldGroups : Array < FieldDetails > ,
354354 schema : GraphQLSchema ,
355355 fragments : Record < string , FragmentDefinitionNode > ,
356356 variableValues : Record < string , any > ,
@@ -368,7 +368,7 @@ function visitFieldValue(
368368 return visitListValue (
369369 value as Array < any > ,
370370 nullableType . ofType ,
371- fieldNodes ,
371+ fieldGroups ,
372372 schema ,
373373 fragments ,
374374 variableValues ,
@@ -384,7 +384,7 @@ function visitFieldValue(
384384 fragments ,
385385 variableValues ,
386386 finalType ,
387- fieldNodes ,
387+ fieldGroups . map ( group => group . fieldNode ) ,
388388 ) ;
389389 return visitObjectValue (
390390 value ,
@@ -404,7 +404,7 @@ function visitFieldValue(
404404 fragments ,
405405 variableValues ,
406406 nullableType ,
407- fieldNodes ,
407+ fieldGroups . map ( group => group . fieldNode ) ,
408408 ) ;
409409 return visitObjectValue (
410410 value ,
0 commit comments