fix(composition): Address post-merge feedback for #3391 - #3422
Conversation
…he target version for a directive definition.
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: d72e719bc8ed8965411e5c32 ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
🦋 Changeset detectedLatest commit: 45a8237 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4246470 to
45a8237
Compare
dariuszkuc
left a comment
There was a problem hiding this comment.
looks good
question: do we want to allow scenarios where older specs define more directives than new one? this would make it easier to evolve* but at the same time limiting to latest spec version is safer as it ensures that all those custom directives are still valid
*if they do need to bump the spec folks will have to import all of them in a single subgraph until migration is over (so following current behavior)
|
@dariuszkuc |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to next, this PR will be updated. # Releases ## @apollo/composition@2.14.0 ### Minor Changes - Relax `@composeDirective` validation when definitions are absent in some subgraphs. ([#3422](#3422)) Previously, if some set of spec directives were being composed into the supergraph schema via `@composeDirective`, then subgraphs with the latest version of that spec would each have to declare all of those spec directive definitions. Not following this rule would often result in composition emitting a `DIRECTIVE_COMPOSITION_ERROR` error. This restriction has now been relaxed, and a definition needs to only be in at least one of those subgraphs with the latest version of that spec. As an example, the following `@composeDirective` usage could previously fail, but is now valid. ```graphql # subgraph A — composes and defines @foo and @bar extend schema # ... @link(url: "https://myorg.dev/myspec/v1.0", import: ["@foo", "@bar"]) @composeDirective(name: "@foo") @composeDirective(name: "@bar") # ... directive @foo on FIELD directive @bar on FIELD # subgraph B — composes and defines only @foo extend schema # ... @link(url: "https://myorg.dev/myspec/v1.0", import: ["@foo"]) @composeDirective(name: "@foo") # ... directive @foo on FIELD ``` ### Patch Changes - Fixed print logic when calculating the max number of elements to include in the message. Previously we were not passing ([#3424](#3424)) the current calculated length correctly leading to inclusion of additional elements in the error/hints message. - Updated dependencies \[[`21cf465d4c687daeed71635422718c3c7b7d2d0e`](21cf465), [`5b36fc6b5a494aa6983e0339713dc45a0bd031e3`](5b36fc6), [`a20279a0184d9dfbc01a806d849dc8ae22497298`](a20279a)]: - @apollo/federation-internals@2.14.0 - @apollo/query-graphs@2.14.0 ## @apollo/gateway@2.14.0 ### Minor Changes - Add opt-out anonymous deployment environment telemetry. To opt-out, set APOLLO_TELEMETRY_DISABLED=1 in your environment. ([#3379](#3379)) ### Patch Changes - Fixed print logic when calculating the max number of elements to include in the message. Previously we were not passing ([#3424](#3424)) the current calculated length correctly leading to inclusion of additional elements in the error/hints message. - Updated dependencies \[[`21cf465d4c687daeed71635422718c3c7b7d2d0e`](21cf465), [`e1fd4ac10f72bb09027995f0811ec6e0021bcd49`](e1fd4ac), [`5b36fc6b5a494aa6983e0339713dc45a0bd031e3`](5b36fc6), [`a20279a0184d9dfbc01a806d849dc8ae22497298`](a20279a)]: - @apollo/composition@2.14.0 - @apollo/federation-internals@2.14.0 - @apollo/query-planner@2.14.0 ## @apollo/federation-internals@2.14.0 ### Minor Changes - Relax `@interfaceObject` validation for Fed 1 subgraphs. ([#3392](#3392)) Previously, any use of `@interfaceObject` in a Fed 2 subgraph caused an `INTERFACE_OBJECT_USAGE_ERROR` if any Fed 1 subgraph was present in the composition, regardless of whether the types conflicted. The check is now per-type: an error is only raised when a Fed 2 subgraph uses `@interfaceObject` on type `T` **and** a Fed 1 subgraph has `@key` on an interface also named `T`. `@key` on an interface in a Fed 1 subgraph does not mean it can fulfill the `__typename`-resolution requirement that `@interfaceObject` depends on — but they are otherwise compatible with `@interfaceObject` usage on unrelated types. - Add validations for `@link` usages to prevent name conflicts. ([#3430](#3430)) This change helps to avoid ambiguity for downstream `@link`-consuming code, which previously may have found different results for a spec schema element depending on search order. If your composition fails after this change, please rename conflicting elements via `@link(import:)` and conflicting specs/features via `@link(as:)`. Note that if you were declaring `@link`s for the `https://specs.apollo.dev/tag` or `https://specs.apollo.dev/inaccessible` specs in your subgraph schema, you will need to instead import `@tag` and `@inaccessible` from the `https://specs.apollo.dev/federation` spec. This previous pattern only succeeded due to a now-fixed bug and is fragile/may lead to undesirable behavior. ### Patch Changes - Fixed print logic when calculating the max number of elements to include in the message. Previously we were not passing ([#3424](#3424)) the current calculated length correctly leading to inclusion of additional elements in the error/hints message. ## @apollo/query-graphs@2.14.0 ### Patch Changes - Updated dependencies \[[`21cf465d4c687daeed71635422718c3c7b7d2d0e`](21cf465), [`5b36fc6b5a494aa6983e0339713dc45a0bd031e3`](5b36fc6), [`a20279a0184d9dfbc01a806d849dc8ae22497298`](a20279a)]: - @apollo/federation-internals@2.14.0 ## @apollo/query-planner@2.14.0 ### Patch Changes - Updated dependencies \[[`21cf465d4c687daeed71635422718c3c7b7d2d0e`](21cf465), [`5b36fc6b5a494aa6983e0339713dc45a0bd031e3`](5b36fc6), [`a20279a0184d9dfbc01a806d849dc8ae22497298`](a20279a)]: - @apollo/federation-internals@2.14.0 - @apollo/query-graphs@2.14.0 ## @apollo/subgraph@2.14.0 ### Patch Changes - Updated dependencies \[[`21cf465d4c687daeed71635422718c3c7b7d2d0e`](21cf465), [`5b36fc6b5a494aa6983e0339713dc45a0bd031e3`](5b36fc6), [`a20279a0184d9dfbc01a806d849dc8ae22497298`](a20279a)]: - @apollo/federation-internals@2.14.0 ## apollo-federation-integration-testsuite@2.14.0 ### Minor Changes - Add opt-out anonymous deployment environment telemetry. To opt-out, set APOLLO_TELEMETRY_DISABLED=1 in your environment. ([#3379](#3379)) ### Patch Changes - Fixed print logic when calculating the max number of elements to include in the message. Previously we were not passing ([#3424](#3424)) the current calculated length correctly leading to inclusion of additional elements in the error/hints message. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR:
sourceFeature(), where it would return the wrong name-in-spec sometimes.@composeDirectivespec (or the connect spec) is aliased and a directive with the same name as the spec is used (which should be rare).