Skip to content

Commit

Permalink
fix(merge): ignore comments while merging directives #3031
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Aug 12, 2021
1 parent 9ede806 commit a5fb77a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-jars-exist.md
@@ -0,0 +1,5 @@
---
'@graphql-tools/merge': patch
---

fix(merge): ignore comments while merging directives #3031
10 changes: 8 additions & 2 deletions packages/merge/src/typedefs-mergers/directives.ts
Expand Up @@ -83,8 +83,14 @@ export function mergeDirectives(
}

function validateInputs(node: DirectiveDefinitionNode, existingNode: DirectiveDefinitionNode): void | never {
const printedNode = print(node);
const printedExistingNode = print(existingNode);
const printedNode = print({
...node,
description: undefined,
});
const printedExistingNode = print({
...existingNode,
description: undefined,
});
// eslint-disable-next-line
const leaveInputs = new RegExp('(directive @w*d*)|( on .*$)', 'g');
const sameArguments = printedNode.replace(leaveInputs, '') === printedExistingNode.replace(leaveInputs, '');
Expand Down

1 comment on commit a5fb77a

@vercel
Copy link

@vercel vercel bot commented on a5fb77a Aug 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.