0
0
GraphQLquery~10 mins

Schema evolution strategies in GraphQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a new optional field to a GraphQL type without breaking existing queries.

GraphQL
type User { id: ID! name: String! [1] }
Drag options to blanks, or click blank then click option'
Aage: Int!
Dage: Int
Attempts:
3 left
💡 Hint
Common Mistakes
Adding a required field (!) breaks existing queries.
Forgetting to add the new field to the type.
2fill in blank
medium

Complete the code to deprecate a field in a GraphQL schema.

GraphQL
type User { id: ID! name: String! oldField: String [1] }
Drag options to blanks, or click blank then click option'
A@deprecated(reason: "")
B@deprecated
C@deprecated(reason: "Use newField instead")
D@deprecated(reason: 123)
Attempts:
3 left
💡 Hint
Common Mistakes
Using @deprecated without a reason.
Providing a non-string reason.
3fill in blank
hard

Fix the error in the schema evolution by correctly renaming a field using a deprecation strategy.

GraphQL
type User { id: ID! name: String! [1]: String @deprecated(reason: "Use fullName instead") fullName: String! }
Drag options to blanks, or click blank then click option'
AoldName
BfullName
Cfullname
DnameOld
Attempts:
3 left
💡 Hint
Common Mistakes
Deprecating the new field instead of the old one.
Renaming the field without deprecation.
4fill in blank
hard

Fill both blanks to add a new enum value safely and deprecate an old one.

GraphQL
enum Status { ACTIVE [1] INACTIVE [2] }
Drag options to blanks, or click blank then click option'
APENDING
BDEPRECATED
C@deprecated(reason: "Use PENDING instead")
DNEW
Attempts:
3 left
💡 Hint
Common Mistakes
Removing old enum values directly.
Not marking deprecated enum values.
5fill in blank
hard

Fill all three blanks to safely evolve a GraphQL input type by adding a new optional field and deprecating an old one.

GraphQL
input UserInput { username: String! [1]: String [2] [3] }
Drag options to blanks, or click blank then click option'
Aemail
B@deprecated(reason: "Use contactEmail instead")
CcontactEmail: String
D!
Attempts:
3 left
💡 Hint
Common Mistakes
Making new fields required.
Removing old fields without deprecation.