Core: [GraphQL] `clientMutationId` should not be required

Created on 1 Mar 2019  路  7Comments  路  Source: api-platform/core

Right now the generated GraphQL schema requires a clientMutationId for every mutation. This is based on the original Relay (Classic) specification, but depending on your client (Relay Modern, Apollo, ..) might not be required, or even useless (and therefore leads to clutter in client code).

I propose adding a configuration option that allows to specify, wether you want this to be generated at all, and wether it should be required.

GraphQL bug

All 7 comments

Have you an example of it causing an issue in a tool?

As a reference, the current Relay specification contains the following:

In particular, all mutations must expose exactly one argument, named input. This argument鈥檚 type must be a NON_NULL wrapper around an INPUT_OBJECT. That input object type may contain an argument named clientMutationId. If provided, that argument must be a String. That argument may be non鈥恘ull.

Maybe it should just be nullable then?

@alanpoulain It doesn't cause any issues with tools per se, it gets handled just like any other argument.

The issue is that it might not provide any value, yet you are required to provide that argument in every mutation you write.

I think we can consider it a bug and make a PR for 2.4. Do you want to do it?

I'll make the PR 馃憤

Fixed in 2.4.

Was this page helpful?
0 / 5 - 0 ratings