Skip to content

Control generated files

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.

GoalSetting
Runtime contracts onlyschemasOnly: true
Endpoint types but no client implementationincludeClient: false
Smaller generated diffjsdoc: false
Stable formatting before reviewformat: true

Use this for a validation package that should not expose client methods.

Terminal window
pnpm exec typed-openapi openapi.yaml \
--runtime zod \
--schemas-only \
--output src/contracts/schemas.ts

Keep 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.

typed-openapi.config.ts
import { defineConfig } from "typed-openapi";
export default defineConfig({
input: "./openapi.yaml",
output: "./src/contracts/openapi.ts",
includeClient: false,
});

OpenAPI descriptions become JSDoc by default. Disable JSDoc when output size is more important than generated hover help.

typed-openapi.config.ts
export default defineConfig({
input: "./openapi.yaml",
jsdoc: false,
});

Use --format so generated files are formatted with oxfmt before a diff or commit.

Terminal window
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.