Expand description
oapi-codegen — generate idiomatic Rust from OpenAPI 3 specifications.
The pipeline is: load a spec (loader), lower its component schemas into
an intermediate representation (lower::schema → ir) and, for the server
generator, its operations (lower::paths → ir), then emit formatted Rust
source (emit). Config mirrors oapi-codegen’s YAML configuration.
Re-exports§
Modules§
- cli
- Definition of the command-line interface.
- config
- Generator configuration, compatible with
oapi-codegen’s YAML configuration files. - deps
- Computing the external crate dependencies the generated code requires.
- emit
- Emitting the
crate::iras formatted Rust source. - error
- Error types for the generator.
- filter
- Spec-level operation and schema filtering.
- ir
- Intermediate representation (IR) of generated Rust types.
- loader
- Loading OpenAPI documents and resolving
$refs. - lower
- Lowering OpenAPI documents into the intermediate representation (IR).
- naming
- Conversion of OpenAPI names into valid, idiomatic Rust identifiers and derivation of per-operation artifact names.
Enums§
- Drift
- What a comparison of generated code against an output file found.
Functions§
- check_
output - Compare
codewith the content ofoutput_pathand report the difference. - generate
- Generate Rust from a spec file according to
configuration, returning the source. - generate_
models_ string - Generate Rust models from a spec file and return the formatted source.
- generate_
models_ to_ file - Generate Rust models from a spec file and write them to
output_path, creating parent directories as needed. - generate_
to_ file - Generate Rust from a spec file according to
configurationand write it tooutput_path, creating parent directories as needed. - write_
output - Write generated source to
output_path, creating parent directories.