Bird
0
0

Identify the error in this GraphQL type definition:

medium📝 Debug Q6 of 15
GraphQL - Schema Definition Language (SDL)
Identify the error in this GraphQL type definition:
type Book {
  title: String!
  pages: Int!
  author: String!
  published: Boolean
  summary: String!
}

Which field declaration is invalid if summary can be null?
Asummary: String!
Bpublished: Boolean
Cauthor: String!
Dpages: Int!
Step-by-Step Solution
Solution:
  1. Step 1: Understand ! means non-null

    Field summary is declared as String!, so it cannot be null.
  2. Step 2: Check if summary can be null

    The question states summary can be null, so this conflicts with the declaration.
  3. Final Answer:

    summary: String! -> Option A
  4. Quick Check:

    Non-null conflict = A [OK]
Quick Trick: Declare nullable fields without ! [OK]
Common Mistakes:
  • Marking nullable fields as non-null
  • Ignoring field nullability requirements
  • Confusing optional and required fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes