# @hey-api/spec-types

> 📃 TypeScript definitions for OpenAPI and JSON Schema specifications with complete inline documentation.

Latest version **0.2.0** (published 2026-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hey-api/spec-types
pnpm add @hey-api/spec-types
yarn add @hey-api/spec-types
bun add @hey-api/spec-types
```

## Health

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

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2026-04-13 |
| First published | 2026-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 308.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5421 |
| Author | Hey API |
| Maintainers | mrlubos |
| Keywords | api-types, definitions, documentation, intellisense, jsdoc, json, json-schema, json-schema-draft-2020-12, json-schema-draft-4, jsonschema, openapi, openapi-2.0, openapi-3.0, openapi-3.1, openapi-types, schema, spec, specification, swagger, swagger-2.0, type-definitions, types, typescript |

## Links

- npm: https://www.npmjs.com/package/@hey-api/spec-types
- Repository: https://github.com/hey-api/openapi-ts
- Homepage: https://heyapi.dev/
- Issues: https://github.com/hey-api/openapi-ts/issues
- Funding: https://github.com/sponsors/hey-api
- npm.io page: https://npm.io/package/@hey-api/spec-types

## Dependencies (1)

- [@hey-api/types](https://npm.io/package/@hey-api/types.md) 0.1.4

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.0 (latest) — 2026-04-13
- 0.0.0-next-20260824173136 (next) — 2026-08-24
- 0.0.0-next-20260819153534 — 2026-08-19
- 0.0.0-next-20260813201118 — 2026-08-13
- 0.0.0-next-20260811214609 — 2026-08-11
- 0.0.0-next-20260804175203 — 2026-08-04
- 0.0.0-next-20260803133142 — 2026-08-03
- 0.0.0-next-20260803131638 — 2026-08-03
- 0.0.0-next-20260803105733 — 2026-08-03
- 0.0.0-next-20260803085119 — 2026-08-03
- 0.0.0-next-20260729142554 — 2026-07-29
- 0.0.0-next-20260728215008 — 2026-07-28
- 0.0.0-next-20260724070045 — 2026-07-24
- 0.0.0-next-20260723124023 — 2026-07-23
- 0.0.0-next-20260722143429 — 2026-07-22
- … 27 more at https://npm.io/package/@hey-api/spec-types/versions

## README

<div align="center">
  <img alt="Hey API presents openapi-ts" height="214" src="https://heyapi.dev/assets/.gen/openapi-ts-hero-640w.png" width="438">
  <h1><b>Spec Types</b></h1>
  <p>TypeScript definitions for OpenAPI and JSON Schema specifications with complete inline documentation.</p>
</div>

<p align="center">
  <a href="https://www.devtrends.dev/trends?c=v1.kZIBzQM2"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fspec-types?period=month&style=flat&view=value" alt="DevTrends badge for @hey-api/spec-types" /></a>
  <a href="https://www.devtrends.dev/trends?c=v1.kZIBzQM2&v=change"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fspec-types?period=year&style=flat&view=change" alt="DevTrends badge for @hey-api/spec-types" /></a>
  <a href="https://github.com/hey-api/openapi-ts/actions?query=branch%3Amain"><img src="https://github.com/hey-api/openapi-ts/actions/workflows/ci.yml/badge.svg?event=push&branch=main" alt="CI status" /></a>
  <a href="https://github.com/hey-api/openapi-ts"><img src="https://img.shields.io/github/stars/hey-api/openapi-ts?style=flat&logo=github&label=GitHub&color=54C82D" alt="GitHub stars" /></a>
  <a href="https://github.com/hey-api/openapi-ts/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/hey-api/openapi-ts" alt="MIT License"></a>
</p>

<p align="center">
  <a href="https://heyapi.dev">Manual</a>
  <span>&nbsp;•&nbsp;</span>
  <a href="https://github.com/hey-api/openapi-ts/issues">Issues</a>
  <span>&nbsp;•&nbsp;</span>
  <a href="https://heyapi.dev/openapi-ts/community/contributing">Contribute</a>
</p>

## About

TypeScript definitions for OpenAPI and JSON Schema specifications with complete inline documentation.

Part of the Hey API ecosystem.

## Features

- OpenAPI 2.0 (Swagger), 3.0, and 3.1 specifications
- JSON Schema Draft 4 and Draft 2020-12
- inline JSDoc on every property
- zero runtime footprint, types only

<!-- template-contributing-start -->

## Contributing

Want to see your code in products used by millions?

Start with our [Contributing](https://heyapi.dev/openapi-ts/community/contributing) guide and release your first feature.

<!-- template-contributing-end -->

<!-- template-sponsors-start -->

## Sponsors

Hey API is sponsor-funded. If you rely on Hey API in production, consider becoming a [sponsor](https://github.com/sponsors/hey-api) to accelerate the roadmap.

<h3 align="center">Gold</h3>

<table align="center" style="justify-content: center;align-items: center;display: flex;">
  <tbody>
    <tr>
      <td align="center" width="336px">
        <p></p>
        <p>
          <a href="https://kutt.to/pkEZyc" target="_blank">
            <picture height="50px">
              <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/.gen/stainless-logo-wordmark-480w.jpeg">
              <img alt="Stainless logo" height="50px" src="https://heyapi.dev/assets/.gen/stainless-logo-wordmark-480w.jpeg">
            </picture>
          </a>
          <br/>
          Best-in-class developer interfaces for your API.
          <br/>
          <a href="https://kutt.to/pkEZyc" style="text-decoration:none;" target="_blank">
            stainless.com
          </a>
        </p>
        <p></p>
      </td>
      <td align="center" width="336px">
        <p></p>
        <p>
          <a href="https://kutt.to/QM9Q2N" target="_blank">
            <picture height="50px">
              <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/opencode/logo-light.svg">
              <img alt="Opencode logo" height="50px" src="https://heyapi.dev/assets/opencode/logo-dark.svg">
            </picture>
          </a>
          <br/>
          The open source coding agent.
          <br/>
          <a href="https://kutt.to/QM9Q2N" style="text-decoration:none;" target="_blank">
            opencode.ai
          </a>
        </p>
        <p></p>
      </td>
    </tr>
  </tbody>
</table>

<h3 align="center">Silver</h3>

<table align="center" style="justify-content: center;align-items: center;display: flex;">
  <tbody>
    <tr>
      <td align="center" width="172px">
        <a href="https://kutt.to/skQUVd" target="_blank">
          <picture height="40px">
            <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/scalar/logo-light.svg">
            <img alt="Scalar logo" height="40px" src="https://heyapi.dev/assets/scalar/logo-dark.svg">
          </picture>
        </a>
        <br/>
        <a href="https://kutt.to/skQUVd" style="text-decoration:none;" target="_blank">
          scalar.com
        </a>
      </td>
      <td align="center" width="172px">
        <a href="https://kutt.to/Dr9GuW" target="_blank">
          <picture height="40px">
            <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/fastapi/logo-light.svg">
            <img alt="FastAPI logo" height="40px" src="https://heyapi.dev/assets/fastapi/logo-dark.svg">
          </picture>
        </a>
        <br/>
        <a href="https://kutt.to/Dr9GuW" style="text-decoration:none;" target="_blank">
          fastapi.tiangolo.com
        </a>
      </td>
    </tr>
  </tbody>
</table>

<h3 align="center">Bronze</h3>

<table align="center" style="justify-content: center;align-items: center;display: flex;">
  <tbody>
    <tr>
      <td align="center" width="136px">
        <a href="https://kutt.to/YpaKsX" target="_blank">
          <picture height="34px">
            <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/.gen/kinde-logo-wordmark-dark-480w.webp">
            <img alt="Kinde logo" height="34px" src="https://heyapi.dev/assets/.gen/kinde-logo-wordmark-480w.jpeg">
          </picture>
        </a>
      </td>
      <td align="center" width="136px">
        <a href="https://kutt.to/KkqSaw" target="_blank">
          <picture height="34px">
            <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/cella/logo-light.svg">
            <img alt="Cella logo" height="34px" src="https://heyapi.dev/assets/cella/logo-dark.svg">
          </picture>
        </a>
      </td>
    </tr>
  </tbody>
</table>
<!-- template-sponsors-end -->

## Installation

You can download `@hey-api/spec-types` from npm using your favorite package manager.

#### npm

```sh
npm add @hey-api/spec-types -D -E
```

#### pnpm

```sh
pnpm add @hey-api/spec-types -D -E
```

#### yarn

```sh
yarn add @hey-api/spec-types -D -E
```

#### bun

```sh
bun add @hey-api/spec-types -D -E
```

## Usage

### OpenAPI

Hover over any property to see its definition from the specification.

```ts
import type { OpenAPIV3_1 } from '@hey-api/spec-types';

const doc = {
  openapi: '3.1.2',
  info: {
    title: 'My OpenAPI document',
    version: '1.0.0',
  },
} satisfies OpenAPIV3_1.Document;
```

### JSON Schema

Full type coverage for Draft 4 and Draft 2020-12 schemas.

```ts
import type { JSONSchemaDraft2020_12 } from '@hey-api/spec-types';

const doc = {
  properties: {
    foo: {
      type: 'string',
    },
  },
  type: 'object',
} satisfies JSONSchemaDraft2020_12.Document;
```

<!-- template-license-start -->

## License

Released under the [MIT License](https://github.com/hey-api/openapi-ts/blob/main/LICENSE.md).

<!-- template-license-end -->

---
_Source: https://npm.io/package/@hey-api/spec-types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
