-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Handle defaulted variables correctly during post-processing (#2443)
Post-processing didn't previously account for defaulted variable values in an operation at all. This surfaces as a problem when using conditional directives (@skip/@include) that use variables with defaulted values (and no corresponding variable provided). We should collect defaulted variable values from the operation and pass them along with the variables we provide to computeResponse so these are accounted for.
- Loading branch information
1 parent
a0a4e28
commit 6e2d24b
Showing
4 changed files
with
106 additions
and
9 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/federation-internals": patch | ||
"@apollo/gateway": patch | ||
--- | ||
|
||
Handle defaulted variables correctly during post-processing. | ||
|
||
Users who tried to use built-in conditional directives (skip/include) with _defaulted_ variables and no variable provided would encounter an error thrown by operation post-processing saying that the variables weren't provided. The defaulted values went unaccounted for, so the operation would validate but then fail an assertion while resolving the conditional. | ||
|
||
With this change, defaulted variable values are now collected and provided to post-processing (with defaults being overwritten by variables that are actually provided). | ||
|
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
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