Skip to main content

GeneratorConfig

Struct GeneratorConfig 

Source
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: String

Output directory for generated files. Required — the generator writes all files relative to this path. Created automatically if it doesn’t exist.

§layout: OutputLayout

How files are organized on disk. Default: modular.

  • bundled — single file containing all types, client, and SSE utilities
  • modular — separate files per concern (types, client, sse, index)
  • split — separate files per operation group (see split_by)
§split_by: Option<SplitBy>

Only used when layout: split. Controls how operations are grouped into files.

  • tag (default) — one file per OpenAPI tag
  • operation — one file per operation
  • route — 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: String

Subdirectory 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 for package.json
  • existing_repo — skip all scaffold files, only emit source + root index
  • formatter"biome" or false to disable (default: "biome")
  • test_runner"vitest" or false to disable (default: "vitest")
  • bundler"tsdown" or false to disable (default: "tsdown")

Python generator (fastapi-server):

  • package_name — Python package name for pyproject.toml
  • formatter"ruff" or false to disable (default: "ruff")
  • test_runner"pytest" or false to disable (default: "pytest")

All generators:

  • extra_dev_dependencies — map of additional dev dependency names to version specs, merged into the generated devDependencies (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

Source§

fn clone(&self) -> GeneratorConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GeneratorConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GeneratorConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GeneratorConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,