I want to provide a GraphQL service that runs the whole mutation operation in a single transaction (all or nothing changes).
The toplevel fields are processed serially in a single transaction and change the database accordingly. Only when there is no error during execution, the changes should be committed to the database, else they should all be rolled back.
Now I have two questions:
According to the GraphQL specification, serial execution of the toplevel fields means each toplevel field will be filled out with a value that reflects the state after its modification, before it is known if a later field causes an error. Is it intended that this is not the actual value of the field when a later toplevel field causes an error which rolls back the transaction?
If a mutation of a toplevel field fails, it makes no sense to execute the following toplevel fields, as the transaction may be in a state that prevents further processing and all changes will be rolled back anyway. Is it ok, according to the GraphQL semantic, to skip execution of those fields (returning null and maybe an entry to the errors list)?