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 Car {
  model: String!
  year: Int!
  color: !String
}
AThere is no error in this definition
BThe <code>year</code> field cannot be an Int
CThe <code>model</code> field should not be required
DThe exclamation mark is incorrectly placed before the type in <code>color</code>
Step-by-Step Solution
Solution:
  1. Step 1: Check exclamation mark placement

    In GraphQL, ! must come after the type, not before.
  2. Step 2: Identify the incorrect field

    color: !String is invalid syntax; correct is color: String!.
  3. Final Answer:

    The exclamation mark is incorrectly placed before the type in color -> Option D
  4. Quick Check:

    Exclamation must follow type, not precede it = A [OK]
Quick Trick: Exclamation mark always follows the type, never before [OK]
Common Mistakes:
  • Placing ! before type
  • Assuming Int cannot be required
  • Thinking required fields are optional

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes