graphql-spqr
graphql-spqr copied to clipboard
Make clientMutationId optional
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:
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.
@kaqqao Bumping this. Could you take a look?
Thanks!
@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.