RFC 3 / Accepted

Allow empty selection sets

Opened on
Merged on

At a glance

Project
GraphQL Spec
Identifier
#1227
Stage
RFC 3 / Accepted
Champion
@benjie
Updated
2026-11-26
Latest activity
Pull request merged on
Source
Related RFCs

Pull request description

Since 2015 we've required selection sets to contain at least one field; however it's always been possible to have an empty object returned:

type A { a: Int }
type B { b: Int }
union U = A | B
type Query { u: U }

query {
  u {
    ... on A { __typename }
  }
}

Here, if u returns type B the result will be {"data":{"u":{}}} - i.e. an empty object.

GraphQL clients are getting smarter and smarter, and it's common to have client-side extensions such as Apollo's @client, Relay Resolvers or @mock'd fields. In all of these cases, any selections of these fields need to be removed before the document is sent to the server. But what happens when all the fields in the selection set are to be removed?

  query LaunchDetails($launchId: ID!) {
    launch(id: $launchId) {
      isInCart @client
      site @client
    }
  }

There are many options (add __typename, remove launch, throw error, ...), but the safest solution is to allow the selection set to be empty. Hence, this PR.

  • Fixes #674

Timeline

September 2026

  • Pull request merged on by leebyron
  • Discussed in GraphQL WG

    The September Secondary Working Group for the GraphQL specification met to review several agenda items and discuss updates to the specification. The group reviewed and approved three items for merge: one-off inhabitability, allow empty selection sets, and clarification of response position definitions. They also discussed error propagation rules, with Benjie proposing that sibling errors should not be added after propagation, which the group agreed to merge with minor editorial changes. The team reviewed the HTTP specification updates, including notes about new status code 294 for partial success, and decided to proceed with the spec cuts planned for the following Thursday. Rob presented updates on the defer stream specification, focusing on improvements to the visited fragments algorithm to prevent potential complexity explosions, which Benjie agreed to review for potential security issues.

    Zoom summary · GraphQL WG · 2026-09-17
    Next Steps

    Benjie: Merge the pull request for "allow empty selection sets" after Lee's minor wording change.

    Zoom summary · GraphQL WG · 2026-09-17

    The GraphQL specification working group met to review several agenda items. Lee successfully merged the one-off inhabitability feature after making a minor factual correction about field nullability. The group then moved on to discuss the allow empty selection sets feature, which was previously approved to RFC 3 and had undergone final editorial changes including added examples and counterexamples.

    Zoom summary · GraphQL WG · 2026-09-17

    The team discussed two GraphQL specification changes. They agreed to implement the first change, which introduces distinct concepts for selection sets being present versus empty, with the feature enabled by default in the next minor release rather than as a major version change. Benjie presented the second change, which clarifies the definition of response position to account for error propagation, and noted it was part of a stacked pull request.

    Zoom summary · GraphQL WG · 2026-09-17
  • Marked as Ready for Next Stage on by benjie
  • 2 commits pushed on
  • Top comment edited on by benjie
  • Advanced to RFC 3 on by benjie
  • On the agenda for GraphQL WG

    13 listed attendees · 3 agenda items · 5 linked RFCs

July 2026

  • Advanced to RFC 2 on by leebyron
  • Discussed in GraphQL WG

    The GraphQL Working Group held their July meeting to review multiple specification proposals and updates. The group discussed best practices for writing robust applications, with Martin presenting a new documentation page on handling schema changes that received approval for immediate merging. James updated the team on one-of-inhabitability specifications, which moved to Stage 2 pending final review, while Pascal provided an overview of OTel semantic conventions requiring TSC approval before merging. Benjie presented several proposals including sibling errors, empty selection sets, empty object types, interfaces with no fields, and unions with no members, with the group supporting these changes and moving them to RFC 2 status. The team also reviewed the GraphQL over HTTP specification, which was nearly ready for release with only minor editorial changes remaining. The conversation ended with plans to complete spec freeze preparations for the upcoming August meeting and September/October specification cut.

    Zoom summary · GraphQL WG · 2026-07-02

    Benjie: Implement the "empty selection sets" change in GraphQL JS.

    Zoom summary · GraphQL WG · 2026-07-02

    The GraphQL Working Group meeting began with introductions from attendees including Lee, Benjie from Graphile, James from Airbnb, Martin from Apollo, Pascal and Michael from ChilliCream, Matt from Meta, and Mark from Yelp. Lee announced that the group would conduct a spec freeze before next month's meeting, aiming to complete it by August for the September/October cut. The meeting then moved to reviewing the agenda, which included discussing best practices for writing robust applications, including topics about sibling errors, empty selection sets, interfaces, and schema validation requirements.

    Zoom summary · GraphQL WG · 2026-07-02

    Benjie presented updates on two GraphQL specification changes. The first addresses an issue in GraphQL JS where errors arrays might grow after receiving a response, which has been resolved in version 17 by changing the behavior from a "must" to a "should" requirement. The second proposal allows empty selection sets, which will help with client-derived fields and schema design, though it requires implementation in GraphQL JS. Leebyron marked both proposals as RFC 2 pending implementation, and the group discussed that while this makes the grammar more general, it should not break existing documents but might not be compatible with older servers.

    Zoom summary · GraphQL WG · 2026-07-02

May 2026