0Pricing
GraphQL APIs with Spring Boot · Lesson

Entity References and the @key Directive

Master the heart of Apollo Federation: how subgraphs share entities using the @key directive and resolve references from other subgraphs in Spring Boot.

Entities Span Subgraphs

In federation, a single type like Product can be owned and extended by several subgraphs. The mechanism that lets them agree on the same object is the entity.

What Makes an Entity

An entity is a type with a @key directive. The key names the field(s) that uniquely identify an instance across subgraphs, like a primary key in a database.

type Product @key(fields: "id") {
  id: ID!
  name: String!
}

All lessons in this course

  1. Introduction to Apollo Federation
  2. Building Federated Subgraphs
  3. Gateway Setup and Management
  4. Entity References and the @key Directive
← Back to GraphQL APIs with Spring Boot