Guide clients to a replacement
A field has a replacement with a different name or shape.
GraphQL · Directive
@deprecated marks a GraphQL field or enum value as obsolete while keeping it available to clients. Its optional reason tells users what to use instead.
Place @deprecated on a schema field or enum value to signal that clients should migrate away from it. Its optional reason describes the replacement or rationale; if omitted, the default reason is "No longer supported".
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE| Name | Type | Description |
|---|---|---|
reason | String | Optional explanation of the deprecation and recommended migration; defaults to "No longer supported". |
type User {
fullName: String
name: String @deprecated(reason: "Use `fullName`.")
}The schema keeps name available while directing clients toward fullName.
A field has a replacement with a different name or shape.
An enum member should remain readable for existing clients during migration.
A schema change must be introduced without immediately breaking existing queries.
@deprecated marks a field or enum value as deprecated without immediately removing it. In SDL implementations, its reason argument defaults to "No longer supported".
Follow-up: Where can it be applied? The documented locations are FIELD_DEFINITION and ENUM_VALUE.
Its declaration accepts an optional String reason and limits use to schema field definitions and enum values. The reason can explain what clients should use instead.
Follow-up: What happens when reason is omitted? The directive supplies the default text "No longer supported".
A deprecated field remains part of the schema, but tools can use the deprecation metadata to guide clients toward a replacement. This supports evolving a schema without an immediate breaking removal.
Follow-up: How should a replacement be represented? Add the new field, then mark the old field with a reason naming the replacement.
directivesFIELD_DEFINITIONENUM_VALUEGraphiQLschema evolution