Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to make the name field required in this GraphQL type.
GraphQL
type User {
id: ID!
name: String[1]
age: Int
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a question mark
? which is not valid in GraphQL.Leaving the field without any symbol, making it optional.
✗ Incorrect
In GraphQL, adding an exclamation mark
! after a type makes the field required (non-null).2fill in blank
mediumComplete the code to make the email field required and of type Email.
GraphQL
type User {
id: ID!
email: Email[1]
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the field optional by not adding
!.Using invalid symbols like
? or $.✗ Incorrect
Adding
! after the type makes the email field required (non-null).3fill in blank
hardFix the error in this GraphQL input type by making the password field required.
GraphQL
input LoginInput {
username: String!
password: String[1]
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the field optional by missing
!.Using invalid symbols like
? or #.✗ Incorrect
The
password field needs an exclamation mark ! to be required (non-null).4fill in blank
hardFill both blanks to make title and content fields required in this GraphQL type.
GraphQL
type Post {
id: ID!
title: String[1]
content: String[2]
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different symbols for each field.
Leaving one or both fields optional by missing
!.✗ Incorrect
Adding
! after the type makes both title and content required fields.5fill in blank
hardFill all three blanks to make username, email, and age required fields in this GraphQL input type.
GraphQL
input RegisterInput {
username: String[1]
email: String[2]
age: Int[3]
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing symbols or leaving some fields optional.
Using invalid symbols like
? or #.✗ Incorrect
All three fields need
! to be required (non-null) in GraphQL input types.