Complete the code to add a new optional field to a GraphQL type without breaking existing queries.
type User { id: ID! name: String! [1] }Adding a new optional field (without the exclamation mark) allows existing queries to work without requiring the new field.
Complete the code to deprecate a field in a GraphQL schema.
type User { id: ID! name: String! oldField: String [1] }The @deprecated directive with a reason string marks a field as deprecated and informs clients what to use instead.
Fix the error in the schema evolution by correctly renaming a field using a deprecation strategy.
type User { id: ID! name: String! [1]: String @deprecated(reason: "Use fullName instead") fullName: String! }The old field name should be kept and marked deprecated, while the new field is added with the new name.
Fill both blanks to add a new enum value safely and deprecate an old one.
enum Status { ACTIVE [1] INACTIVE [2] }Adding a new enum value 'PENDING' is safe. Deprecating 'INACTIVE' with a reason informs clients to use PENDING instead.
Fill all three blanks to safely evolve a GraphQL input type by adding a new optional field and deprecating an old one.
input UserInput { username: String! [1]: String [2] [3] }Adding 'email' as an optional field, marking it deprecated, and adding 'contactEmail' as the new field is a safe evolution.