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]
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.
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]openapi-typescript 7.13.0 README(2026-10-05)
- [2]openapi-typescript 7.13.0 package metadata(2026-10-05)
- [3]openapi-typescript 7.13.0 changelog(2026-10-05)
- [4]openapi-typescript 7.13.0 release(2026-10-05)
- [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
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
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
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
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
Categories
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
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Valibot9,027 Stars
3 shared tag(s) · 1 shared category(s) · Same language
combine small functions for runtime schema validation with TypeScript type inference
TypeScript - Superstruct7,127 Stars
4 shared tag(s) · 2 shared category(s) · Same language
compose small structs to validate JavaScript and TypeScript data at runtime
TypeScript - io-ts6,814 Stars
4 shared tag(s) · 2 shared category(s) · Same language
decode and encode unknown values with codecs while inferring TypeScript types from the same definitions
TypeScript - Typia5,931 Stars
4 shared tag(s) · 2 shared category(s) · Same language
transform TypeScript types into dedicated runtime validators and serializers at build time
TypeScript - Runtypes2,699 Stars
4 shared tag(s) · 2 shared category(s) · Same language
validate unknown values with composable runtime types and infer TypeScript types from the same definitions
TypeScript - Ky17,104 Stars
4 shared tag(s) · 1 shared category(s) · Same language
extend Fetch API with concise retries, timeouts, hooks, and JSON handling
TypeScript
Report incorrect information
Tell us if any listing information is incorrect or outdated.