Produce a schema-only module, drop the client implementation, keep JSDoc, or format output.
The main output is one generated TypeScript file. These switches make that file fit a library, a shared-contract package, or a code-review workflow.
| Goal | Setting |
|---|---|
| Runtime contracts only | schemasOnly: true |
| Endpoint types but no client implementation | includeClient: false |
| Smaller generated diff | jsdoc: false |
| Stable formatting before review | format: true |
Emit schemas only
Section titled “Emit schemas only”Use this for a validation package that should not expose client methods.
pnpm exec typed-openapi openapi.yaml \ --runtime zod \ --schemas-only \ --output src/contracts/schemas.tsKeep endpoint types but remove implementation
Section titled “Keep endpoint types but remove implementation”--include-client defaults to true. Disable it when another layer owns the transport implementation but still needs generated endpoint types.
import { defineConfig } from "typed-openapi";
export default defineConfig({ input: "./openapi.yaml", output: "./src/contracts/openapi.ts", includeClient: false,});Preserve OpenAPI explanations in editors
Section titled “Preserve OpenAPI explanations in editors”OpenAPI descriptions become JSDoc by default. Disable JSDoc when output size is more important than generated hover help.
export default defineConfig({ input: "./openapi.yaml", jsdoc: false,});Format checked-in output
Section titled “Format checked-in output”Use --format so generated files are formatted with oxfmt before a diff or commit.
pnpm exec typed-openapi openapi.yaml --format --output src/api/openapi.ts--tanstack, --msw, and --default-fetcher each write a nearby companion file unless you pass an explicit relative or absolute output path. A relative companion name is resolved from the main output’s directory: with --output src/api/openapi.ts, --tanstack query.ts writes src/api/query.ts, while --msw ../mocks/handlers.ts writes src/mocks/handlers.ts.
Keep companion paths explicit in shared configs. It makes imports and code-review diffs predictable when a project has more than one generated client.