Skip to content

Commit 3ff9ab3

Browse files
authored
Implement the links in the semantic nullability RFC (#1665)
1 parent 93aa905 commit 3ff9ab3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

rfcs/SemanticNullability.md

+44
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ Guiding Principles. The scores are:
209209

210210
## 🎯 A. GraphQL should be able to indicate which nullable fields should become non-nullable when error propagation is disabled
211211

212+
[criteria-a]: #-a-graphql-should-be-able-to-indicate-which-nullable-fields-should-become-non-nullable-when-error-propagation-is-disabled
213+
212214
The promise of this RFC - the reflection of the semantic nullability of the
213215
fields without compromising requests with error propagation enabled via the
214216
differentiation of a "null if and only if an error occurs" type.
@@ -232,6 +234,8 @@ Criteria score: 🥇
232234

233235
## 🎯 B. Existing executable documents should retain validity and meaning
234236

237+
[criteria-b]: #-b-existing-executable-documents-should-retain-validity-and-meaning
238+
235239
Users should be able to adopt semantic nullability into an existing schema, and
236240
when doing so all existing operations should remain valid, and should have the
237241
same meaning as they always did.
@@ -244,6 +248,8 @@ Criteria score: 🥇
244248

245249
## 🎯 C. Unadorned type should mean nullable
246250

251+
[criteria-c]: #-c-unadorned-type-should-mean-nullable
252+
247253
GraphQL has been public for 10 years and there's a lot of content out there
248254
noting that GraphQL types are nullable by default (unadorned type is nullable)
249255
and our changes should not invalidate this content.
@@ -256,6 +262,8 @@ Criteria score: 🥈
256262

257263
## 🎯 D. Syntax should be obvious to programmers
258264

265+
[criteria-d]: #-d-syntax-should-be-obvious-to-programmers
266+
259267
The GraphQL languages similarity to JSON is one of its strengths, making it
260268
immediately feel familiar. Syntax used should feel obvious to developers new to
261269
GraphQL.
@@ -268,6 +276,8 @@ Criteria score: 🥈
268276

269277
## 🎯 E. Syntax used in SDL and in executable documents should be consistent with SDL
270278

279+
[criteria-e]: #-e-syntax-used-in-sdl-and-in-executable-documents-should-be-consistent-with-sdl
280+
271281
When a user wishes to replace the value for an input field or argument with a
272282
variable in their GraphQL operation, the type syntax should be either identical
273283
or similar, and should carry the same meaning.
@@ -280,6 +290,8 @@ Criteria score: 🥇
280290

281291
## 🎯 F. Alternative syntaxes should not cause confusion
282292

293+
[criteria-f]: #-f-alternative-syntaxes-should-not-cause-confusion
294+
283295
Where a proposal allows alternative syntaxes to be used, the two syntaxes should
284296
not cause confusion.
285297

@@ -291,6 +303,8 @@ Criteria score: 🥇
291303

292304
## 🎯 G. Error propagation boundaries should not change in existing executable documents
293305

306+
[criteria-g]: #-g-error-propagation-boundaries-should-not-change-in-existing-executable-documents
307+
294308
An expansion of B, this states that the proposal will not change where errors
295309
propagate to when error propagation is enabled (i.e. existing documents will
296310
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.
308322

309323
## 🎯 H. Implementation and spec simplicity
310324

325+
[criteria-h]: #-h-implementation-and-spec-simplicity
326+
311327
The implementation required to make the proposal work should be simple.
312328

313329
| [1][solution-1] | [2][solution-2] | [3][solution-3] | [4][solution-4] | [5][solution-5] |
@@ -318,6 +334,8 @@ Criteria score: 🥈
318334

319335
## 🎯 I. Syntax used in executable documents should be unchanged
320336

337+
[criteria-i]: #-i-syntax-used-in-executable-documents-should-be-unchanged
338+
321339
Executable documents do not differentiate between semantic and strict non-null
322340
since inputs never handle "errors" ("null only on error" is the same as "not
323341
null" on input). As such, there's no benefit to clients for the syntax of
@@ -331,6 +349,8 @@ Criteria score: 🥇
331349

332350
## 🎯 J. Type reasoning should remain local
333351

352+
[criteria-j]: #-j-type-reasoning-should-remain-local
353+
334354
The type of a field (`foo: Int`) can be determined by looking at the field and
335355
its type; the reader should not have to read a document or schema directive to
336356
determine how the type should be interpreted.
@@ -343,6 +363,8 @@ Criteria score: 🥇
343363

344364
## 🎯 K. Introspection must be backwards compatible
345365

366+
[criteria-k]: #-k-introspection-must-be-backwards-compatible
367+
346368
We do not want to break existing tooling.
347369

348370
| [1][solution-1] | [2][solution-2] | [3][solution-3] | [4][solution-4] | [5][solution-5] |
@@ -353,6 +375,8 @@ Criteria score: 🥇
353375

354376
## 🎯 L. General GraphQL consumers should only need to think about nullable vs non-nullable
355377

378+
[criteria-l]: #-l-general-graphql-consumers-should-only-need-to-think-about-nullable-vs-non-nullable
379+
356380
Schema authors and client frameworks can handle different types of nullability based around
357381
error handling and error propagation, but consumers (frontend developers) should only need
358382
to deal with nullable or non-nullable as presented to them by their client framework of choice.
@@ -367,6 +391,8 @@ Criteria score: 🥇
367391

368392
## 🎯 M. The SDL should have exactly one form used by all producers and consumers
369393

394+
[criteria-m]: #-m-the-sdl-should-have-exactly-one-form-used-by-all-producers-and-consumers
395+
370396
The SDL should not be influenced by client features such as local extensions and
371397
error propagation mechanics, and should always represent the true full source
372398
schema SDL.
@@ -381,6 +407,8 @@ Criteria score: 🥇
381407

382408
## 🎯 N. The solution should add value even with error propagation enabled
383409

410+
[criteria-n]: #-n-the-solution-should-add-value-even-with-error-propagation-enabled
411+
384412
Even when error propagation is enabled, it's valuable to be able to tell the
385413
difference between a field that is truly (semantically) nullable, and one
386414
that's only nullable because errors may occur. GraphQL-TOE can be used in such
@@ -395,6 +423,8 @@ Criteria score: 🥇
395423

396424
## 🎯 O. Should not have breaking changes for existing executable documents
397425

426+
[criteria-o]: #-o-should-not-have-breaking-changes-for-existing-executable-documents
427+
398428
It should be possible to enable the solution without negatively impacting
399429
existing deployed clients.
400430

@@ -419,6 +449,8 @@ Criteria score: X (not considered - covered by B and G)
419449

420450
## 🎯 P. The solution should result in users marking all semantically non-null fields as such
421451

452+
[criteria-p]: #-p-the-solution-should-result-in-users-marking-all-semantically-non-null-fields-as-such
453+
422454
When a field returns data that the business logic dictates does not and will
423455
never return a legitimate (non-error) null, the schema authors should have no
424456
hesitation over marking it as semantically non-nullable - and thus all
@@ -440,6 +472,8 @@ Criteria score: 🥇
440472

441473
## 🎯 Q. Migrating the unadorned output type to other forms of nullability should be non-breaking
442474

475+
[criteria-q]: #-q-migrating-the-unadorned-output-type-to-other-forms-of-nullability-should-be-non-breaking
476+
443477
The default (unadorned) type should be a type that you can migrate away from,
444478
once nullability expectations become more concrete, without breaking existing
445479
client queries.
@@ -480,6 +514,8 @@ rest of the document. New solutions must be added to the end of the list.
480514

481515
## 💡 1. New "Semantic Non-Null" type, represented by `*`
482516

517+
[solution-1]: #-1-new-semantic-non-null-type-represented-by-
518+
483519
**Champion**: @benjie
484520

485521
- 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.
559595

560596
## 💡 2. "Strict Semantic Nullability"
561597

598+
[solution-2]: #-2-strict-semantic-nullability
599+
562600
**Champion**: @leebyron
563601

564602
- Discussion: https://github.com/graphql/graphql-wg/discussions/1410
@@ -617,6 +655,8 @@ symbol) to indicate that a position may semantically be null.
617655

618656
## 💡 3. New "Semantic Non-Null" type, usurping `!` syntax
619657

658+
[solution-3]: #-3-new-semantic-non-null-type-usurping--syntax
659+
620660
**Champion**: @benjie
621661

622662
This proposal is similar to proposal 1, but:
@@ -704,6 +744,8 @@ day-to-day work.
704744

705745
## 💡 4. New "Semantic Non-Null" type, with `?` used for nullable types
706746

747+
[solution-4]: #-4-new-semantic-non-null-type-with--used-for-nullable-types
748+
707749
**Champion**: @twof
708750

709751
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.
760802

761803
## 💡 5. Use non-null in semantically non-nullable places and encourage disabling error propagation
762804

805+
[solution-5]: #-5-use-non-null-in-semantically-non-nullable-places-and-encourage-disabling-error-propagation
806+
763807
**Champion**: @martinbonnin
764808

765809
- Discussion: https://github.com/graphql/nullability-wg/discussions/85

0 commit comments

Comments
 (0)