Skip to content

Commit f6809bd

Browse files
authored
I missed the most important part - disabling error propagation! (#1650)
1 parent 7535894 commit f6809bd

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

rfcs/SemanticNullability.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,35 @@ to handle errors in the relevant places.
109109

110110
However, this would mean that clients such as Relay would want to add `?` in
111111
every position, causing an "explosion" of question marks, because really what
112-
Relay desired was to disable null propagation entirely.
112+
Relay desired was to disable error propagation entirely.
113113

114-
## Semantic nullability
114+
## Disabling error propagation
115115

116-
What we ultimately realised is that GraphQL is missing a type.
116+
It became clear that disabling error propagation was desired by advanced GraphQL
117+
clients and vital for ensuring that normalized caches were as useful as possible
118+
and that we could live up to the promise of GraphQL's partial success without
119+
compromise. But that was only part of the problem - the other part was that we
120+
want to see the "true" nullability of fields, the nullability if we were to
121+
exclude errors.
122+
123+
Note: this RFC assumes that clients may opt out of error propagation via some
124+
mechanism that is outside the scope of this RFC and will be handled in a
125+
separate RFC (e.g. via a directive such as `@noErrorPropagation` or
126+
`@behavior(onError: null)`; or via a request-level flag) - in general the
127+
specific mechanism is unimportant and thus solutions are not expected to comment
128+
on it unless the choice is significant to the proposal.
129+
130+
### Semantic nullability
131+
132+
We realised that if we were to do this, we would need two schemas: one for when
133+
null bubbling is disabled, where the true nullability of fields could be
134+
represented; and one for the traditional error handling behavior, where
135+
nullability would need to factor in that errors can occur.
136+
137+
However, maintaining two nearly-identical-except-for-nullability schemas is a
138+
chore... and it felt like it was solveable if we could teach GraphQL to
139+
understand this need... What we ultimately realised is that GraphQL is missing a
140+
type.
117141

118142
Ignoring errors, if we look at our business logic we can determine if a field is
119143
either _semantically nullable_ (it's meaningful for this field to be null - for
@@ -143,8 +167,7 @@ non-null" type.
143167
# 📜 Problem Statement
144168

145169
GraphQL needs to be able to represent semantically nullable and semantically
146-
non-nullable types as such whilst allowing errors to occur in either position,
147-
without triggering error propagation.
170+
non-nullable types as such when error propagation is disabled.
148171

149172
# 📋 Solution Criteria
150173

0 commit comments

Comments
 (0)