You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apollo Federation v2.1 introduced new @composeDirective directive that allows users to specify directives that should be preserved in the supergraph composition (by default composition strips out most directives from supergraph).
extendschema@link(
url: "https://specs.apollo.dev/federation/v2.3",
import: ["@composeDirective", "@extends", "@external", "@key", "@inaccessible", "@interfaceObject", "@override", "@provides", "@requires", "@shareable", "@tag"]
)
@link(url: "https://myspecs.dev/myCustomDirective/v1.0", import: ["@custom"])
@composeDirective(name: "@custom")
// will be present in the supergraph definition
directive @custom on OBJECT
type Product @custom@key(fields: "id")
id: ID!
// other fields omitted for clarity
}
Latest changes from #1060 added support for all new fed definitions.
Technically @composeDirective works - while it is not exposed in the _service { sdl }, users would be publishing to the studio the original schema that contains composed directive. _service { sdl } should only be used in development using local composition (and potentially obtaining a schema in code first libraries).
The reason why @composeDirective doesn't work in _service { sdl } query is due to stripping of all directives from schema which are done here. This logic was necessary for Federation v1 but should be skipped in Federation v2. Federation v2 does not require any filtering of the schema exposed in the _service { sdl } query (there is no need to extend query type either).
Apollo Federation v2.1 introduced new
@composeDirective
directive that allows users to specify directives that should be preserved in the supergraph composition (by default composition strips out most directives from supergraph).Additional resources:
@composeDirective
directive definitionNew directive functionality can be tested using Apollo Federation Subgraph Compatibility NPX script (and Github Action). Example integration project is already provided in the subgraph compatibility testing repository.
The text was updated successfully, but these errors were encountered: