graphql-spqr icon indicating copy to clipboard operation
graphql-spqr copied to clipboard

Make clientMutationId optional

Open pep1 opened this issue 4 years ago • 2 comments

Created this PR to make the clientMutationId nullable during schema generation.

We have the requirement of Relay compliant mutations, however without the mutation ids in the current project I am working on, so I tried to find out whether they are actually specified as mandatory.

The GraphQL Relay Server specification is somewhat unclear when it comes to clientMutationId and whether it's a required field or not.

In the Relay Classic guides here there is a description:

That input argument should contain a (string) "clientMutationId" property for the purposes of reconciling requests and responses (automatically added by the Relay.GraphQLMutation API). The query should request "clientMutationId" as a subselection.

So that indicates that they are optional.

I found another PR doing something similar in another GraphQL library providing Relay capabilities here: https://github.com/api-platform/core/issues/2570, so looks like people are moving away from mandatory mutation ids.

btw, thanks heaps for the great work :+1:

pep1 avatar Jul 02 '20 11:07 pep1

The clientMutationId field is not part of the Relay Modern specs. The Relay Classic specs are unclear but look like it is optional. An option to not generate the clientMutationId field in the first place would be nice.

lilianchiassai avatar Sep 30 '20 03:09 lilianchiassai

@kaqqao Bumping this. Could you take a look?

Thanks!

LoRoger avatar May 17 '21 08:05 LoRoger

@pep1 Hey. I'm only now picking this project up again... I understand that you likely no longer care as it's been years. But I'll merge this.

kaqqao avatar Dec 03 '22 23:12 kaqqao