-
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 normalization of fragment spreads (#2659)
The code that "normalize" selection sets to remove unecessary fragments is also used to remove impossibe (and thus invalid) branches when some reused fragments gets expanded away due to only be used once. However, while the code for inline fragments was correctly removing impossible branches, the similar code for named spreads was not, which in some rare cases could result in an invalid subgraph fetch.
- Loading branch information
Sylvain Lebresne
authored
Jul 6, 2023
1 parent
158d263
commit 1bb7c51
Showing
3 changed files
with
124 additions
and
14 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,10 @@ | ||
--- | ||
"@apollo/federation-internals": patch | ||
--- | ||
|
||
Fix issue in the code to reuse fragments that, in some rare circumstances, could led to invalid queries where a named | ||
spread was use in an invalid position. If triggered, this resulted in an subgraph fetch whereby a named spread was | ||
used inside a sub-selection even though the spread condition did not intersect the parent type (the exact error message | ||
would depend on the client library used to handle subgraph fetches, but with GraphQL-js, the error message had the | ||
form "Fragment <F> cannot be spread here as objects of type <X> can never be of type <Y>"). | ||
|
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
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