BREAKING: fix defer de-duplication, and update public defer structs#4223
BREAKING: fix defer de-duplication, and update public defer structs#4223chad-bekmezian-snap wants to merge 13 commits into
Conversation
|
I'm very excited to improve |
Do you have a specific concern that makes you think this might break apollo federation? I considered trying to bump us up towards the latest, but it was going to be more involved than I have the bandwidth for. These changes do lend themselves towards making the move to a newer version much easier though! |
|
My concern comes from this comment:
|
I'm sorry, I'm still not totally following. This pr is still the 20220824 spec. It just involves bug fixes within the implementation of that spec. What am I missing here? I have compared this implementation to the apollo server implementation for 20220824. There are a couple of differences in the responses still, one being that the same data IS sent multiple times in the apollo implementation. However, that is a difference that existed prior to this change. In every way, this PR brings gqlgen much closer to having identical output to the Apollo Server implementation. |
…arshalling a FieldSetView
641433f to
d14ffa4
Compare
There was a problem hiding this comment.
It looks like you accidentally checked this binary in
This change is a breaking change on insofar as publicly exported types are concerned. Specifically the
DeferGrouptype has undergone a breaking change. The change to the server isn't a breaking change from a graphql client perspective.Most of this pr is noise from codegen. The actual changes can be found in the graphql directory, and object.gotpl.
Describe your PR and link to any relevant issues.
Addresses the issues in #4213.
Examples
Example 1
details
Query
Before
After
Response Diff
Notes
We now receive an incremental result for each distinct label in our deferred fragments.
Example 2
details
Query
Before
After
Response Diff
Notes
No change. With the guarantee that a result will be delivered for every labeled defer fragment, there is no need to start sending duplicative data.
Example 3
details
Query
Before
After
Response Diff
Notes
We once again get an incremental result for each deferred fragment. Even in the case of nested fragments/defers.
Example 4
details
Query
Before
After
Response Diff
Notes
In the "before", the user's id was requested within a non-deferred context, yet it was not included in the initial graphql payload. The 2022 spec hints at how this should be handled, stating
A query with @defer directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred delivered in a subsequent response. @include and @skip take precedence over @defer.Since the user's id is used within a non-deferred context, it follows it should be included in the initial response. This is behavior is further established as the intended implementation in the examples provided in this discussion: graphql/defer-stream-wg#69.Open question: as you can see in the above, if the entire dataset in a deferred fragment is delivered in an initial response, no incremental result will be sent for that fragment later. In my testing with facebook's Relay client, it seems to handle this behavior correctly. This also seems to be typical from additional reading I've done, but I am open to sending an incremental result in that case as well.
I have: