Bird
0
0

You wrote this GraphQL schema:

medium📝 Debug Q6 of 15
GraphQL - Type Relationships
You wrote this GraphQL schema:
type Author { books: Book } type Book { author: Author }

Why does this schema cause an error when querying books of an author?
ABecause ID fields are missing
BBecause author field is missing an exclamation mark
CBecause Book type is not defined
DBecause books field is not a list but should be for multiple books
Step-by-Step Solution
Solution:
  1. Step 1: Check books field type

    Books is defined as a single Book, but an author can have many books.
  2. Step 2: Identify correct type

    Books should be a list ([Book]) to represent multiple books.
  3. Final Answer:

    Because books field is not a list but should be for multiple books -> Option D
  4. Quick Check:

    List needed for multiple related items [OK]
Quick Trick: Use lists for multiple related items [OK]
Common Mistakes:
  • Using single object instead of list
  • Ignoring non-null requirements
  • Assuming missing ID causes this error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes