API / Apollo Gateway Interview questions
What is the difference between Federation 1 and Federation 2?
Federation 2 is a compatible evolution of Federation 1, but it changes several composition rules and adds directives that make common cross-subgraph patterns safer to express.
| Federation 1 | Federation 2 |
| Entities defined with a "base" type in one subgraph, extended via @extends elsewhere | Any subgraph can declare the full entity shape directly with @key, no @extends needed |
| No @shareable - duplicate field definitions across subgraphs could silently misbehave | @shareable makes intentional field duplication explicit and safe |
| No purpose-built field migration directive | @override lets you migrate a field's ownership cleanly |
| No @interfaceObject support | @interfaceObject lets a subgraph extend an interface without knowing every implementing type |
Federation 2 composition also gives more precise, actionable error messages, and a subgraph opts in simply by adding an @link directive — there's no full rewrite required, and Federation 1 and 2 subgraphs can even coexist in the same supergraph during a gradual migration.
More Related questions...