Skip to main content

Module schema

Module schema 

Source
Expand description

Rustdoc JSON → JSON Schema.

Generation is rooted at #[route] handlers, and handler signatures are monomorphic, so every type reachable from a route is concrete: generics resolve by substitution, wire names come through rustdoc’s preserved attributes — serde’s, or async-graphql’s for the types it serves — and foreign types resolve by canonical path against a table.

Three things stay underivable, and all three are detectable — the extractor never guesses a shape it cannot see:

  • Erased returns (impl Trait, dyn Trait) carry only a bound.
  • Custom serializers (with / serialize_with) define the wire shape in code, so the field’s Rust type stops predicting it.
  • Unmapped foreign types are named exactly but cannot be walked.

Each becomes a Gap and an open schema — imprecise, never wrong.

Re-exports§

pub use docs::Docs;
pub use foreign::TypeMapping;
pub use foreign::TypeTable;
pub use route_sig::Extractors;
pub use route_sig::Overrides;
pub use route_sig::RouteShape;
pub use types::Resolver;

Modules§

docs
The rustdoc documents one resolution runs against.
foreign
Canonical-path → JSON Schema mappings for types outside this crate.
graphql_attrs
async-graphql helper attributes, recovered from rustdoc JSON attrs.
route_sig
Handler signatures → the wire contract they implement.
serde_attrs
serde helper attributes, recovered from rustdoc JSON attrs strings.
types
Rustdoc type nodes → JSON Schema.

Structs§

Extraction
A schema plus everything it referenced and everything it could not see.

Enums§

Gap
A place the extractor could not derive a shape, and why.

Functions§

extract_named
Extract the schema for a named type from a rustdoc JSON document.