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

Add missing input rewrites in some case of @interfaceObject #2346

Merged
merged 2 commits into from
Jan 25, 2023

Conversation

pcmanus
Copy link
Contributor

@pcmanus pcmanus commented Jan 24, 2023

Fetches to subgraphs that use @interfaceObject needs to have some rewriting on their inputs to ensure we don't never send a __typename whose value is an implementation type for the @interfaceObject (such type is unknown to the particular subgraph).

The code was doing those rewrites in most cases, but in the case where only fields from the @interfaceObject were requested but some type condition forced the resolution of the implementation, those rewrites were not populated. It resulted in the subgraph rejecting the _entities call due to some of the __typename not matching any known type (by this subgraph).

This commit ensures those rewrites are correctly populated.

@pcmanus pcmanus self-assigned this Jan 24, 2023
@netlify
Copy link

netlify bot commented Jan 24, 2023

👷 Deploy request for apollo-federation-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 62877a5

@changeset-bot
Copy link

changeset-bot bot commented Jan 24, 2023

🦋 Changeset detected

Latest commit: 62877a5

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

This PR includes changesets to release 6 packages
Name Type
@apollo/gateway Patch
@apollo/query-planner Patch
@apollo/federation-internals Patch
@apollo/composition Patch
@apollo/query-graphs Patch
@apollo/subgraph 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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 24, 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.

Fetches to subgraphs that use `@interfaceObject` needs to have some
rewriting on their inputs to ensure we don't never send a __typename
whose value is an implementation type for the `@interfaceObject` (such
type is unknown to the particular subgraph).

The code was doing those rewrites in most cases, but in the case where
only fields from the `@interfaceObject` were requested _but_ some
type condition forced the resolution of the implementation, those
rewrites were not populated. It resulted in the subgraph rejecting
the `_entities` call due to some of the __typename not matching any
known type (by this subgraph).

This commit ensures those rewrites are correctly populated.
@pcmanus pcmanus added this to the 2.3.0 milestone Jan 24, 2023
@pcmanus
Copy link
Contributor Author

pcmanus commented Jan 24, 2023

Note that during some testing, a small typo was found in the code that was recently added to handle the response post-processing. For speed and because it's very trivial, including it in this PR as well (see 2nd commit).

@pcmanus pcmanus merged commit 6d4531e into apollographql:main Jan 25, 2023
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.

2 participants