output option controls where generated files are written and how they’re formatted.
Basic Usage
The simplest form is a string path:openapi-ts.config.ts
openapi-ts.config.ts
Output Options
string
required
The absolute or relative path to the output folder where generated files will be written.
boolean
default:true
Clean the output folder before generating new files.When enabled, the entire output directory is deleted before generation. If disabled, new files are written alongside existing files, which may be useful if you’re storing additional custom files in the output directory.
boolean
default:true
Generate an entry file (typically
index.ts) that re-exports symbols from other generated files.This provides a single import point for consumers:array
default:[]
Post-processing commands to run on the output folder, executed in order.Use preset strings for common tools, or provide custom configurations.Available presets:
'biome:format'— Format with Biome'biome:lint'— Lint with Biome'eslint'— Lint and fix with ESLint'oxfmt'— Format with Oxfmt'oxlint'— Lint and fix with Oxlint'prettier'— Format with Prettier
The
{{path}} placeholder is replaced with the output directory path.string
Defines casing of output fields. By default, we preserve input values as data transforms incur a performance penalty at runtime.Options:
'camelCase', 'PascalCase', 'snake_case', 'preserve'string | object
Transform file names before they are created.
boolean
default:false
Use
export * from 'module' instead of named exports when possible.This can reduce bundle size but may affect tree-shaking.string
File extension to use when importing other modules. By default, no extension is added.If you’re using Generated imports will look like:
moduleResolution: "nodenext" or "node16", this defaults to .js.string
Path to the
tsconfig.json file to use for generating output.If not provided, we attempt to find one starting from the config file location and traversing up.string | function
Text to include at the top of every generated file.
boolean | object
default:false
Generate a copy of the input OpenAPI specification alongside the output.Set to
true to use defaults, or provide a configuration object.Deprecated Options
string
default:null
Deprecated: Use
postProcess instead.Which formatter to use: 'biome' or 'prettier'.string
default:null
Deprecated: Use
postProcess instead.Which linter to use: 'biome', 'eslint', or 'oxlint'.boolean
default:true
Deprecated: Use
entryFile instead.Generate an index file that re-exports symbols.Multiple Outputs
Generate multiple outputs from the same input:openapi-ts.config.ts
openapi-ts.config.ts
Post-Processing
ThepostProcess option runs commands after files are generated. This is useful for formatting and linting:
openapi-ts.config.ts
{{path}} is replaced with the output directory: