pub struct GeneratorConfig {
pub output: String,
pub layout: OutputLayout,
pub split_by: Option<SplitBy>,
pub base_url: Option<String>,
pub no_jsdoc: Option<bool>,
pub source_dir: String,
pub scaffold: Option<Value>,
}Expand description
Configuration for a single generator.
Each entry in the generators map deserializes into this struct. All fields
except output have sensible defaults so a minimal config only needs the
output directory.
§TypeScript-only fields
base_url, no_jsdoc, and source_dir only affect the TypeScript generators
(node-client and react-swr-client). They are silently ignored by fastapi-server.
§Scaffold
The scaffold field is an opaque JSON object forwarded to the generator.
Each generator defines its own scaffold struct (e.g., package name, formatter,
test runner, bundler). See the default config for available scaffold options.
Fields§
§output: StringOutput directory for generated files. Required — the generator writes all files relative to this path. Created automatically if it doesn’t exist.
layout: OutputLayoutHow files are organized on disk. Default: modular.
bundled— single file containing all types, client, and SSE utilitiesmodular— separate files per concern (types, client, sse, index)split— separate files per operation group (seesplit_by)
split_by: Option<SplitBy>Only used when layout: split. Controls how operations are grouped into files.
tag(default) — one file per OpenAPI tagoperation— one file per operationroute— one file per route prefix
base_url: Option<String>Override the API base URL instead of reading it from the spec’s servers array.
Only affects TypeScript generators. Useful when the spec doesn’t include a server
or you need a different URL for development.
no_jsdoc: Option<bool>Disable JSDoc comments on generated types and methods. Default: false.
Only affects TypeScript generators.
source_dir: StringSubdirectory within output for generated source files. Default: "src".
The scaffold’s tsconfig.json and tsdown.config.ts adapt automatically.
Set to "" to place source files directly at the output root.
Only affects TypeScript generators.
scaffold: Option<Value>Opaque scaffold configuration forwarded to the generator. Each generator defines its own scaffold options:
TypeScript generators (node-client, react-swr-client):
package_name— npm package name (default: derived from spec title)repository— repository URL forpackage.jsonexisting_repo— skip all scaffold files, only emit source + root indexformatter—"biome"orfalseto disable (default:"biome")test_runner—"vitest"orfalseto disable (default:"vitest")bundler—"tsdown"orfalseto disable (default:"tsdown")
Python generator (fastapi-server):
package_name— Python package name forpyproject.tomlformatter—"ruff"orfalseto disable (default:"ruff")test_runner—"pytest"orfalseto disable (default:"pytest")
All generators:
extra_dev_dependencies— map of additional dev dependency names to version specs, merged into the generateddevDependencies(npm) or[dependency-groups] dev(Python). Example:{ "@testing-library/react": "^16.0" }for npm,{ "factory-boy": ">=3.3" }for Python.
Set to false to explicitly disable all scaffolding. Omitting the field
entirely also disables scaffolding.
Trait Implementations§
Source§impl Clone for GeneratorConfig
impl Clone for GeneratorConfig
Source§fn clone(&self) -> GeneratorConfig
fn clone(&self) -> GeneratorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more