Fork me on GitHub
#graphql
<
2017-06-08
>
wotbrew12:06:54

Hi, I am wondering if there is any order-of-execution guarantees for the fields inside of a mutation? e.g does the spec propose they execute in the order they are listed in the graphql string? e.g

mutation {
   foo {
     bar
     baz
   }
 }
-- The order of execution of bar and baz is what I am interested in.

wotbrew12:06:30

I am aware that root mutation field resolvers must be executed in order, but I am not so sure about the child field resolvers

wotbrew12:06:14

The reason for this is to express a kind of transactional context in which one can describe a variety of different operation (each a field like bar or baz) so that they can be committed all at once

wotbrew12:06:04

seems to suggest its not supported. I'll think of another way

hlship15:06:02

The spec is very clear on this: the top level operations run sequentially, but nested fields run with the same semantics as an ordinary query. In addition, in Lacinia, the top-level field resolver exits entirely before nested resolvers are invoked, so you won't be able to implement transaction semantics anyway. It could be done in the Pedestal pipeline instead.