The main points to consider when designing your GraphQL mutations are:
- Naming. Name your mutations verb first. Then the object, or “noun,” if applicable. Use camelCase.
- Specificity. Make mutations as specific as possible. Mutations should represent semantic actions that might be taken by the user whenever possible.
- Input object. Use a single, required, unique, input object type as an argument for easier mutation execution on the client.
- Unique payload type. Use a unique payload type for each mutation and add the mutation’s output as a field to that payload type.
- Nesting. Use nesting to your advantage wherever it makes sense.
#graphql #mutations