Skip to main content

generate_package

Function generate_package 

Source
pub fn generate_package(
    spec_path: &Path,
    config: &Config,
    output_path: &Path,
) -> Result<GeneratedPackage>
Expand description

Generate Rust from a spec file according to configuration, returning every file the run produces.

A run that lowers operations splits its output across a module tree: the file at output_path becomes a facade of re-exports, and a companion directory named after that file’s stem holds one module per concern (models, operations, server, client, server_urls) with one file per operation underneath. Every generated name stays reachable from the root file, so a consumer that already mounts it needs no change.

output_path is read for its file stem only, which names that companion directory. Nothing is read from or written to disk here; see write_package and check_package.

A models-only run has no operations to split, so it produces the single file it always has.