diff --git a/.changeset/good-stingrays-accept.md b/.changeset/good-stingrays-accept.md new file mode 100644 index 000000000..78e71cd51 --- /dev/null +++ b/.changeset/good-stingrays-accept.md @@ -0,0 +1,5 @@ +--- +"@apollo/composition": patch +--- + +Fixes bug introduced in `2.10.0` where we could potentially throw in `hintOnInconsistentEntity` if subgraphs use `@federation__key` rather than `@key`. diff --git a/composition-js/src/merging/merge.ts b/composition-js/src/merging/merge.ts index 3c397a9b2..11975a65a 100644 --- a/composition-js/src/merging/merge.ts +++ b/composition-js/src/merging/merge.ts @@ -1118,7 +1118,7 @@ class Merger { supergraphElement: dest, subgraphElements: sources, // All we use the string of the next line for is to categorize source with a @key of the others. - elementToString: type => type.hasAppliedDirective('key') ? 'yes' : 'no', + elementToString: type => sourceAsEntity.find(entity => entity === type) ? 'yes' : 'no', // Note that the first callback is for element that are "like the supergraph". As the supergraph has no @key ... supergraphElementPrinter: (_, subgraphs) => `it has no @key in ${subgraphs}`, otherElementsPrinter: (_, subgraphs) => ` but has some @key in ${subgraphs}`,