Defining a Root Mutation Type
To support mutation operations, we need to define a root mutation type, just as we did for queries. This will be used as the entry point for GraphQL mutation operations, and it will defineâbased on the mutation fields that we addâthe complete list of capabilities users of our API will have available to modify data.
We define the root mutation type by using the mutation macro in our schema:
â | mutation âdoâ |
â | â# Mutation fields will go hereâ |
â | âendâ |
This might strike you as somewhat similar to our use of the query macro when we did the initial build-out of the PlateSlate Absinthe schema, and thatâs by design. Both macrosâquery and
Get Craft GraphQL APIs in Elixir with Absinthe now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.