Bird
0
0

You want to add a new enum value SUPER_ADMIN to an existing enum Role used in many queries. What is the best practice to avoid breaking existing clients?

hard📝 Application Q8 of 15
GraphQL - Schema Definition Language (SDL)
You want to add a new enum value SUPER_ADMIN to an existing enum Role used in many queries. What is the best practice to avoid breaking existing clients?
AAdd SUPER_ADMIN at the end of the enum values list
BReplace an existing value with SUPER_ADMIN
CRemove an existing value and add SUPER_ADMIN
DChange all clients to accept the new enum before updating schema
Step-by-Step Solution
Solution:
  1. Step 1: Understand enum backward compatibility

    Adding new enum values at the end is safe and does not break existing clients.
  2. Step 2: Avoid removing or replacing values

    Removing or replacing values breaks clients expecting old values.
  3. Final Answer:

    Add SUPER_ADMIN at the end of the enum values list -> Option A
  4. Quick Check:

    Adding enum values preserves backward compatibility [OK]
Quick Trick: Add new enum values at the end to keep compatibility [OK]
Common Mistakes:
  • Replacing or removing existing enum values
  • Forcing clients to update first
  • Changing enum order arbitrarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes