Skip to content

AdditionalTypeDefs extensions between subgraphs do not apply when building subgraphs individually #8739

@adrian-milea

Description

@adrian-milea

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

I am trying to build subgraphs for my gRPC services using gRPC introspection. However, I am building the subgraphs individually, not as part of a supergraph. When I try to use additionalTypeDefs to extend a type from one subgraph with a type from another subgraph, the new field does not appear in the built subgraph. This only works correctly when building the full supergraph.

To Reproduce Steps to reproduce the behavior:

  1. Define two gRPC services (ServiceA and ServiceB).
  2. In the mesh configuration, use additionalTypeDefs to extend a type from ServiceA to include a type from ServiceB using a Query from ServiceB.
  3. Build the subgraph for ServiceA.
  4. Observe that the new field does not appear in the ServiceA subgraph.

Expected behavior

The extended type in ServiceA should include the field from ServiceB when building the subgraph individually.

Environment:

  • OS: macOS Sequoia 15.6
  • @graphql-mesh/...: ^1.4.11
  • NodeJS: 23.6.0

Additional context

In my MeshComposeCLIConfig I am providing all the subgraphs at once, as well as the additionalTypeDefs:

additionalTypeDefs: `
    extend type V1ServiceAType {
      serviceBType: V1ServiceBType!
      @resolveTo(
          sourceName: "serviceB",
          sourceTypeName: "Query",
          sourceFieldName: "V1ServiceBListServicesBByIds",
          keysArg: "input.id",
          keyField: "serviceBId",
      )
    }
  `

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions