Skip to content

GraphQL Mutation design guidelines regarding layout and return values #991

Answered by benjie
SquireOfSoftware asked this question in Q&A
Discussion options

You must be logged in to vote

Why do people go with flat mutations?

In the GraphQL spec, only selections over the Mutation type (assuming you're using the default operation type names) is executed in serial; all other selection sets are executed in parallel. It's unsafe to run mutations in parallel - very likely to lead to race conditions and the like - so mutations should be done only in the root selection set of a mutation operation, at least for now.

Should the createBall mutation have a type of BallPayload or just a Ball?

You can do either, the reason that we tend to use BallPayload rather than Ball is that it allows for expanding the schema later (this can also apply to why connections are often used over lis…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@SquireOfSoftware
Comment options

Answer selected by SquireOfSoftware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants