# openapi3-ts

> TS Model & utils for OpenAPI 3.x specification.

Latest version **4.6.1** (published 2026-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install openapi3-ts
pnpm add openapi3-ts
yarn add openapi3-ts
bun add openapi3-ts
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.6.1 |
| Published | 2026-07-28 |
| First published | 2017-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 251.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 540 |
| Author | Pedro J. Molina / Metadev |
| Maintainers | pjmolina |
| Keywords | openapi3, ts, typescript |

## Links

- npm: https://www.npmjs.com/package/openapi3-ts
- Repository: https://github.com/metadevpro/openapi3-ts
- Homepage: https://github.com/metadevpro/openapi3-ts#readme
- Issues: https://github.com/metadevpro/openapi3-ts/issues
- npm.io page: https://npm.io/package/openapi3-ts

## Dependencies (1)

- [yaml](https://npm.io/package/yaml.md) ^2.9.0

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 4.6.1 (latest) — 2026-07-28
- 4.6.0 — 2026-06-01
- 4.5.0 — 2025-06-24
- 4.4.0 — 2024-08-27
- 4.3.3 — 2024-06-10
- 4.3.2 — 2024-05-23
- 4.3.1 — 2024-04-01
- 4.3.0 — 2024-04-01
- 4.2.2 — 2024-02-22
- 4.2.1 — 2023-12-22
- 4.2.0 — 2023-12-20
- 4.1.2 — 2023-04-25
- 4.1.1 — 2023-04-15
- 4.1.0 — 2023-04-14
- 4.0.4 — 2023-04-10
- … 38 more at https://npm.io/package/openapi3-ts/versions

## README

# OpenApi3-TS

TypeScript library to help building OpenAPI 3.x compliant API contracts.

[![Coverage Status](https://coveralls.io/repos/github/metadevpro/openapi3-ts/badge.svg?branch=master)](https://coveralls.io/github/metadevpro/openapi3-ts?branch=master)
[![Known Vulnerabilities](https://snyk.io/test/github/metadevpro/openapi3-ts/badge.svg?targetFile=package.json)](https://snyk.io/test/github/metadevpro/openapi3-ts?targetFile=package.json)
[![npm version](https://badge.fury.io/js/openapi3-ts.svg)](http://badge.fury.io/js/openapi3-ts)

[![NPM](https://nodei.co/npm/openapi3-ts.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/openapi3-ts/)

## Version 4

_Breaking change notice:_

Version 4.0 Adds explicit support for OAS 3.0 and OAS 3.1 as separate implementations.

OAS 3.2 is available as a third parallel implementation (`oas32`). The JSON Schema dialect is unchanged between 3.1 and 3.2 (Draft 2020-12); 3.2 adds document-structure fields such as streaming `itemSchema`/`itemEncoding`/`prefixEncoding` on the Media Type Object, the reusable `mediaTypes` component bucket, the `query` HTTP method and `additionalOperations`, Tag hierarchies, the XML `nodeType`, and the OAuth device authorization flow.

### To use version 3.2 import

```js
import { oas32 } from 'openapi3-ts';
```

Or directly import from subpath:

```js
import { OpenAPIObject, OpenApiBuilder } from 'openapi3-ts/oas32';
```

### To use version 3.1 import

```js
import { oas31 } from 'openapi3-ts';
```

Or directly import from subpath:

```js
import { OpenAPIObject, OpenApiBuilder } from 'openapi3-ts/oas31';
```

### To use version 3.0 import

```js
import { oas30 } from 'openapi3-ts';
```

Or directly import from subpath:

```js
import { OpenAPIObject, OpenApiBuilder } from 'openapi3-ts/oas30';
```

## Includes

- `/src/model` TS typed interfaces for helping building a contract.
- `/src/dsl` Fluent DSL for building a contract.

## Install

Install package via **npm**:

```bash
npm i --save openapi3-ts
```

## Documentation, Versions, and Changelog

- [Documentation](docs/index.md).
- See [changelog](Changelog.md) for version and changes.

## References

- OpenAPI spec 3.2.0. [https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.2.0.md](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.2.0.md)
- OpenAPI spec 3.1.0. [https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md)

## License

Licensed under the MIT License.

## Credits

**Contact:** Pedro J. Molina | github: [pjmolina](https://github.com/pjmolina) | twitter: [pmolinam](https://twitter.com/pmolinam)

(c) 2017-2026. [Pedro J. Molina](http://pjmolina.com) at Metadev S.L. [https://metadev.pro](https://metadev.pro) & contributors.

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