Skip to content

Commit 8c7d0d2

Browse files
authored
Merge pull request #79 from dylanahsmith/optional-client-mutation-id
Remove non-null restriction on clientMutationId field definitions.
2 parents 6e6f16b + f2aee93 commit 8c7d0d2

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

src/__tests__/starWarsSchema.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ import {
101101
* }
102102
*
103103
* input IntroduceShipInput {
104-
* clientMutationId: string!
104+
* clientMutationId: string
105105
* shipName: string!
106106
* factionId: ID!
107107
* }
108108
*
109-
* input IntroduceShipPayload {
110-
* clientMutationId: string!
109+
* type IntroduceShipPayload {
110+
* clientMutationId: string
111111
* ship: Ship
112112
* faction: Faction
113113
* }
@@ -244,13 +244,13 @@ var queryType = new GraphQLObjectType({
244244
*
245245
* It creates these two types implicitly:
246246
* input IntroduceShipInput {
247-
* clientMutationId: string!
247+
* clientMutationId: string
248248
* shipName: string!
249249
* factionId: ID!
250250
* }
251251
*
252-
* input IntroduceShipPayload {
253-
* clientMutationId: string!
252+
* type IntroduceShipPayload {
253+
* clientMutationId: string
254254
* ship: Ship
255255
* faction: Faction
256256
* }

src/mutation/__tests__/mutation.js

+4-21
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,6 @@ describe('mutationWithClientMutationId()', () => {
188188
type {
189189
name
190190
kind
191-
ofType {
192-
name
193-
kind
194-
}
195191
}
196192
}
197193
}
@@ -204,12 +200,8 @@ describe('mutationWithClientMutationId()', () => {
204200
{
205201
name: 'clientMutationId',
206202
type: {
207-
name: null,
208-
kind: 'NON_NULL',
209-
ofType: {
210-
name: 'String',
211-
kind: 'SCALAR'
212-
}
203+
name: 'String',
204+
kind: 'SCALAR'
213205
}
214206
}
215207
]
@@ -229,10 +221,6 @@ describe('mutationWithClientMutationId()', () => {
229221
type {
230222
name
231223
kind
232-
ofType {
233-
name
234-
kind
235-
}
236224
}
237225
}
238226
}
@@ -247,18 +235,13 @@ describe('mutationWithClientMutationId()', () => {
247235
type: {
248236
name: 'Int',
249237
kind: 'SCALAR',
250-
ofType: null
251238
}
252239
},
253240
{
254241
name: 'clientMutationId',
255242
type: {
256-
name: null,
257-
kind: 'NON_NULL',
258-
ofType: {
259-
name: 'String',
260-
kind: 'SCALAR'
261-
}
243+
name: 'String',
244+
kind: 'SCALAR'
262245
}
263246
}
264247
]

src/mutation/mutation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ export function mutationWithClientMutationId(
6262
var augmentedInputFields = () => ({
6363
...resolveMaybeThunk(inputFields),
6464
clientMutationId: {
65-
type: new GraphQLNonNull(GraphQLString)
65+
type: GraphQLString
6666
}
6767
});
6868
var augmentedOutputFields = () => ({
6969
...resolveMaybeThunk(outputFields),
7070
clientMutationId: {
71-
type: new GraphQLNonNull(GraphQLString)
71+
type: GraphQLString
7272
}
7373
});
7474

0 commit comments

Comments
 (0)