Evolving a schema without versions
Change a schema without a v2: add fields freely, deprecate before removing, tell breaking changes from safe ones, and check usage first.
Schema design principlesNaming conventionsNullability in practice
Evolving a schema without versions
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- Clients name every field they use, so adding types, fields and optional arguments never breaks them; this is why GraphQL APIs can evolve in place without version numbers.
- Breaking changes are removing or renaming a field, type or enum value, making an output nullable, making an input required, and changing a field's type.
- To retire a field, add the replacement, mark the old one `@deprecated(reason: ...)`, watch usage fall, then remove it.
- Introspection hides deprecated fields by default and returns them only with `includeDeprecated: true`, so tools stop suggesting them while old clients keep working.
- Deprecation is only safe to finish if you know who still calls the field, so record field usage per operation and client before deleting.
The problem: the API you cannot take back
A web app deploys when you say so. A mobile app is in users’ pockets for years, and a release from last spring still calls your API. A field you delete this week breaks every install that has not updated.
REST APIs often respond with a version in the URL, /v1, /v2, and run both. GraphQL reduces the need: the client selects fields by name, so a response never contains anything the client did not ask for. The schema can grow forever without disturbing old operations. The discipline is in the changes that do disturb them. See API versioning strategies for the REST view.
Safe and breaking changes
Safe, additive:
- A new type, field, enum value (see below), or interface implementation.
- A new optional argument, or an input field that is optional or has a default.
- A new query or mutation field.
Breaking:
- Removing or renaming a field, argument, type or enum value.
- Changing a field’s type.
- Output
T!toT(nullable): clients assumed a value. The reverse is safe. - Input optional to required: old callers that omit it fail.
- Adding a required argument or required input field.
The last items follow from nullability in practice: the promise runs one way for outputs and the other for inputs.
A subtle one: adding an enum value is safe for clients that ignore unknown values and breaking for clients whose exhaustive switch has no default case. Tell clients up front whether they must tolerate new values.
The deprecation lifecycle
You never rename. You add, deprecate, measure and remove. Suppose Author.fullName should become name:
type Author implements Node {
id: ID!
name: String!
fullName: String @deprecated(reason: "Use name.")
}
Both fields return the same value; the old one is flagged. Old clients keep working. New code gets a strike-through in GraphiQL, and a lint rule in your client tooling can warn.
I checked what introspection says, on graphql-js 17.1.0 through Yoga 6.1.0:
fields(includeDeprecated: true)
id isDeprecated: false
name isDeprecated: false
fullName isDeprecated: true deprecationReason: "Use name."
fields (default)
id, name <- deprecated field hidden
Tools stop suggesting the deprecated field, but nothing stops an old client from querying it.
The reason should say what to use instead, not just that the field is old. @deprecated also works on arguments and input fields in current graphql-js; check your server and client versions before relying on that.
Measure before you delete
Deprecation announces; it does not tell you whether anyone listened. Before deleting, you need data: which operations select Author.fullName, and from which client versions.
You can start with a small tracker that walks each incoming document with the schema’s type information and counts deprecated fields. This is the one I ran:
import { visit, visitWithTypeInfo, TypeInfo, parse } from 'graphql';
const usage = new Map();
const typeInfo = new TypeInfo(schema);
function track(query) {
visit(parse(query), visitWithTypeInfo(typeInfo, {
Field() {
const field = typeInfo.getFieldDef();
if (field?.deprecationReason) {
const key = `${typeInfo.getParentType().name}.${field.name}`;
usage.set(key, (usage.get(key) ?? 0) + 1);
}
},
}));
}
Feeding it { node(id: "x") { ... on Author { fullName name } } } and then a query using only name gave [["Author.fullName", 1]]. In production you would record this per operation name and client version, in logs or metrics, ideally from a Yoga plugin so it sees every request. Dedicated tools, such as a schema registry with usage reporting, do this at scale; they are covered in schema registry and CI checks. Then the rule is simple: delete when the count has been zero for long enough to cover your slowest-updating client.
Experimenting without lock-in
Because the rule is “never remove”, every field you ship is one you may carry for years. Two habits keep that cheap:
- Ship small. Add the field you need now, not three speculative ones.
- Mark experiments. A naming convention or description such as “Experimental, may change” tells clients what they are signing up for; some teams use a custom directive for it. The Netflix talk below describes a lifecycle that starts at experimentation.
When to cut a new version anyway: if the core model changes so much that no additive path exists. That is rare. Teams usually run the old and new fields side by side and move clients over; a second schema is a last resort.
What the video covers
Stephen Spalding of Netflix gave “Death, Taxes, and Deprecation” at GraphQL TV, published October 2025, 30 minutes. Its description says it covers the schema lifecycle from experimentation to design, deprecation and deletion, asks what happens after fields are marked @deprecated, how to experiment without entombing technical debt, and whether federation complicates things. It is drawn from the Netflix API, which is large and federated, so some practices will be heavier than a small team needs. I could not read a transcript, so the lesson’s mechanics and the tracker above are my own. Federation itself is covered in Apollo Federation basics.
Where this fits
This ends the schema design group: principles, names, nullability, pagination, connections, global IDs and change. Next the roadmap turns to the other end of the wire, the client code that calls all this. Next: calling GraphQL with fetch.
Check yourself
Why can a GraphQL schema grow without a v2 when a REST API often cannot?
A REST response has a fixed shape, so adding a field changes what every caller gets. A GraphQL client receives only the fields it selected, so new fields are invisible to existing operations.
You rename `fullName` to `name`. What is the non-breaking way to do it?
Add `name`, keep `fullName` returning the same value and mark it `@deprecated(reason: "Use name.")`. Remove `fullName` only after no client selects it.
Which three changes break clients?
Removing or renaming a field, making an output field nullable, and making an optional input field or argument required. Changing a type or removing an enum value also breaks.
How do you know a deprecated field is safe to delete?
By measuring: log which operations select the field, from which clients, and wait until the count is zero. A schema alone cannot tell you.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.