-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid incomplete subgraph when extracting from supergraph #1511
Conversation
Due to imprecisions of the fed1 join spec, the code handling supergraph sometimes initially assume a type is in all subgraph to remove that type later from some subgraphs as it realises it cannot have been in that subgraph. As we remove types that way, we have to remove references to it as well, and this was done correctly for object types through `removeRecursive`, but for union types, `remove` was used instead. This fix imply ensure `removeRecursive` is used there as well.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The justification here makes sense to me and this commit is also on #1510 which has been reviewed separately. Landing this will unblock a use-case in the Router and we're going to try to cut a release of that soon-ish (today?).
I will follow-up this with a release myself. (And add a CHANGELOG
there)
|
||
test('handles unions types having no members in a subgraph correctly', () => { | ||
/* | ||
* The following supergraph has been generated on version-0.x from: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this have a different comment if it were generated by main
?
* router-bridge: Update to `@apollo/query-planner@2.0.0-alpha.6` Most notably to bring in apollographql/federation#1511 Ref: apollographql/federation@ee84b3fd9df161c3a94 * tests: update snapshots to include `operationKind` This is expected since the [Ref]erenced PR introduced it! Ref: apollographql/federation#1427
This is a small followup to #1351: the patch removed object/interface types recursively as it should, but typo-ed union types only calling
remove
instead ofremoveRecursive
.I didn't notice it at the time because while I added a union type test, it wasn't actually exercise the part of the code I though it was.
This PR fixes that problem and adds a proper test (keeping the other union test because while it didn't test what I though it was, it still tests something useful (namely that the
removeRecursive
on object types correctly recurse to unions)).