Add GraphQL and schema composition
A schema is already a gql::Schema, so composition happens with gql directly: merge,
extend, filter and transform. There is no separate "add schema" step or generated wrapper.
Add an SDL module
extend_sdl prints the current schema, appends the extension, rebuilds and overlays the original
resolvers onto surviving fields. Use extend_sdl_many for a set of documents in one build:
Add resolvers for new fields by reopening the type in Rust:
Merge a schema
A duplicate type must be structurally identical. If both sides set different runtime
implementations for the same slot (resolver, subscribe, complexity, is_type_of,
resolve_type, scalar coercion), the merge fails instead of choosing by argument order.
Resolvers, object type checks and scalar coercion from either side are preserved. Directive applications are compared without regard to order.
Compose from SDL
Schema::from_sdl respects an explicit schema definition and infers default roots only when no
schema definition is present.
Filter a schema
retain_types keeps introspection types and passes every user type to the predicate.
Removing a type that is still referenced is a validation error.
Transform fields
FieldTransform::Replace must keep the field name. A transform that leaves the schema invalid
fails the rebuild with the usual validation errors.
Add directives and types from SDL
To apply a directive from Rust, use Schema::type_directive or the builder methods. See
Directives.
What Add GraphQL does not do
This is schema composition, not Apollo Federation. There is no _entities resolver or subgraph
protocol. Use merge, extend_sdl and transforms to build public/internal schema variants, or
run separate schemas behind separate endpoints.
Rust resolver functions cannot be serialised into SDL. An extension adds fields without resolvers; reopen the object in Rust to install them.
