Skip to main content

Crate semiont_codegen

Crate semiont_codegen 

Source
Expand description

Build-time generation from specs/src, for the build scripts of the crates that embed or type the spec: the documents bundled whole, and Rust types from their component schemas. One generator, so the SDK’s protocol types and a service’s own types cannot be generated two ways.

Modules§

bundle
Bundling specs/src into whole documents: every file $ref followed, each file the root document lists under components named by its component and the rest inlined, as the published bundles are, and the component schemas as JSON Schema draft 7.
types
Rust types from component schemas (JSON Schema draft 7, as draft7_definitions writes them): a struct per object, an enum per string enumeration, an untagged enum per oneOf or anyOf, an alias per named string, a type of its own per kind of id, a field per property, optional where the schema does not require it. It knows the shapes the spec’s schemas use and refuses any other, so a schema that grows a new shape fails the build rather than generating something wrong.