You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have chosen `!` because `!` is already being used in the GraphQL spec to indicate that a field in
100
90
the schema is Non-Nullable, so it will feel familiar to GraphQL developers.
101
91
102
-
### `?`
103
-
104
-
We have chosen `?` because `?` is used in a few other languages (Swift, Kotlin) that have `!` to
105
-
mean something like the opposite of `!`.
106
-
107
92
## Use cases
108
93
109
94
### Improve the developer experience using GraphQL client code generators
@@ -147,7 +132,6 @@ utilize.
147
132
## ✅ RFC Goals
148
133
149
134
- Non-nullable syntax that is based off of syntax that developers will already be familiar with
150
-
- Nullable syntax that is based off of syntax that developers will already be familiar with
151
135
- Enable GraphQL client code generation tools to generate more ergonomic types
152
136
153
137
## 🚫 RFC Non-goals
@@ -280,6 +264,23 @@ precedent.
280
264
281
265
## Decision Log
282
266
267
+
### `!` as the only designator in the RFC (July 2023)
268
+
269
+
At the July 26th meeting of the CCN sub-WG it was decided to simplify the RFC for the sake of progress. This
270
+
reverses the "`?` as a counterpart to the `!`" designator.
271
+
272
+
The increased scope of the RFC with the nullability designator `?` has stalled the RFC for more than two
273
+
years ([the initial RFC from April 2021](https://github.com/twof/graphql-spec/pull/1/files)).
274
+
275
+
One of the contentious discussions we encountered was around the proposed behaviors of the nullability designator
276
+
`?`. Regardless of the chosen path, it had unintuitive semantics (see graphql/client-controlled-nullability-wg#2),
277
+
which require other RFCs, such as [fragment boundaries](https://github.com/graphql/graphql-wg/blob/main/rfcs/FragmentModularity.md), or new ideas like inline errors.
278
+
279
+
Even though we recognize the value of having a counterpart to `!`, we made a tradeoff decision to provide value
280
+
to the community sooner than later.
281
+
282
+
### Prior to July 2023
283
+
283
284
This proposal started out with a very simple premise and implementation, and has gotten more complex as
284
285
the community has explored edge cases and facets about how GraphQL is actually used in practice. For
285
286
example this proposal starts out by talking about accommodating the "best practices" that are recommended
@@ -293,7 +294,7 @@ log was written with newcomers in mind to avoid rediscussing issues that have al
293
294
and to make it easier to understand why certain decisions have been made. At the time of writing,
294
295
the decisions here aren't set in stone, so any future discussions can use this log as a starting point.
295
296
296
-
### `?` as a counterpart to `!`
297
+
####`?` as a counterpart to `!`
297
298
298
299
Lee was the first person [to suggest](https://github.com/graphql/graphql-spec/issues/867#issuecomment-840807186)
299
300
that the inverse of `!` should exist and that it should be represented by `?`. The
@@ -317,7 +318,8 @@ Subsequently there was discussion around whether `?` could be introduced in a la
317
318
agreement that the usability of `!` is limited without `?`, and the selected `null` propagation behavior described
318
319
below solidifies the decision to introduce both additions in a single proposal.
319
320
320
-
### List syntax
321
+
#### List syntax
322
+
321
323
Developers from Apollo [suggested](https://github.com/graphql/graphql-spec/pull/895#issuecomment-961442966) early
322
324
on that users would want to apply CCN syntax to list elements. The possibility had been suggested earlier than
323
325
that as well, but it was put off because neither Netflix nor Relay's CCN counterparts had the feature, and it
@@ -361,7 +363,8 @@ twoDimensionalList[[]]!
361
363
There are however some open concerns that the first of the two examples could be ambiguous as to whether
362
364
the `!` applies to the field as a whole or to the list elements.
363
365
364
-
### `!` propagates `null` to nearest `?` rather than nearest nullable field
366
+
#### `!` propagates `null` to nearest `?` rather than nearest nullable field
367
+
365
368
The selected mechanics were most requested by the folks at Meta working on [Relay](https://relay.dev/).
366
369
Relay wanted this behavior for a few reasons
367
370
- Relay presents a facade of fragment isolation for its own
0 commit comments