At a glance
- Identifier: #1227
- Stage: RFC 2 / Draft
- Champion: @benjie
- Latest activity: Advanced to RFC 2 on 2026-07-02
- Spec PR: https://github.com/graphql/graphql-spec/pull/1227
- Related:
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
- Advanced to RFC 2 on 2026-07-02 by leebyron
- Added to WG agenda on 2026-07-02
May 2026
- Top comment edited on 2026-05-23 by benjie
- Spec PR created on 2026-05-23 by benjie
- @benjie committed "Allow empty selection sets" on 2026-05-23
- Advanced to RFC 0 on 2026-05-23 by benjie