Skip to content

Commit

Permalink
fix: Handle defaulted variables correctly during post-processing (#2443)
Browse files Browse the repository at this point in the history
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
trevor-scheer authored and Sylvain Lebresne committed May 15, 2023
1 parent 961f390 commit 98844fd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .changeset/gentle-rockets-roll.md
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).

0 comments on commit 98844fd

Please sign in to comment.