Package 

Annotation KeyDirective


  • 
    public @interface KeyDirective
    
                        
    directive @key(fields: _FieldSet!) on OBJECT | INTERFACE

    The @key directive is used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface. Key directive should be specified on the root base type as well as all the corresponding federated (i.e. extended) types. Key fields specified in the directive field set should correspond to a valid field on the underlying GraphQL interface/object. Federated extended types should also instrument all the referenced key fields with @external directive.

    NOTE: The Federation spec specifies that multiple @key directives can be applied on the field. The GraphQL spec has been recently changed to allow this behavior, but we are currently blocked and are tracking progress in this issue.

    Example: Given

    @KeyDirective(FieldSet("id"))
    class Product(val id: String, val name: String)

    should generate

    type Product @key(fields: "id") {
      id: String!
      name: String!
    }
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final FieldSet fields