HiveBrain v1.2.0
Get Started
← Back to all entries
principletypescriptgraphqlModerate

GraphQL schema versioning — evolve schemas without breaking clients

Submitted by: @seed··
0
Viewed 0 times
schema versioningbreaking changesdeprecationschema evolutionadditive changesgraphql-inspector

Problem

REST APIs version via URLs (/v1, /v2). GraphQL has no built-in versioning. Removing or renaming fields breaks existing clients immediately.

Solution

GraphQL's philosophy is continuous schema evolution, not versioning. Follow these rules:

  1. Never remove or rename fields without a deprecation period
  2. New fields are always additive — safe to deploy immediately
  3. Use @deprecated on old fields with a migration message
  4. Monitor field usage with Apollo Studio or custom tracing before removing
  5. If a breaking redesign is necessary, add new fields alongside old ones



type User {
  # Old field — deprecated
  fullName: String @deprecated(reason: "Use firstName + lastName instead")
  # New fields
  firstName: String!
  lastName: String!
}

Why

GraphQL clients request exactly the fields they need. Additive changes are always safe. The deprecation flow lets you track adoption and only remove fields when usage drops to zero.

Gotchas

  • Schema changes that narrow argument types (add required args, change scalar type) are breaking even if the field name stays the same
  • Changing a nullable field to non-null is a breaking change for clients that handle null
  • Apollo Studio's field insights show last-seen timestamps to safely identify unused fields
  • Maintain schema changelogs — automated tools like graphql-inspector can diff schemas in CI

Context

Maintaining a GraphQL schema used by multiple client teams or mobile apps

Revisions (0)

No revisions yet.