Bird
0
0

Identify the error in this GraphQL query snippet:

medium📝 Debug Q6 of 15
GraphQL - Queries
Identify the error in this GraphQL query snippet:
{
  search {
    ... onBook {
      title
    }
  }
}
AIncorrect use of braces around fields
BMissing space between 'on' and type name
CMissing ellipsis before 'onBook'
DUsing parentheses instead of braces for fields
Step-by-Step Solution
Solution:
  1. Step 1: Check inline fragment syntax

    Inline fragments require '... on TypeName' with a space between 'on' and the type.
  2. Step 2: Identify the error

    The snippet uses '... onBook' without space, which is invalid syntax.
  3. Final Answer:

    Missing space between 'on' and type name -> Option B
  4. Quick Check:

    Inline fragment syntax needs space after 'on' [OK]
Quick Trick: Always put a space after 'on' in inline fragments [OK]
Common Mistakes:
  • Writing '... onType' without space
  • Omitting ellipsis '...'
  • Using parentheses instead of braces

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes