@key directive, then register a reference resolver that
rehydrates an entity from its key fields.
Marking a type as an entity
Usekey(fields) from fastql.federation:
@key directives if more than one key combination is
supported.
Registering a reference resolver
@reference_resolver(Type) (or register_reference) registers how to rehydrate
an entity from its representation dict. The resolver receives the raw key fields as
a dict and returns the resolved entity (or None).
_entities(representations:) root
field and returns resolved entities in request order.
Composite keys
Composite@key directives use a space-separated field list:
Per-key exceptions
If a single key cannot be resolved, the resolver may returnNone or raise an
exception — the error is isolated to that entity slot and does not fail the rest of
the _entities response.
Previous: Overview — setup and directives. Next: Custom federation directives —
@external, @requires, and more.