diff --git a/src/merge_types.js b/src/merge_types.js index f6daee8..5769138 100644 --- a/src/merge_types.js +++ b/src/merge_types.js @@ -97,6 +97,12 @@ const _makeMergedFieldDefinitions = (merged, candidate) => _addCommentsToAST(can // retain directives of both fields. if (original) { original.directives = original.directives.concat(field.directives); + original.directives = original.directives.reduce((current, next) => { + if (current.findIndex(n => n.name.value === next.name.value) === -1) { + current.push(next); + } + return current; + }, []); } return fields; }, merged.fields); diff --git a/test/graphql/other/query_type/stack_directives.js b/test/graphql/other/query_type/stack_directives.js index af304eb..8852a9b 100644 --- a/test/graphql/other/query_type/stack_directives.js +++ b/test/graphql/other/query_type/stack_directives.js @@ -5,9 +5,12 @@ export default ` age: Int } type Query { - client: Client @foo + client: Client @foo @foo } type Query { client: Client @bar } + type Query { + client: Client @foo @bar + } `;