Skip to main content

Module graphql

Module graphql 

Source
Expand description

GraphQL SDL generated from inferred route shapes.

Unlike the other dialects, this one cannot pass JSON Schema through: SDL is a different type system, not a different serialization. Three mismatches shape the whole module:

  • Inputs and outputs are separate declarations. A struct used as both a request body and a response becomes Item and ItemInput; GraphQL forbids one declaration serving both positions.
  • Nullability lives on the reference, not the object. JSON Schema says required: [id] on the parent; SDL says id: ID! on the field.
  • Not everything crosses. Untagged unions, flattened structs, maps and 64-bit integers have no faithful SDL spelling. Each becomes a note and a JSON (or Int64) custom scalar rather than a quietly wrong type — the same “imprecise, never wrong” rule the extractor follows for gaps.

The document this module builds is a type graph, not SDL text; to_sdl renders it and diff compares two of them. Diffing the graph rather than the text is what lets the gate say “field removed” instead of “line 42 changed”.

Modules§

diff
Compatibility diffing between two generated GraphQL type graphs.

Functions§

document
Assemble a GraphQL type graph.
from_sdl
Parse SDL previously rendered by to_sdl back into a type graph.
to_sdl
Render a generated type graph as GraphQL SDL.