RFC 2 / Draft

Allow empty selection sets

Opened on2026-05-23
Updated on2026-07-02

At a glance

Spec PR description

Since 2015 we've requires 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

July 2026
May 2026