-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrectly rejected composition and subgraph issues with `@inter…
…faceObject` (#2494) There is 2 main issues with the handling of `@interfaceObject` that this patch fixes: 1. given some `@interfaceObject` type `I` in some subgraph `S1`, if another subgraph `S2` was declaring an _implementation_ type `T` of `I` but _without_ declaring `I`, then the code missed creating an "edge" between `T` in `S2` and `I` in `S1`, which resulted in composition rejecting such cases, even though it should work. 2. there were an additional issue in the handling of `@requires` so that the "input rewrites" generated were not generic enough, leading to sometimes sending incorrect queries to subgraph (more precisely, we were sometimes not rewriting the typename when querying an `@interfaceObject` subgraph, leading that subgraph to complain that it is asked for type it doesn't know). Note that fixing those 2 issues surfaced the fact that the handling of "rewrites" in the gateway was not working exactly as it should have. More precisely, hen a path had a fragment `... on I`, if `I` was an interface, then we would no select objects that implements `I` correctly. As it happens, the router implementation of those rewrites was both cleaner and didn't had that issue, so this patch also updates the handling of "rewrites" to mimick what the router implementation does (fixing the issue, and overall cleaning the code). Fixes #2485
- Loading branch information
Sylvain Lebresne
authored
Mar 30, 2023
1 parent
0ba5ce6
commit 450b957
Showing
10 changed files
with
524 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"@apollo/query-planner": patch | ||
"@apollo/query-graphs": patch | ||
"@apollo/federation-internals": patch | ||
"@apollo/gateway": patch | ||
--- | ||
|
||
Fix issues (incorrectly rejected composition and/or subgraph errors) with `@interfaceObject`. Those issues may occur | ||
either due to some use of `@requires` in an `@interfaceObject` type, or when some subgraph `S` defines a type that is an | ||
implementation of an interface `I` in the supergraph, and there is an `@interfaceObject` for `I` in another subgraph, | ||
but `S` does not itself defines `I`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.