New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use different aliases for @inaccessible in subgraphs #1976
Comments
Summarizing conversations elsewhere: Allowing different subgraphs to use different aliases for tag and inaccessible is a little bit awkward because they end up in the supergraph—which alias should we use? But! Tag and inaccessible in subgraphs are actually different from tag/inaccessible in supergraphs. They're conceptually similar but they actually come from different core features: # in subgraphs
@link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@inaccessible", "@tag"])
# in supergraphs
@link(url: "https://specs.apollo.dev/inaccessible/v0.2", for: SECURITY)
@link(url: "https://specs.apollo.dev/tag/v0.2") So I think that it should work like this:
It's worth mentioning that this is related but not the same problem as merging arbitrary directives. When we support something like extend schema
@link(url: "https://specs.apollo.dev/foo/v1.0", import: [{ name: "@foo", as: "@myfoo" }])
@composeDirective(name: "@myfoo") then expected subgraphs to agree upon the name so that it's clear what the name will be in the supergraph is a reasonable expectation. (And adding a post-composition transformation to change to name is a future possibility.) |
we don't currently support using different aliases across subgraphs for composed directives like @jeffjakub the https://www.apollographql.com/docs/federation/federation-spec needs to be updated to reflect this for |
Reproduction: https://stackblitz.com/edit/basic-federation-wcgoqe?file=one.js,two.js
This was brought up in the apollo-federation-ruby repo.
You can mix and match import aliases for
@key
and@shareable
, but if you useimport: ["@inaccessible"]
in one subgraph and@federation__inaccessible
in another subgraph, you get this error:From this code, it appears to be a problem with
@tag
too:https://github.com/apollographql/federation/blob/main/composition-js/src/merging/merge.ts#L198-L201
https://github.com/apollographql/federation/blob/main/composition-js/src/merging/merge.ts#L285-L287
https://github.com/apollographql/federation/blob/main/composition-js/src/merging/merge.ts#L292-L322
Expected result
Subgraphs should be able to import all federation directives however they like and be compatible with each other in composition.
The text was updated successfully, but these errors were encountered: