@key directive is used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface.
Multiple keys can be defined on a single object type:
@key, used multiple times) require support by the underlying GraphQL implementation.
@provides directive is used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway. Given the following example:
Review.product from the Reviews service, it is possible to request the
name with the expectation that the Reviews service can provide it when going from review to product.
Product.name is an external field on an external type which is why the local type extension of
Product and annotation of
name is required. “””
@requires directive is used to annotate the required input fieldset from a base type for a resolver. It is used to develop a query plan where the required fields may not be needed by the client, but the service may need additional information from other services. For example:
In this case, the Reviews service adds new capabilities to the
User type by providing a list of
reviews related to a user. In order to fetch these reviews, the Reviews service needs to know the
User from the Users service in order to look up the reviews. This means the
reviews field / resolver requires 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. For example:
This type extension in the Reviews service extends the
User type from the Users service. It extends it for the purpose of adding a new field called
reviews, which returns a list of
A set of fields.
Deeply nested fields are supported with standard GraphQL syntax
Field arguments are not supported.