Challenge: Pizza Mutation

Take this challenge to test your knowledge of GraphQL mutation.

We'll cover the following

Problem statement

  • Write a GraphQL mutation to update a pizza.

  • The mutation must have an operation named UpdatePizza.

  • The mutation must have id, pizza, and toppings from updatePizza. Don’t forget to include id and topping for toppings.

  • The mutation must have id, pizza, and toppings as arguments.

  • The mutation must have id as a required variable, and pizza and toppings as optional variables.

Expected output

The query should have an output like the JSON below.

{
  "data": {
    "updatePizza": {
      "id": 1,
      "pizza": "my new pizza",
      "toppings": [
        {
          "id": 1,
          "topping": "Cheesy"
        }
      ]
    }
  }
}

Get hands-on with 1200+ tech skills courses.