Bird
0
0

Identify the error in this mutation:

medium📝 Debug Q6 of 15
GraphQL - Mutations
Identify the error in this mutation:
mutation { updateProfile(id: "abc", input: {email: "user@example.com"}) { id email } }
AThe id should be an integer, not a string
BThe mutation name is incorrect
CThere is no error; the mutation is valid
DThe input object is missing required fields
Step-by-Step Solution
Solution:
  1. Step 1: Check the mutation syntax

    The mutation uses updateProfile with an id as a string and an input object.
  2. Step 2: Validate the id type

    GraphQL IDs are often strings, so passing "abc" as id is valid.
  3. Step 3: Confirm input object

    The input contains email, which is a valid field to update.
  4. Final Answer:

    No error -> Option C
  5. Quick Check:

    String IDs are valid in GraphQL [OK]
Quick Trick: IDs can be strings; check schema for required fields [OK]
Common Mistakes:
  • Assuming IDs must be integers
  • Confusing mutation name with query name
  • Expecting all input fields to be mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes