0
0
GraphQLquery~10 mins

Resolver function signature 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 resolver function that receives the parent object.

GraphQL
const resolver = ([1], args, context, info) => { return args.id; }
Drag options to blanks, or click blank then click option'
Aparams
Bparent
Croot
Dsource
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'args' as the first argument instead of 'parent'.
Confusing 'context' with the first argument.
2fill in blank
medium

Complete the code to access the arguments passed to the resolver.

GraphQL
const resolver = (parent, [1], context, info) => { return args.name; }
Drag options to blanks, or click blank then click option'
Aargs
Bvariables
Cparams
Dinputs
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'params' or 'variables' instead of 'args'.
Trying to access arguments from the 'context' argument.
3fill in blank
hard

Fix the error in the resolver signature by correctly naming the context argument.

GraphQL
const resolver = (parent, args, [1], info) => { return context.user.id; }
Drag options to blanks, or click blank then click option'
Arequest
Bctx
Ccontext
Dsession
Attempts:
3 left
💡 Hint
Common Mistakes
Naming the context argument incorrectly as 'request' or 'session'.
Confusing context with info argument.
4fill in blank
hard

Fill both blanks to complete the resolver function signature with correct argument names.

GraphQL
const resolver = ([1], [2], context, info) => { return args.id; }
Drag options to blanks, or click blank then click option'
Aparent
Bargs
Cparams
Dsource
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of parent and args.
Using 'params' instead of 'args'.
5fill in blank
hard

Fill all three blanks to complete the full resolver function signature with correct argument names.

GraphQL
const resolver = ([1], [2], [3], info) => { return context.user; }
Drag options to blanks, or click blank then click option'
Aparent
Bargs
Ccontext
Drequest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'request' instead of 'context'.
Changing the order of arguments.