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

[federation][resolvers] Do not generate __resolveReference if not resolvable #9989

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

eddeee888
Copy link
Collaborator

@eddeee888 eddeee888 commented Jun 6, 2024

Description

From Apollo Federation doc: https://www.apollographql.com/docs/federation/federated-types/federated-directives/#resolvable: when there's no resolvable @keys on an object type in a subgraph, we cannot move to the object type in said subgraph.

This PR:

  • avoids generating __resolveReference if there's no resolvable @key
  • generates __resolveReference for resolvable @key and skip non-resolvable ones
  • report whether a type has reference resolver in meta so something like Server Preset can handle it correctly

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Screenshots/Sandbox (if appropriate/relevant):

Adding links to sandbox or providing screenshots can help us understand more about this PR and take action on it as appropriate

How Has This Been Tested?

  • Unit tests for federation and resolvers plugin

Copy link

changeset-bot bot commented Jun 6, 2024

🦋 Changeset detected

Latest commit: 9e14ec7

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

This PR includes changesets to release 10 packages
Name Type
@graphql-codegen/visitor-plugin-common Minor
@graphql-codegen/typescript-resolvers Minor
@graphql-codegen/plugin-helpers Minor
@graphql-codegen/typescript-document-nodes Patch
@graphql-codegen/gql-tag-operations Patch
@graphql-codegen/typescript-operations Patch
@graphql-codegen/typed-document-node Patch
@graphql-codegen/typescript Patch
@graphql-codegen/graphql-modules-preset Patch
@graphql-codegen/client-preset 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

Copy link
Contributor

github-actions bot commented Jun 6, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/visitor-plugin-common 5.3.0-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-document-nodes 4.0.8-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations 4.0.8-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-operations 4.2.2-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-resolvers 4.2.0-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/typed-document-node 5.0.8-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript 4.0.8-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 4.2.7-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/graphql-modules-preset 4.0.8-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎
@graphql-codegen/plugin-helpers 5.1.0-alpha-20240606121041-9e14ec7dd5cde0aa2beb9e8e9f6bd4ccb65650b9 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Jun 6, 2024

💻 Website Preview

The latest changes are available as preview in: https://96019a96.graphql-code-generator.pages.dev

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

1 participant