-
- All Implemented Interfaces:
public @interface ExternalDirective
# federation v1 definition directive @external on FIELD_DEFINITION # federation v2 definition directive @external on OBJECT | FIELD_DEFINITION
The @external directive is used to mark a field as owned by another service. This allows service A to use fields from service B while also knowing at runtime the types of that field. @external directive is only applicable on federated extended types. All the external fields should either be referenced from the @key, @requires or @provides directives field sets.
Due to the smart merging of entity types,
@external
directive is no longer required on@key
fields and can be omitted from the schema.@external
directive is only required on fields referenced by the@requires
and@provides
directive.Example: Given
@KeyDirective(FieldSet("id")) @ExtendsDirective class Product(@ExternalDirective val id: String) { fun newFunctionality(): String = "whatever" }
should generate
type Product @extends @key(fields : "id") { id: String! @external newFunctionality: String! }