OSS TanbouSign in with GitHub

generate runtime-free TypeScript types from OpenAPI 3.0 and 3.1 contracts

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
8,391
Primary language
TypeScript
License
MIT
Repository last updated
Sep 25, 2026
On this page

Overview

openapi-typescript converts OpenAPI 3.0/3.1 YAML or JSON schemas into TypeScript types. Local files and remote schemas can produce paths and components definitions that frontends and SDKs use for request and response contracts.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Generate runtime-free types from YAML or JSON OpenAPI schemas

OpenAPI 3.0 and 3.1 schemas can be loaded locally or remotely and converted into TypeScript definitions without adding a runtime library, Java, node-gyp, or a running OpenAPI server.

Sources: [1]

Reference request and response contracts through paths and components

Generated paths and components types expose endpoint parameters, request bodies, responses, and shared schemas for frontend code, mocks, tests, and SDKs.

Sources: [1]

Distinguish read-only and write-only properties in 7.13.0

Version 7.13.0 adds the --read-write-markers flag, wrapping OpenAPI readOnly properties with $Read<T> and writeOnly properties with $Write<T> so request and response shapes can be distinguished.

Sources: [4][3]

Best fit

Fits projects that generate frontend types from an API contract

It is useful when OpenAPI is the source of truth and frontends, mocks, tests, or SDKs should share generated types instead of manually maintained interfaces.

Sources: [1]

Before adoption

Version 7.13.0 requires TypeScript 5.x

Package metadata declares TypeScript ^5.x as a peer dependency. The README recommends Node.js 20.x or newer and documents compatible module and moduleResolution settings.

Sources: [2][1]

Generated types do not validate runtime input

The generated output is TypeScript types, not runtime validation. Network responses or user input that must be checked at runtime need a separate validator, and generated files need to be regenerated when the OpenAPI contract changes.

Sources: [1]

Official sources

  1. [1]openapi-typescript 7.13.0 README(2026-10-05)
  2. [2]openapi-typescript 7.13.0 package metadata(2026-10-05)
  3. [3]openapi-typescript 7.13.0 changelog(2026-10-05)
  4. [4]openapi-typescript 7.13.0 release(2026-10-05)
  5. [5]openapi-typescript MIT license(2026-10-05)
Supplemental curator note

The output is runtime-free TypeScript types, not runtime response validation. Add a runtime schema validator where external input must be checked, and consider regenerating types in CI whenever the OpenAPI contract changes.

Try it in 3 steps

  1. 1

    Install openapi-typescript 7.13.0 with TypeScript

    Follow the official setup with the reviewed openapi-typescript release and a pinned TypeScript 5 compiler.

    demo=$(mktemp -d "${TMPDIR:-/tmp}/openapi-typescript.XXXXXX") && cd "$demo" && npm init -y >/dev/null && npm install --save-exact --save-dev openapi-typescript@7.13.0 typescript@5.9.2
  2. 2

    Create a minimal OpenAPI schema

    Create a local OpenAPI 3.1 YAML document, one of the input formats documented by the project.

    printf "%s\n" "openapi: 3.1.0" "info:" " title: Demo API" " version: 1.0.0" "paths:" " /users/{id}:" " get:" " parameters:" " - in: path" " name: id" " required: true" " schema:" " type: string" " responses:" " '200':" " description: User" " content:" " application/json:" " schema:" " $ref: '#/components/schemas/User'" "components:" " schemas:" " User:" " type: object" " required: [id, name]" " properties:" " id: {type: string}" " name: {type: string}" > openapi.yaml
  3. 3

    Generate TypeScript definitions from the schema

    Run the official CLI and confirm that the generated definitions include the User component.

    npx openapi-typescript ./openapi.yaml -o ./schema.d.ts && grep -q 'User' ./schema.d.ts
Check the official README

Growth

Growth trends · Last 30 days

8,391 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
9
Open PRs
74

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • openapi3
  • openapi3-1
  • openapi
  • swagger
  • typescript
Stars
8,391
Forks
668
Watchers
25
Open issues
210
Contributors
240
Owner type
Organization
Primary language
TypeScript
License
MIT
Repository last updated
Sep 25, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?