Overview
A type-safe OpenAPI client for complex and large APIs, whose requests follow the document's wire rules exactly.
openapi-chain compiles the serialization rules an OpenAPI document declares (parameter style,
explode, allowReserved and content, request media types, and form and multipart Encoding
Objects) and applies them to every request. A build-time CLI generates types and metadata scoped to
the paths you call. Calls use a fluent path API with no generated endpoint code and no runtime
dependencies.
Start here
Getting started
Install the runtime and CLI, generate types and metadata, and send a first request.
Official CLI
Generate synchronized declarations, scopes and metadata; check drift in CI.
Large schemas
Scope types and runtime metadata to the paths an application calls.
openapi-fetch adapter
Keep openapi-fetch and add strict OpenAPI serialization to its requests.
Choose a client
| Need | Entry point | Runtime schema |
|---|---|---|
| Fluent typed calls with schema-free serialization defaults | openapi-chain → createClient | None |
| OpenAPI parameter styles, structured forms or multipart encoding | openapi-chain/strict → createStrictClient | Compiled metadata |
| Keep openapi-fetch calls with the strict serializer | openapi-chain/openapi-fetch → withOpenAPISerialization | Compiled metadata |
| Compile serialization metadata from an OpenAPI document | openapi-chain/metadata → compileOpenAPIMetadata | OpenAPI 3.0, 3.1 or 3.2 object |
Evidence before claims
The wire comparison executes 20 OpenAPI declarations through openapi-chain and openapi-fetch, and performance records size, request overhead and type-checking cost on synthetic fixtures and the pinned GitHub and Stripe documents.
Reference
API reference
Client options, paths, bodies, errors, extensions and transports.
Support and boundaries
Serialization matrix, metadata inference and platform limits.
Compatibility
Public API, metadata formats, supported toolchains and breaking changes.
Troubleshooting
Common type, serialization, Fetch and response problems.
Packages
| Package | Role |
|---|---|
openapi-chain | Runtime: schema-free core, strict client, metadata compiler and openapi-fetch adapter |
@openapi-chain/cli | Node-only build-time generation of declarations, scopes and metadata |
@openapi-chain/query | Explicit operation query keys and fetchers for TanStack Query and SWR |
These pages are generated from the repository's Markdown documentation. Each page links to its source on GitHub; see contributing to propose a change.
