Internal Entities

Defining an entity that is internal is quite straight-forward, it is almost the same as in traditional GraphQL.

type User @key(fields: "id") {
  id: String!
  name: String!

type Query {
  userById(id:String!) : User

When federation is enabled, a number of new directives are automatically available, including @key, which defines the primary key, or primary keys, for the entity.

The above example would be the schema for a users service that can be extended by other services.