0
0
GraphQLquery~10 mins

Required fields with non-null (!) 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 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'
A!
B?
D$
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.
2fill in blank
medium

Complete 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'
B!
C?
D$
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the field optional by not adding !.
Using invalid symbols like ? or $.
3fill in blank
hard

Fix 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'
B!
C?
D#
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the field optional by missing !.
Using invalid symbols like ? or #.
4fill in blank
hard

Fill 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'
A!
B?
D$
Attempts:
3 left
💡 Hint
Common Mistakes
Using different symbols for each field.
Leaving one or both fields optional by missing !.
5fill in blank
hard

Fill 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'
A!
B?
D#
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing symbols or leaving some fields optional.
Using invalid symbols like ? or #.