# @0x-jerry/openapi-ts

> This package provide a quick way to transform OpenAPI schema or Swagger schema to client typescript code.

Latest version **2.0.5** (published 2026-04-28) · 0 weekly downloads

## Install

```sh
npm install @0x-jerry/openapi-ts
pnpm add @0x-jerry/openapi-ts
yarn add @0x-jerry/openapi-ts
bun add @0x-jerry/openapi-ts
```

Provides the command `o2ts`.

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2026-04-28 |
| First published | 2023-12-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 10 |
| Unpacked size | 25.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Maintainers | cwxyz |

## Links

- npm: https://www.npmjs.com/package/@0x-jerry/openapi-ts
- Repository: https://github.com/0x-jerry/openapi-ts
- Homepage: https://github.com/0x-jerry/openapi-ts#readme
- Issues: https://github.com/0x-jerry/openapi-ts/issues
- npm.io page: https://npm.io/package/@0x-jerry/openapi-ts

## Dependencies (10)

- [ora](https://npm.io/package/ora.md) ^9.4.0
- [memfs](https://npm.io/package/memfs.md) ^4.57.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.3.4
- [prettier](https://npm.io/package/prettier.md) ^3.8.3
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.18.1
- [@0x-jerry/utils](https://npm.io/package/@0x-jerry/utils.md) ^6.4.2
- [swagger2openapi](https://npm.io/package/swagger2openapi.md) ^7.0.8
- [@0x-jerry/silver](https://npm.io/package/@0x-jerry/silver.md) ^1.2.4
- [openapi-typescript](https://npm.io/package/openapi-typescript.md) ^7.13.0
- [json-schema-to-typescript](https://npm.io/package/json-schema-to-typescript.md) ^15.0.4

## Recent versions

- 2.0.5 (latest) — 2026-04-28
- 2.0.3 — 2025-08-18
- 2.0.2 — 2025-08-18
- 2.0.1 — 2025-08-18
- 2.0.0 — 2025-08-18
- 1.5.0 — 2024-11-05
- 1.4.4 — 2024-09-14
- 1.4.3 — 2024-09-14
- 1.4.2 — 2024-09-14
- 1.4.0 — 2024-09-13
- 1.3.0 — 2024-07-18
- 1.2.2 — 2024-03-23
- 1.2.0 — 2024-03-23
- 1.1.2 — 2024-02-12
- 1.1.1 — 2024-02-10
- … 5 more at https://npm.io/package/@0x-jerry/openapi-ts/versions

## README

# OpenAPI Code Generator

This package provide a quick way to transform OpenAPI schema or Swagger schema to client typescript code.

## Usage

1. Generate client typescript code

```ts
import { generate } from '@0x-jerry/openapi-ts'

const apiUrl = 'http://doc-url/api-docs'

const swaggerSchema = await (await fetch(apiUrl)).json()

await generate({
  schema: swaggerSchema,
  output: 'api',
  format: true,
  clean: true,
  adapter: 'axios'
})
```

2. Change adapter file `api/_adapter.ts` to suit your needs.

3. Use generated code

```ts
import * as api from './api/generated'

const resp = await api.segment.to.path.$get({...})
```

---
_Source: https://npm.io/package/@0x-jerry/openapi-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
