Return arrays from stream payloads #32
Replies: 6 comments 30 replies
-
@josephsavona Any thoughts on this from a Relay perspective? |
Beta Was this translation helpful? Give feedback.
-
I think that field resolvers that return an async iterable should return an async iterable of iterables, ie an async iterable that returns chunks of the larger list. |
Beta Was this translation helpful? Give feedback.
-
I consider Let's keep the PS. A little bit more thoughts about |
Beta Was this translation helpful? Give feedback.
-
I'm skeptical of the need for
One thing in its favour is it allows for us to do out-of-order delivery later, but I wonder if that's sufficiently likely and sufficiently valuable to justify these tradeoffs. |
Beta Was this translation helpful? Give feedback.
-
Discussed at the April 2020 WG meeting and decided to move forward with data enclosed in an array in stream payloads. Discussion around how the index is represented will be continued in #39 |
Beta Was this translation helpful? Give feedback.
-
Note for posterity: while the decision to send the data in an array still holds, we are considering renaming the field from |
Beta Was this translation helpful? Give feedback.
-
Context
In the Feb 2022 WG meeting @leebyron & @yaacovCR proposed changing the stream payload response.
data
field on the payload would change to an array containing the streamed list elementatIndex
is added with the array index.path
field would point to only the list location, not the index of the list item.Initially we would only support one single element returned in the stream array, but we should consider how this payload can be utilized in a future spec amendment to support batches of results or unordered sets.
Example (containing both defer and stream for completeness):
Response Payloads
Payload 1
Payload 2
Payload 3
The benefits of this change are:
"data": null
always means "error bubbled beyond all fields in this partial-payload" and can never mean "the data for this path was the value null". Valid defer payloads will always have an object set fordata
and now valid stream payloads will always have an array set fordata
. See discussion here: Non-nullable field errors in defer/stream payloads #23 (comment)atIndex
is an additional data point clients can use to differentiate between stream payloads and defer payloads.Decision
Discussed at the April 2020 WG meeting and decided to move forward with
data
enclosed in an array in stream payloads. Discussion around how the index is represented will be continued in #39Consequences
Beta Was this translation helpful? Give feedback.
All reactions