Bird
0
0

Identify the error in this mutation:

medium📝 Debug Q14 of 15
GraphQL - Mutations
Identify the error in this mutation:
mutation CreatePost($post: PostInput!) {
  createPost(post: $post) {
    id
    content
  }
}

Assuming the server expects the input argument to be named input, not post.
AThe mutation keyword should be <code>query</code>
BThe variable <code>$post</code> should be <code>$input</code>
CThe argument name <code>post</code> should be <code>input</code>
DThe return fields <code>id</code> and <code>content</code> are invalid
Step-by-Step Solution
Solution:
  1. Step 1: Check argument name in mutation call

    The mutation calls createPost(post: $post), but server expects input argument.
  2. Step 2: Correct argument name

    Changing post to input matches server expectation and fixes error.
  3. Final Answer:

    The argument name post should be input -> Option C
  4. Quick Check:

    Argument names must match server schema [OK]
Quick Trick: Match argument names exactly as server expects [OK]
Common Mistakes:
  • Using wrong argument name in mutation call
  • Confusing variable name with argument name
  • Changing mutation keyword incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes