Skip to content
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

fix: Handle defaulted variables correctly during post-processing #2443

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

trevor-scheer
Copy link
Member

Fixes #300
(more like #300 (comment))

Post-processing doesn't currently 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.

@trevor-scheer trevor-scheer requested a review from a team March 8, 2023 00:03
@changeset-bot
Copy link

changeset-bot bot commented Mar 8, 2023

🦋 Changeset detected

Latest commit: 110b971

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@apollo/federation-internals Patch
@apollo/gateway Patch
@apollo/composition Patch
@apollo/query-planner Patch
@apollo/query-graphs Patch
@apollo/subgraph Patch
apollo-federation-integration-testsuite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Mar 8, 2023

Deploy Preview for apollo-federation-docs canceled.

Name Link
🔨 Latest commit 110b971
🔍 Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/6408ce7805c4480008baf5d7

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 8, 2023

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.

gateway-js/src/resultShaping.ts Outdated Show resolved Hide resolved
@trevor-scheer trevor-scheer enabled auto-merge (squash) March 8, 2023 18:06
@trevor-scheer trevor-scheer merged commit 6e2d24b into main Mar 8, 2023
@trevor-scheer trevor-scheer deleted the trevor/default-if-condition branch March 8, 2023 18:18
trevor-scheer added a commit that referenced this pull request May 15, 2023
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.
trevor-scheer added a commit that referenced this pull request May 15, 2023
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.
trevor-scheer added a commit that referenced this pull request May 15, 2023
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.
pcmanus pushed a commit that referenced this pull request May 16, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apollo Federation gateway breaks upon receiving a query with empty variables section
3 participants