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
, andtoppings
fromupdatePizza
. Don’t forget to includeid
andtopping
fortoppings
. -
The mutation must have
id
,pizza
, andtoppings
as arguments. -
The mutation must have
id
as a required variable, andpizza
andtoppings
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.