RFC 1 / Proposal

Expand @deprecated to Objects

Opened on
Updated on

At a glance

Project
GraphQL Spec
Identifier
#997
Stage
RFC 1 / Proposal
Champion
@fotoetienne
Updated
2026-07-29
Latest activity
Added to WG agenda on
Source

Pull request description

Problem

Take as a motivating example:

type Query {
  animals: [Animal]
}

interface Animal {
  name: String
}

type Dog implements Animal {
  name: String
}

type Baiji implements Animal {
  name: String
}

The Baiji type corresponds to an Animal that is no longer known to exist, and the server will no longer return this type. We would like to delete the code for this type and eventually remove from the schema, but first clients must remove all references of this type from their queries. Currently, there is no good way to indicate to clients that they should no longer spread on this type in their queries.

Solution

Allow @deprecated on objects. Marking as deprecated indicates to clients that this type will no longer be returned from the server. This can indicate to client build tooling that references to this object should be removed from client queries.

type Baiji implements Animal @deprecated {
  name: String
}

Alternative Solutions

The most compelling use-case for deprecating types is when they are union members or interface implementations. A potential alternative would be to instead deprecate the membership/implementation instead of the type itself. The main challenge with this approach is with syntax, since it unclear how one would unambiguously annotate an interface implementation using the current @deprecated directive. Some possible alternatives:

New directive location - @deprecated on UNION_MEMBER

union Animal = Dog | Cat | Baiji @deprecated

New directive @deprecatedMembers on UNION

union Animal @deprecatedMembers(members: ["Baiji"]) = Dog | Cat | Baiji

New directive @deprecatedImplementations on OBJECT

type Baiji implements Node & Animal @deprecatedImplementations(implementations: ["Animal"]) {
  id: ID!
  name: String
}

New directive @deprecatedImplementations on INTERFACE

interface Animal @deprecatedImplementations(implementations: ["Baiji"]) {
  id: ID!
  name: String
}

Timeline

June 2025

  • Discussed in GraphQL WG
    Next Steps

    Stephen: Continue implementation work on object deprecation RFC and re-engage previous contributors for feedback

    Zoom summary · GraphQL WG · 2025-06-26
    GraphQL Schema Deprecation Discussion

    Stephen plans to make changes to the GraphQL.js feedback revision and submit it. The group discusses the RFC for deprecation of objects in GraphQL schemas. They agree that everything in a schema should be deprecatable, and that removing deprecated elements should still result in a valid schema. Lee suggests adding an "includeDeprecated" parameter to the __schema field in introspection queries, which would allow clients to view either the full schema or a subset without deprecated elements. The group also discusses the implications of deprecating object types in unions and interfaces, acknowledging the need for a way to maintain these over time.

    Zoom summary · GraphQL WG · 2025-06-26

November 2024

  • On the agenda for GraphQL WG

    12 listed attendees · 7 agenda items · 4 linked RFCs

    • Make reason non-nullable in @deprecated (@martinbonnin, 5 min) #1040
    • Discuss enhancing deprecation (@gwardwell, 15 min) #997
    • Incremental Delivery update (@robrichard, 15 min) #1110
    • Nullability WG Update (@twof, 10 min)
    • Directive Meta-Field Proposal (@yaacovCR, 5 min) #1114
    • Subscriptions and Source Event Stream Errors (@yaacovCR, 15m)
    • Interface field argument default values (@yaacovCR, 15m)

June 2023

  • 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

November 2022

  • Advanced to RFC 1 on by leebyron
  • On the agenda for GraphQL WG

    13 listed attendees · 10 agenda items · 2 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 previous meeting's action items (5m, Lee)
    • Check in on new meeting cadence
    • GraphQL Community Grant
    • Status of express-graphql project (5m, Benjie)
    • @deprecated on OBJECT (15m, Stephen) #997
    • @defer/@stream discussion (20m, Rob) #742

October 2022