0
0
GraphQLquery~10 mins

Node interface pattern 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 define a Node interface with an ID field.

GraphQL
interface Node { id: [1]! }
Drag options to blanks, or click blank then click option'
AString
BInt
CID
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of ID for the id field.
Omitting the non-nullable exclamation mark (!).
2fill in blank
medium

Complete the code to make the User type implement the Node interface.

GraphQL
type User implements [1] { id: ID! name: String! }
Drag options to blanks, or click blank then click option'
AEntity
BObject
CInterface
DNode
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong interface name like Entity or Interface.
Forgetting to implement the Node interface.
3fill in blank
hard

Fix the error in the Node interface definition by completing the type of the id field.

GraphQL
interface Node { id: [1] }
Drag options to blanks, or click blank then click option'
AID!
BInt
CString
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using nullable types like String or Int for id.
Omitting the exclamation mark to make id non-nullable.
4fill in blank
hard

Fill both blanks to define a Query type with a node field that returns a Node by id.

GraphQL
type Query { node(id: [1]!): [2] }
Drag options to blanks, or click blank then click option'
AID
BString
CNode
DUser
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of ID for the id argument.
Returning a concrete type like User instead of the Node interface.
5fill in blank
hard

Fill all three blanks to define a schema with Node interface, User type implementing Node, and Query type with node field.

GraphQL
interface [1] { id: ID! } type [2] implements Node { id: ID! name: String! } type [3] { node(id: ID!): Node }
Drag options to blanks, or click blank then click option'
ANode
BUser
CQuery
DMutation
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up type names like Mutation instead of Query.
Not implementing Node interface in User type.