Stream payload index #39
Replies: 3 comments 7 replies
-
Great summary! A quick note: Option A could also use atIndices when required just like for B. |
Beta Was this translation helpful? Give feedback.
-
This will be opted into by a client who requests Further, we're not building the out-of-order stuff now, so we don't really know what we'll need then. Perhaps we'll find that specifying "at ranges" is better: My preference is for Option C
Second preference is for Option B with
I'm not a fan of Option B with
I dislike Option A:
Further note that everything that specifies an index makes one of the following choices:
If we're not going to be future proof then we might as well choose option C since adding indexes is adding more work for client and server without much in the way of benefits. If we are going to be future proof (and honour the indexes) then we open a big can of worms:
Should we wish to send down indexes for debugging/help purposes, why not do so with the |
Beta Was this translation helpful? Give feedback.
-
This was discussed at the May 2022 WG meeting and has been updated to reflect the decision to pursue "Option A - Stream item index is appended to path array" |
Beta Was this translation helpful? Give feedback.
-
Note - this is now stale, index has been removed in the new response format
Continued from #32
Context
How should a stream payload represent the index of the streamed item? Or should it be represented at all? Is it strictly necessary since the spec enforces payloads are sent in order?(#17).
Three options were discussed at the April 2022 GraphQL WG meeting:
Option A - Stream item index is appended to path array
Example:
Advantages
Future Expansion
Split index into another array?"path": ["person", "films", [2, 3, 4]]
Option B - Stream item index is in a new property
Example:
Advantages
Future Expansion
atIndices
?"atIndices": [2, 3, 4]
Option C - Stream item index is not present in the response
Example:
Advantages
The index is not strictly necessary, since the spec enforces payloads are sent in order(Enforcing delivery order of payloads #17)Future Expansion
Decision
This was discussed again at the May 2022 WG meeting
The group decided to pursue Option A. After demonstrating the ambiguous case described here, it was determined that the payload must be idempotent. The language in the spec will be updated to indicate that this payload represents "Set at a range, where the beginning of the range is at the given index, and the length of the range is the length of the data."
Consequences
Client libraries must be sure to treat stream payloads as a "Set at index range" operation. Payloads must not be treated as "concat" operations as that can create a bad state in the case of duplicate identical streams as described here.
Status
Beta Was this translation helpful? Give feedback.
All reactions