Skip to Content
GraphQL Tools
DocumentationAPI@graphql-tools/utilssrcvariablescollectSubFields

Variable: collectSubFields

const collectSubFields: (schema, fragments, variableValues, returnType, fieldNodes) => FieldsAndPatches

Defined in: packages/utils/src/collectFields.ts:257

Given an array of field nodes, collects all of the subfields of the passed in fields, and returns them at the end.

CollectSubFields requires the “return type” of an object. For a field that returns an Interface or Union type, the “return type” will be the actual object type returned by that field.

Parameters

schema

GraphQLSchema

fragments

Record<string, FragmentDefinitionNode>

variableValues

returnType

GraphQLObjectType

fieldNodes

FieldNode[]

Returns

FieldsAndPatches