federation
federation copied to clipboard
Control join directive usage from the directive definition spec
The primary issue with controlling the use of join directives via identity strings is that any logic relying on the presence of @join__directive
won't work if the affected directive is imported from the federation spec.
More concretely, @link(url: "https://specs.apollo.dev/source/v0.1", import: ["@sourceAPI"])
results in a @join__directive
for each use of @sourceAPI
. In contrast, @link(url: "https://specs.apollo.dev/federation/v2.8", import: ["@sourceAPI"])
does not.
To make the second case work, we don't determine join usage by the URL used in the @link
. Instead, each directive definition spec has a usesJoinDirective
flag which determines this behavior. When we handle @link
usages, composition will use a @join__directive
to capture that link if any of its imports have the usesJoinDirective
flag set. The resulting behavior change is that the supergraph SDL will have a net-new @join__directive
application if any of the @source*
directives are imported from the federation spec instead of the source spec.