API / Apollo Gateway Interview questions
What are entities in Apollo Federation?
An entity is an object type whose data is split across more than one subgraph and identified by a unique key. A classic example is a Product type: the Products subgraph owns most of its fields, but the Reviews subgraph also contributes a computed field like averageRating without owning the rest of the object.
Any subgraph that contributes to an entity it doesn't fully own implements a reference resolver for it, which receives just the key fields and returns the pieces that subgraph is responsible for. The gateway is responsible for stitching all of those contributions back into one object in the final response.
Entities are what make federation more powerful than simple schema namespacing — they let unrelated teams extend the same logical object safely.
More Related questions...