Describe the bug
When specifying an additional directive in an extension statement, all directives of the same name are merged into one, with the arguments merged for list types. This behavior makes sense for non-repeatable directives.
When a directive is marked as repeatable, no merging should happen, though.
To Reproduce
Steps to reproduce the behavior:
const { mergeTypeDefs } = require('@graphql-tools/merge');
const { parse } = require('graphql');
const merged = mergeTypeDefs(
parse(
`
directive @foo(x: [Int!]!) repeatable on SCALAR
scalar Foo @foo(x: [1]) @foo(x: [2])
extend scalar Foo @foo(x: [3])
`
)
);
const directives = merged.definitions.find(def => def.name?.value === 'Foo')?.directives;
console.log(directives.length);
console.log(directives.map(dir => dir.arguments[0].value.values.length));
Expected behavior
Console output should be
but instead it is
Environment:
- OS: Windows
@graphql-tools/merge: 8.2.6
graphql: 16.3.0
- NodeJS: v14.17.6
Describe the bug
When specifying an additional directive in an extension statement, all directives of the same name are merged into one, with the arguments merged for list types. This behavior makes sense for non-repeatable directives.
When a directive is marked as repeatable, no merging should happen, though.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Console output should be
but instead it is
Environment:
@graphql-tools/merge: 8.2.6graphql: 16.3.0