Expand description
The bless step: a vendor’s OpenAPI document and an adopter’s Overlay in, one corrected document and the Rust an adopter compiles against out.
An adoption runs this once per vendor revision and commits everything it writes. That is what makes a vendor change reviewable: the diff after a bless run is the answer to “what did the vendor do?”, in Rust rather than in YAML.
§What it writes
Four artefacts under one directory, all derived from a single Overlay application so that none of them can describe a different API:
spec/<name>.overlaid.yaml— the corrected document, and the reviewable record of what everything below it came from.src/types.rs—components.schemasas Rust types, from typify, with the adopter’s own types substituted whereverSettings::replacesays.src/ops.rs— one typed wrapper per operation, the closedOperationIdset, and the(operationId, method, path)inventory a hand-written operation asserts against.src/model.postcard— that same document already reduced to the facts a command line needs, so a shipped binary parses no YAML and enables no feature that could.
§Using it
typed_openapi::generate::Settings::new("spec/vendor.yaml")
.overlay("spec/corrections.yaml")
.overlay("spec/cli.yaml")
.replace("money", "money::Money")
.write_to("api-generated")?;examples/toy/xtask is that call in a binary, written to be copied.
§Corrections come in layers
Settings::overlay may be called more than once, and the order of the
calls is the order the Overlays are applied: each one corrects the document
the ones before it produced. What an adoption puts in which layer is its
own affair — this crate reads an ordered list of standard Overlay documents
and nothing more. docs/overlay.md recommends a split, and the example
keeps it.
§Every Overlay is applied strictly
overlay::apply uses ErrorOnZeroMatch, so a correction whose target the
vendor has renamed or retyped fails here rather than lapsing quietly. A
correction that stops applying is the loudest thing a vendor revision can
do, and this is where it is heard. The failure names the layer it is in.
Structs§
- Settings
- What a bless step generates, and the two things only the adopter can say.
Enums§
- Generate
Error - Why a bless step stopped.