1
1
import {
2
- FieldNode ,
3
2
FragmentDefinitionNode ,
4
3
getNullableType ,
5
4
GraphQLError ,
@@ -15,7 +14,7 @@ import {
15
14
TypeMetaFieldDef ,
16
15
TypeNameMetaFieldDef ,
17
16
} from 'graphql' ;
18
- import { collectFields , collectSubFields } from './collectFields.js' ;
17
+ import { collectFields , collectSubFields , FieldDetails } from './collectFields.js' ;
19
18
import { getOperationASTFromRequest } from './getOperationASTFromRequest.js' ;
20
19
import { ExecutionRequest , ExecutionResult } from './Interfaces.js' ;
21
20
import { Maybe } from './types.js' ;
@@ -204,7 +203,7 @@ function visitRoot(
204
203
function visitObjectValue (
205
204
object : Record < string , any > ,
206
205
type : GraphQLObjectType ,
207
- fieldNodeMap : Map < string , FieldNode [ ] > ,
206
+ fieldNodeMap : Map < string , FieldDetails [ ] > ,
208
207
schema : GraphQLSchema ,
209
208
fragments : Record < string , FragmentDefinitionNode > ,
210
209
variableValues : Record < string , any > ,
@@ -230,7 +229,7 @@ function visitObjectValue(
230
229
}
231
230
232
231
for ( const [ responseKey , subFieldNodes ] of fieldNodeMap ) {
233
- const fieldName = subFieldNodes [ 0 ] . name . value ;
232
+ const fieldName = subFieldNodes [ 0 ] . fieldNode . name . value ;
234
233
let fieldType = fieldMap [ fieldName ] ?. type ;
235
234
if ( fieldType == null ) {
236
235
switch ( fieldName ) {
@@ -257,6 +256,7 @@ function visitObjectValue(
257
256
addPathSegmentInfo ( type , fieldName , newPathIndex , fieldErrors , errorInfo ) ;
258
257
}
259
258
259
+ // TODO: for fragment arguments we might need to update the variable-values here.
260
260
const newValue = visitFieldValue (
261
261
object [ responseKey ] ,
262
262
fieldType ,
@@ -322,7 +322,7 @@ function updateObject(
322
322
function visitListValue (
323
323
list : Array < any > ,
324
324
returnType : GraphQLOutputType ,
325
- fieldNodes : Array < FieldNode > ,
325
+ fieldNodes : Array < FieldDetails > ,
326
326
schema : GraphQLSchema ,
327
327
fragments : Record < string , FragmentDefinitionNode > ,
328
328
variableValues : Record < string , any > ,
@@ -350,7 +350,7 @@ function visitListValue(
350
350
function visitFieldValue (
351
351
value : any ,
352
352
returnType : GraphQLOutputType ,
353
- fieldNodes : Array < FieldNode > ,
353
+ fieldGroups : Array < FieldDetails > ,
354
354
schema : GraphQLSchema ,
355
355
fragments : Record < string , FragmentDefinitionNode > ,
356
356
variableValues : Record < string , any > ,
@@ -368,7 +368,7 @@ function visitFieldValue(
368
368
return visitListValue (
369
369
value as Array < any > ,
370
370
nullableType . ofType ,
371
- fieldNodes ,
371
+ fieldGroups ,
372
372
schema ,
373
373
fragments ,
374
374
variableValues ,
@@ -384,7 +384,7 @@ function visitFieldValue(
384
384
fragments ,
385
385
variableValues ,
386
386
finalType ,
387
- fieldNodes ,
387
+ fieldGroups . map ( group => group . fieldNode ) ,
388
388
) ;
389
389
return visitObjectValue (
390
390
value ,
@@ -404,7 +404,7 @@ function visitFieldValue(
404
404
fragments ,
405
405
variableValues ,
406
406
nullableType ,
407
- fieldNodes ,
407
+ fieldGroups . map ( group => group . fieldNode ) ,
408
408
) ;
409
409
return visitObjectValue (
410
410
value ,
0 commit comments