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(resolvers/federation): only transform federated parent types when they contain @external directive #4542

Conversation

jakeblaxon
Copy link
Contributor

This PR seeks to fix the issue raised in #4493

This updates the transformParentType function to only transform parent types if one of their fields contains an @external directive, or if the field is named __resolveReference. This essentially translates to whether the type extends a type defined in a remote schema, or whether the type is a base type.

The objective is to target only the resolvers that the gateway will call from the _entities query in a federated schema. The gateway only guarantees that fields from the @key or @requires directives will be supplied in the parent type, so we limit the parent type to only contain these fields. If the parent type is a base type, however, then its field resolvers (other than __resolveReference) will be called from elsewhere, so we therefore go with the default behavior which is to assume all fields will be available.

@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2020

💥 No Changeset

Latest commit: 8753535

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@dotansimha
Copy link
Owner

Thank you @jakeblaxon , this is great! Can you please add a changeset? Using yarn changeset, and bump the resolvers package with a patch.

@dotansimha
Copy link
Owner

Never mind, merged, because I want to make sure it will be in the next release ;)
I will add the changeset :)
Thanks @jakeblaxon !

@dotansimha dotansimha merged commit c89b46c into dotansimha:master Aug 11, 2020
@jakeblaxon jakeblaxon deleted the fix-federation-resolvers-for-base-types branch August 11, 2020 22:53
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.

None yet

2 participants