Bird
0
0

Find the error in this mutation:

medium📝 Debug Q6 of 15
GraphQL - Mutations
Find the error in this mutation:
mutation UpdateProfile($profile: ProfileInput!) {
  updateProfile(profile: $profile) {
    id
    name
  }
}
AThe variable declaration is missing a colon between $profile and ProfileInput!
BThe input argument should be named 'input' instead of 'profile'
CThe mutation name should be lowercase
DThe selection set cannot include 'id' and 'name'
Step-by-Step Solution
Solution:
  1. Step 1: Review variable declaration

    The variable declaration $profile: ProfileInput! is correct with colon and type.
  2. Step 2: Check mutation name casing

    Mutation names can be PascalCase or camelCase; casing is not an error.
  3. Step 3: Validate input argument name

    The argument name 'profile' does not match the expected 'input' argument name in the mutation schema, causing an error.
  4. Step 4: Analyze selection set fields

    The selection set fields 'id' and 'name' are valid if they exist on the return type.
  5. Final Answer:

    The input argument should be named 'input' instead of 'profile' -> Option B
  6. Quick Check:

    Input argument names must match schema expectations. [OK]
Quick Trick: Input argument names must match schema argument names [OK]
Common Mistakes:
  • Assuming any argument name is valid
  • Confusing variable declaration syntax
  • Thinking mutation names must be lowercase

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes