Description
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
- 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure the GraphQL Tools 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
mergeTypeDefs
should yield correct output, but incorrectly combines SchemaExtensions
To Reproduce Steps to reproduce the behavior:
Given two type defs:
# schema 1
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@external", /** snip **/]
)
# schema 2
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@external", /** snip **/]
)
@link(url: "file://foo.org/trackable/v2.3", import: ["@trackable"])
One would expect an output like the following from mergeTypeDefs
:
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@external", /* snip */]
)
@link(url: "file://foo.org/trackable/v2.3", import: ["@trackable"])
But you actually receive:
extend schema
@link(url: "file://foo.org/trackable/v2.3", import: ["@external", /* snip*/, "@trackable"])
The @link
kinds are merged, likely in the internal mergeDirectives
function.
The issue is very easily reproducible in this repositories tests: https://github.com/ardatan/graphql-tools/compare/master...cdaringe:graphql-tools:demo/merge-schema-extension-bug?expand=1
Expected behavior
See expected output type above.
Environment:
- OS:
@graphql-tools/merge
:main
branch- NodeJS: 22.x
Additional context