Skip to content

Commit a64fd6c

Browse files
authored
[Struct RFC] Change preference to struct as an enhanced scalar (#1235)
1 parent bf699ad commit a64fd6c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

rfcs/Struct.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,21 @@ terms of achieving our goals, but have slightly different trade-offs:
174174
2. enable `input` to be used in output too, turning it into a `struct`
175175
3. introduce a new `struct` type
176176

177-
I've gone full circle on this, and am currently thinking that option 2 is our
178-
best bet. The main reason for this is that in the other scenarios `struct` and
177+
I've gone full circle on this, and am currently thinking that option 1 is our
178+
best bet.
179+
180+
Option 2 is tempting because in the other scenarios `struct` and
179181
`input` will overlap significantly and it will be less than clear when to use
180-
one rather than the other.
182+
one rather than the other. However, it suffers from some backwards-compatibility
183+
concerns - namely that an input object being used on output is likely to confuse
184+
existing tooling such as GraphiQL, and it's entirely unknown to them whether an
185+
input object should require a selection set or not.
186+
187+
Option 1 feels like it could be done in a more backwards-compatible manner since
188+
the majority of existing tools and clients would not look at the `fields` entry
189+
on a scalar (so would not be confused by it) and already handle custom scalars
190+
such as the `JSON` scalar returning structured output, and can continue to omit
191+
a selection set on this enhanced scalar, thus continuing to operate correctly.
181192

182193
**NOTE**: this syntax, these keywords, etc. are not set in stone. Discussion is
183194
very welcome!

0 commit comments

Comments
 (0)