RFC X / Superseded

introduce ExecuteGroupedFieldSet, CollectRootFields and CollectSubfields

Opened on
Closed on

At a glance

Project
GraphQL Spec
Identifier
#999
Stage
RFC X / Superseded
Champion
@yaacovCR
Updated
2025-06-12
Latest activity
Marked as Superseded on
Source
Related RFCs

Pull request description

Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, this PR introduces CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

The reference implementation already uses this algorithm so that this change actually aligns the specification to the reference implementation, and is ipso facto non-breaking.

Motivation: reformulating the specification in this manner may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal. In such a scenario, it may still be quite possible to merge the set of requested data from a field set's subSelectionSets, but it may not be possible to express that merged data as an equivalent selectionSet.

In particular, currently:

{
  a {
    subfield1
  }
  ...ExampleFragment
}

fragment ExampleFragment on Query {
  a {
    subfield2
  }
  b
}

For the given set of fields:

a {
  subfield1
}
a {
  subfield2
}

These can currently be trivially merged as:

a {
  subfield1
  subfield2
}

However, the requested information for a in:

{
  a {
    subfield1
  }
  Ref1 { completed } : ...ExampleFragment
}

fragment ExampleFragment on Query {
  a {
    subfield2
  }
  b
}

cannot be contained in a merged selection set under A, because some of those fields will be related to Ref1 and some will not. The requsted information can still be merged, but it cannot be expressed in selection set format.

Timeline

June 2025

September 2024

June 2023

  • Advanced to RFC 0 on by michaelstaib
  • On the agenda for GraphQL WG

    12 listed attendees · 10 agenda items · 4 linked RFCs

    • Agree to Membership Agreement, Participation & Contribution Guidelines and Code of Conduct (1m, Lee)
    • Introduction of attendees (5m, Lee)
    • Determine volunteers for note taking (1m, Lee)
    • Review agenda (2m, Lee)
    • Review prior secondary meetings (5m, Lee)
    • Review previous meeting's action items (5m, Lee)
    • Default Value Validation Status Check (5m, Yaacov) #793
    • Clarification on Nested List Input Coercion (5m, Abhinand)
    • CollectSubFields (30m, Yaacov) #999 #1026
    • @deprecated on OBJECT - next steps (15m, Stephen) #997

April 2023

November 2022