Skip to content

angee.graphql.sdl

On-disk GraphQL schema artifact emission, checks, and drift detection.

:class:GraphQLSdl is the schema counterpart of :class:angee.compose.runtime.Runtime: it owns where generated schema artifacts live (runtime/schemas/<name>.graphql and runtime/schemas/<name>.metadata.json), renders them from the discovered :class:~angee.graphql.schema.GraphQLSchemas, and reconciles disk against that render. The schema management command and the dev-serve boot hook (:mod:angee.asgi) both delegate here, so the write/check/drift logic lives once.

GraphQLSdl

python
class GraphQLSdl()

Render, write, and check generated GraphQL artifacts for each schema.

__init__

python
def __init__(schemas: GraphQLSchemas, *, schema_dir: Path) -> None

Create a schema artifact owner over schemas writing under schema_dir.

from_discovery

python
@classmethod
def from_discovery(cls) -> GraphQLSdl

Return a schema artifact owner over discovered schemas and the runtime dir.

render

python
def render() -> dict[str, str]

Return printed SDL per schema name (the single source of truth).

render_metadata

python
def render_metadata() -> dict[str, dict[str, object]]

Return JSON-safe schema metadata per schema name.

emit

python
def emit() -> None

Reconcile the owned schema directory to the rendered schemas.

emit_if_stale

python
def emit_if_stale() -> bool

Reconcile drifted schema artifacts and orphans; return whether any changed.

Mirrors :meth:angee.compose.runtime.Runtime.emit_if_stale: drift-gated, idempotent, and converges the owned directory to the render.

check

python
def check() -> None

Raise when on-disk schema artifacts differ from the render.

Released under the AGPL-3.0 License.