0
0
GraphQLquery~10 mins

Input type for complex arguments 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 an input type for a user with name and age fields.

GraphQL
input UserInput { name: String[1] }
Drag options to blanks, or click blank then click option'
A?
B!
C$
D#
Attempts:
3 left
💡 Hint
Common Mistakes
Using ? which is not valid in GraphQL type definitions.
Omitting the exclamation mark when the field should be required.
2fill in blank
medium

Complete the code to add an age field of type Int to the input type.

GraphQL
input UserInput { age: [1] }
Drag options to blanks, or click blank then click option'
AInt
BFloat
CString
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using Float which allows decimals.
Using String which is for text.
3fill in blank
hard

Fix the error in the mutation argument by completing the input type usage.

GraphQL
type Mutation { createUser(input: [1]): User }
Drag options to blanks, or click blank then click option'
AUser
BUserType
CUserInput
DInputUser
Attempts:
3 left
💡 Hint
Common Mistakes
Using the output type User instead of the input type.
Using incorrect input type names.
4fill in blank
hard

Complete the code to define an input type with a required name and optional email.

GraphQL
input ContactInput { name: String[1], email: String }
Drag options to blanks, or click blank then click option'
A!
B?
Attempts:
3 left
💡 Hint
Common Mistakes
Marking optional fields as required.
Using ? which is invalid in GraphQL.
5fill in blank
hard

Fill all three blanks to define a mutation that takes a required input and returns a User type.

GraphQL
type Mutation { addUser(input: [1][2]): [3] }
Drag options to blanks, or click blank then click option'
AUserInput
B!
CUser
DInputUser
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the exclamation mark for required input.
Using the input type as return type.