parser option customizes how your OpenAPI specification is parsed and transformed before plugins process it.
Overview
openapi-ts.config.ts
Filters
Filters select a subset of your OpenAPI specification before it’s passed to plugins.object
Filter operations (endpoints) to include or exclude.
object
Filter by OpenAPI tags.
object
Filter schema definitions to include or exclude.
object
Filter parameter definitions.
object
Filter request body definitions.
object
Filter response definitions.
boolean
default:true
Include deprecated resources in the output.Set to
false to exclude all resources marked as deprecated in your OpenAPI specification.boolean
default:false
Keep reusable components without any references from operations in the output.By default, unreferenced schemas are excluded.
boolean
default:false
Preserve key order when processing your input. Disabled by default for performance.
Transforms
Transforms modify or normalize the OpenAPI specification in standardized ways.boolean | string | object
default:false
Control how enums are handled in your specification.Your input might contain two types of enums:
- Root enums: Defined as reusable components
- Inline enums: Nested within other schemas
boolean | object
default:true
Separate schemas for read (response) and write (request) operations.Schemas might contain read-only or write-only fields. This transform creates separate schemas to avoid asking users to provide read-only fields in requests or expecting write-only fields in responses.
boolean
default:false
Treat all object properties as required by default unless explicitly marked as optional.By default (per OpenAPI spec), missing
required keyword means no properties are required. Some specifications expect the opposite behavior.string | function
Rename schema component keys throughout the specification, automatically updating all
$ref pointers.Useful when schema names are auto-generated or follow awkward naming conventions.Pagination
string[]
Array of keywords to identify pagination fields in schemas and parameters.These keywords help plugins detect paginated operations and generate appropriate code.
Validation
boolean | string
default:false
Experimental: Validate the input OpenAPI specification before generating output.This is a lightweight, experimental feature with support added on an ad hoc basis.Options:
false— No validationtrueor'warn'— Validate and warn about issues'strict'— Validate and fail on any issues
Examples
Filter to Specific Tags
openapi-ts.config.ts
Exclude Deprecated Operations
openapi-ts.config.ts
Promote Inline Enums
openapi-ts.config.ts
Custom Schema Naming
openapi-ts.config.ts