Skip to content

fix(graphql): Exclude auxiliary types for @extends in Apollo Federation _service queries#9663

Open
matthewmcneely wants to merge 13 commits intomainfrom
matthewmcneely/graphql-federation-issues
Open

fix(graphql): Exclude auxiliary types for @extends in Apollo Federation _service queries#9663
matthewmcneely wants to merge 13 commits intomainfrom
matthewmcneely/graphql-federation-issues

Conversation

@matthewmcneely
Copy link
Contributor

Description

When using Dgraph as Apollo Federation subgraphs, the _service query returns auxiliary types (mutations, filters, inputs) for types marked with @extends. This causes schema composition conflicts in Apollo Rover because multiple subgraphs attempt to define the same auxiliary types for extended entities.

For example, if subgraph A defines type User @key(fields: "id") and subgraph B extends it with extend type User @key(fields: "id") { reviews: [Review] }, both subgraphs would generate UserPatch, UserFilter, AddUserInput, etc., causing Rover composition to fail.

Fixes #9662

Changes

  • Core fix: Updated auxiliary type generation logic to check apolloServiceQuery && hasExtends(defn)
  • Unit test: Added TestApolloServiceQueryExcludesAuxiliaryTypes to verify exclusion behavior
  • Integration test: Updated apollo_service_response.graphql expected output to match corrected behavior
  • E2E test: Added TestRoverFederationComposition with Apollo Rover CLI to verify real-world federation composition succeeds

Checklist

  • The PR title follows the
    Conventional Commits syntax, leading
    with fix:, feat:, chore:, ci:, etc.
  • Code compiles correctly and linting (via trunk) passes locally
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

@matthewmcneely matthewmcneely requested a review from a team as a code owner March 19, 2026 18:53
@github-actions github-actions bot added area/testing Testing related issues area/graphql Issues related to GraphQL support on Dgraph. area/core internal mechanisms go Pull requests that update Go code labels Mar 19, 2026
@blacksmith-sh

This comment has been minimized.

@matthewmcneely matthewmcneely force-pushed the matthewmcneely/graphql-federation-issues branch 2 times, most recently from 48de07a to 9de2145 Compare March 19, 2026 21:15
@matthewmcneely matthewmcneely force-pushed the matthewmcneely/graphql-federation-issues branch from 9de2145 to b6272fe Compare March 19, 2026 22:23
Reflect the new behavior where auxiliary types (filters, orderables,
mutations, aggregates) are no longer generated for @extends types in the
Apollo service query output. This prevents conflicts when composing
federated schemas.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core internal mechanisms area/graphql Issues related to GraphQL support on Dgraph. area/testing Testing related issues go Pull requests that update Go code

Development

Successfully merging this pull request may close these issues.

Unable to use several dgraph instances together with GraphQL federation

3 participants