-
- All Implemented Interfaces:
public @interface ComposeDirective
directive @composeDirective(name: String!) repeatable on SCHEMA
By default, Supergraph schema excludes all custom directives. The
@composeDirective
is used to specify custom directives that should be exposed in the Supergraph schema.Example: Given
@custom
directive we can preserve it in the Supergraph schema@GraphQLDirective(name = "custom", locations = [Introspection.DirectiveLocation.FIELD_DEFINITION]) annotation class CustomDirective @ComposeDirective(name = "custom") class CustomSchema class SimpleQuery { @CustomDirective fun helloWorld(): String = "Hello World" }
it will generate following schema
schema @composeDirective(name: "@myDirective") @link(import : ["@composeDirective", "@extends", "@external", "@inaccessible", "@interfaceObject", "@key", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet"], url : "https://specs.apollo.dev/federation/v2.3"){ query: Query } directive @custom on FIELD_DEFINITION type Query { helloWorld: String! @custom }