@@ -209,6 +209,8 @@ Guiding Principles. The scores are:
209
209
210
210
## 🎯 A. GraphQL should be able to indicate which nullable fields should become non-nullable when error propagation is disabled
211
211
212
+ [ criteria-a ] : #-a-graphql-should-be-able-to-indicate-which-nullable-fields-should-become-non-nullable-when-error-propagation-is-disabled
213
+
212
214
The promise of this RFC - the reflection of the semantic nullability of the
213
215
fields without compromising requests with error propagation enabled via the
214
216
differentiation of a "null if and only if an error occurs" type.
@@ -232,6 +234,8 @@ Criteria score: 🥇
232
234
233
235
## 🎯 B. Existing executable documents should retain validity and meaning
234
236
237
+ [ criteria-b ] : #-b-existing-executable-documents-should-retain-validity-and-meaning
238
+
235
239
Users should be able to adopt semantic nullability into an existing schema, and
236
240
when doing so all existing operations should remain valid, and should have the
237
241
same meaning as they always did.
@@ -244,6 +248,8 @@ Criteria score: 🥇
244
248
245
249
## 🎯 C. Unadorned type should mean nullable
246
250
251
+ [ criteria-c ] : #-c-unadorned-type-should-mean-nullable
252
+
247
253
GraphQL has been public for 10 years and there's a lot of content out there
248
254
noting that GraphQL types are nullable by default (unadorned type is nullable)
249
255
and our changes should not invalidate this content.
@@ -256,6 +262,8 @@ Criteria score: 🥈
256
262
257
263
## 🎯 D. Syntax should be obvious to programmers
258
264
265
+ [ criteria-d ] : #-d-syntax-should-be-obvious-to-programmers
266
+
259
267
The GraphQL languages similarity to JSON is one of its strengths, making it
260
268
immediately feel familiar. Syntax used should feel obvious to developers new to
261
269
GraphQL.
@@ -268,6 +276,8 @@ Criteria score: 🥈
268
276
269
277
## 🎯 E. Syntax used in SDL and in executable documents should be consistent with SDL
270
278
279
+ [ criteria-e ] : #-e-syntax-used-in-sdl-and-in-executable-documents-should-be-consistent-with-sdl
280
+
271
281
When a user wishes to replace the value for an input field or argument with a
272
282
variable in their GraphQL operation, the type syntax should be either identical
273
283
or similar, and should carry the same meaning.
@@ -280,6 +290,8 @@ Criteria score: 🥇
280
290
281
291
## 🎯 F. Alternative syntaxes should not cause confusion
282
292
293
+ [ criteria-f ] : #-f-alternative-syntaxes-should-not-cause-confusion
294
+
283
295
Where a proposal allows alternative syntaxes to be used, the two syntaxes should
284
296
not cause confusion.
285
297
@@ -291,6 +303,8 @@ Criteria score: 🥇
291
303
292
304
## 🎯 G. Error propagation boundaries should not change in existing executable documents
293
305
306
+ [ criteria-g ] : #-g-error-propagation-boundaries-should-not-change-in-existing-executable-documents
307
+
294
308
An expansion of B, this states that the proposal will not change where errors
295
309
propagate to when error propagation is enabled (i.e. existing documents will
296
310
still keep errors local to the same positions that they did when they were
@@ -308,6 +322,8 @@ path for legacy apps, the tradeoff might be acceptable.
308
322
309
323
## 🎯 H. Implementation and spec simplicity
310
324
325
+ [ criteria-h ] : #-h-implementation-and-spec-simplicity
326
+
311
327
The implementation required to make the proposal work should be simple.
312
328
313
329
| [ 1] [ solution-1 ] | [ 2] [ solution-2 ] | [ 3] [ solution-3 ] | [ 4] [ solution-4 ] | [ 5] [ solution-5 ] |
@@ -318,6 +334,8 @@ Criteria score: 🥈
318
334
319
335
## 🎯 I. Syntax used in executable documents should be unchanged
320
336
337
+ [ criteria-i ] : #-i-syntax-used-in-executable-documents-should-be-unchanged
338
+
321
339
Executable documents do not differentiate between semantic and strict non-null
322
340
since inputs never handle "errors" ("null only on error" is the same as "not
323
341
null" on input). As such, there's no benefit to clients for the syntax of
@@ -331,6 +349,8 @@ Criteria score: 🥇
331
349
332
350
## 🎯 J. Type reasoning should remain local
333
351
352
+ [ criteria-j ] : #-j-type-reasoning-should-remain-local
353
+
334
354
The type of a field (` foo: Int ` ) can be determined by looking at the field and
335
355
its type; the reader should not have to read a document or schema directive to
336
356
determine how the type should be interpreted.
@@ -343,6 +363,8 @@ Criteria score: 🥇
343
363
344
364
## 🎯 K. Introspection must be backwards compatible
345
365
366
+ [ criteria-k ] : #-k-introspection-must-be-backwards-compatible
367
+
346
368
We do not want to break existing tooling.
347
369
348
370
| [ 1] [ solution-1 ] | [ 2] [ solution-2 ] | [ 3] [ solution-3 ] | [ 4] [ solution-4 ] | [ 5] [ solution-5 ] |
@@ -353,6 +375,8 @@ Criteria score: 🥇
353
375
354
376
## 🎯 L. General GraphQL consumers should only need to think about nullable vs non-nullable
355
377
378
+ [ criteria-l ] : #-l-general-graphql-consumers-should-only-need-to-think-about-nullable-vs-non-nullable
379
+
356
380
Schema authors and client frameworks can handle different types of nullability based around
357
381
error handling and error propagation, but consumers (frontend developers) should only need
358
382
to deal with nullable or non-nullable as presented to them by their client framework of choice.
@@ -367,6 +391,8 @@ Criteria score: 🥇
367
391
368
392
## 🎯 M. The SDL should have exactly one form used by all producers and consumers
369
393
394
+ [ criteria-m ] : #-m-the-sdl-should-have-exactly-one-form-used-by-all-producers-and-consumers
395
+
370
396
The SDL should not be influenced by client features such as local extensions and
371
397
error propagation mechanics, and should always represent the true full source
372
398
schema SDL.
@@ -381,6 +407,8 @@ Criteria score: 🥇
381
407
382
408
## 🎯 N. The solution should add value even with error propagation enabled
383
409
410
+ [ criteria-n ] : #-n-the-solution-should-add-value-even-with-error-propagation-enabled
411
+
384
412
Even when error propagation is enabled, it's valuable to be able to tell the
385
413
difference between a field that is truly (semantically) nullable, and one
386
414
that's only nullable because errors may occur. GraphQL-TOE can be used in such
@@ -395,6 +423,8 @@ Criteria score: 🥇
395
423
396
424
## 🎯 O. Should not have breaking changes for existing executable documents
397
425
426
+ [ criteria-o ] : #-o-should-not-have-breaking-changes-for-existing-executable-documents
427
+
398
428
It should be possible to enable the solution without negatively impacting
399
429
existing deployed clients.
400
430
@@ -419,6 +449,8 @@ Criteria score: X (not considered - covered by B and G)
419
449
420
450
## 🎯 P. The solution should result in users marking all semantically non-null fields as such
421
451
452
+ [ criteria-p ] : #-p-the-solution-should-result-in-users-marking-all-semantically-non-null-fields-as-such
453
+
422
454
When a field returns data that the business logic dictates does not and will
423
455
never return a legitimate (non-error) null, the schema authors should have no
424
456
hesitation over marking it as semantically non-nullable - and thus all
@@ -440,6 +472,8 @@ Criteria score: 🥇
440
472
441
473
## 🎯 Q. Migrating the unadorned output type to other forms of nullability should be non-breaking
442
474
475
+ [ criteria-q ] : #-q-migrating-the-unadorned-output-type-to-other-forms-of-nullability-should-be-non-breaking
476
+
443
477
The default (unadorned) type should be a type that you can migrate away from,
444
478
once nullability expectations become more concrete, without breaking existing
445
479
client queries.
@@ -480,6 +514,8 @@ rest of the document. New solutions must be added to the end of the list.
480
514
481
515
## 💡 1. New "Semantic Non-Null" type, represented by ` * `
482
516
517
+ [ solution-1 ] : #-1-new-semantic-non-null-type-represented-by-
518
+
483
519
** Champion** : @benjie
484
520
485
521
- Spec edits: https://github.com/graphql/graphql-spec/pull/1065
@@ -559,6 +595,8 @@ have been discussed the choice of symbol comes down mostly to aesthetics.
559
595
560
596
## 💡 2. "Strict Semantic Nullability"
561
597
598
+ [solution -2]: #-2-strict-semantic-nullability
599
+
562
600
**Champion **: @leebyron
563
601
564
602
- Discussion : https ://github .com /graphql /graphql -wg /discussions /1410
@@ -617,6 +655,8 @@ symbol) to indicate that a position may semantically be null.
617
655
618
656
## 💡 3. New "Semantic Non-Null" type, usurping `!` syntax
619
657
658
+ [solution -3]: #-3-new-semantic-non-null-type-usurping--syntax
659
+
620
660
**Champion **: @benjie
621
661
622
662
This proposal is similar to proposal 1, but :
@@ -704,6 +744,8 @@ day-to-day work.
704
744
705
745
## 💡 4. New "Semantic Non-Null" type, with `?` used for nullable types
706
746
747
+ [solution-4]: #-4-new-semantic-non-null-type-with--used-for-nullable-types
748
+
707
749
**Champion**: @twof
708
750
709
751
This proposal builds on solution 3, but with a syntactic shuffle such that the
@@ -760,6 +802,8 @@ directive is present, and a `?` symbol is used to indicate a nullable position.
760
802
761
803
## 💡 5. Use non-null in semantically non-nullable places and encourage disabling error propagation
762
804
805
+ [solution-5]: #-5-use-non-null-in-semantically-non-nullable-places-and-encourage-disabling-error-propagation
806
+
763
807
**Champion**: @martinbonnin
764
808
765
809
- Discussion: https://github.com/graphql/nullability-wg/discussions/85
0 commit comments