Bird
0
0

You want to create a mutation to add a new Order with nested items list. Which mutation pattern correctly handles nested input?

hard📝 Application Q8 of 15
GraphQL - Mutations
You want to create a mutation to add a new Order with nested items list. Which mutation pattern correctly handles nested input?
Amutation AddOrder($order: OrderInput!) { addOrder(input: $order) { id items { id quantity } } }
Bmutation AddOrder($order: OrderInput!) { addOrder(order: $order) { id items { id quantity } } }
Cmutation AddOrder($order: OrderInput!) { addOrder(input: order) { id items { id quantity } } }
Dmutation AddOrder { addOrder(input: $order) { id items { id quantity } } }
Step-by-Step Solution
Solution:
  1. Step 1: Confirm variable declaration and usage

    Variable $order is declared and used as input: $order.
  2. Step 2: Check nested fields in response

    Nested items with id and quantity are requested properly.
  3. Final Answer:

    mutation AddOrder($order: OrderInput!) { addOrder(input: $order) { id items { id quantity } } } -> Option A
  4. Quick Check:

    Correct nested input and response pattern = mutation AddOrder($order: OrderInput!) { addOrder(input: $order) { id items { id quantity } } } [OK]
Quick Trick: Use input variable with $ and request nested fields explicitly [OK]
Common Mistakes:
  • Using wrong argument name
  • Omitting $ in variable usage
  • Not requesting nested fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes