Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🌀 OpenAPI to TypeScript codegen. Production-ready SDKs, Zod schemas, TanStack Query hooks, and 20+ plugins. Used by Vercel, OpenCode, and PayPal.

License

NotificationsYou must be signed in to change notification settings

hey-api/openapi-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7,125 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hey API presents openapi-ts

OpenAPI TypeScript

“OpenAPI codegen that just works.”
— Guillermo Rauch, CEO of Vercel

DevTrends badge for @hey-api/openapi-tsDevTrends badge for @hey-api/openapi-tsCI statusGitHub starsMIT License

Demo • Manual • Issues • Contribute

About

The OpenAPI to TypeScript code generator used by Vercel, OpenCode, and PayPal.

Generate production-ready SDKs, Zod schemas, TanStack Query hooks, or choose from 20+ other plugins.

Part of the Hey API ecosystem.

Features

  • production-ready code that compiles
  • runs in any Node.js 20+ environment
  • accepts any OpenAPI specification
  • core plugins for SDKs, types, and schemas
  • HTTP clients for Fetch API, Angular, Axios, Next.js, Nuxt, and more
  • 20+ plugins to reduce third-party boilerplate
  • highly customizable via plugins
  • sync with Hey API Registry for spec management

Contributing

Want to see your code in products used by millions?

Start with ourContributing guide and release your first feature.

Sponsors

Hey API is sponsor-funded. If you rely on Hey API in production, consider becoming asponsor to accelerate the roadmap.

Gold

Stainless logo
Best-in-class developer interfaces for your API.
stainless.com

Opencode logo
The open source coding agent.
opencode.ai

Mintlify logo
The intelligent knowledge platform.
mintlify.com

Silver

Scalar logo
scalar.com
FastAPI logo
fastapi.tiangolo.com

Bronze

Kinde logoCella logo

Quick Start

The fastest way to use@hey-api/openapi-ts is via npx

npx @hey-api/openapi-ts -i hey-api/backend -o src/client

Congratulations on creating your first client! 🎉 You can learn more about the generated files on theOutput page.

Installation

You can download@hey-api/openapi-ts from npm using your favorite package manager.

npm

npm install @hey-api/openapi-ts -D -E

pnpm

pnpm add @hey-api/openapi-ts -D -E

yarn

yarn add @hey-api/openapi-ts -D -E

bun

bun add @hey-api/openapi-ts -D -E

Versioning

This package is ininitial development. Please pin an exact version so you can safely upgrade when you're ready.

We publishmigration notes for every breaking release. You might not be impacted by a breaking change if you don't use the affected features.

Usage

CLI

Most people run@hey-api/openapi-ts via CLI. To do that, add a script to yourpackage.json file which will makeopenapi-ts executable through script.

"scripts": {"openapi-ts":"openapi-ts"}

The above script can be executed by runningnpm run openapi-ts or equivalent command in other package managers. Next, we will create aconfiguration file and move our options from Quick Start to it.

Node.js

You can also generate output programmatically by callingcreateClient() in a JavaScript/TypeScript file.

script.ts

import{createClient}from'@hey-api/openapi-ts';createClient({input:'hey-api/backend',// sign up at app.heyapi.devoutput:'src/client',});

Configuration

@hey-api/openapi-ts supports loading configuration from any file inside your project root folder supported byjiti loader. Below are the most common file formats.

openapi-ts.config.ts

import{defineConfig}from'@hey-api/openapi-ts';exportdefaultdefineConfig({input:'hey-api/backend',// sign up at app.heyapi.devoutput:'src/client',});

openapi-ts.config.cjs

/**@type {import('@hey-api/openapi-ts').UserConfig} */module.exports={input:'hey-api/backend',// sign up at app.heyapi.devoutput:'src/client',};

openapi-ts.config.mjs

/**@type {import('@hey-api/openapi-ts').UserConfig} */exportdefault{input:'hey-api/backend',// sign up at app.heyapi.devoutput:'src/client',};

Alternatively, you can useopenapi-ts.config.js and configure the export statement depending on your project setup.

Input

You must set the input so we can load your OpenAPI specification. It can be a path or URL, object containing a path or URL, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats.

If you use an HTTPS URL with a self-signed certificate in development, you will need to setNODE_TLS_REJECT_UNAUTHORIZED=0 in your environment.

Output

You must set the output so we know where to generate your files. It can be a path to the destination folder or an object containing the destination folder path and optional settings.

You should treat the output folder as a dependency. Do not directly modify its contents as your changes might be erased when you run@hey-api/openapi-ts again.

Parser

We parse your input before making it available to plugins. While configuring the parser is optional, it's the perfect place to modify or validate your input if needed.

Plugins

Plugins are responsible for generating artifacts from your input. By default, Hey API will generate TypeScript interfaces and SDK from your OpenAPI specification. You can add, remove, or customize any of the plugins. In fact, we highly encourage you to do so!

Client

Clients are responsible for sending the actual HTTP requests. Using clients is not required, but you must add a client toplugins if you're generating SDKs (we default to Fetch).

Native Clients

Planned Clients

The following clients are planned but not in development yet. You can help us prioritize them by voting onGitHub.

Don't see your client?Build your own or let us know your interest byopening an issue.

Native Plugins

These plugins help reduce boilerplate associated with third-party dependencies. Hey API natively supports the most popular packages. Please open an issue onGitHub if you'd like us to support your favorite package.

Planned Plugins

The following plugins are planned but not in development yet. You can help us prioritize them by voting onGitHub.

Don't see your plugin?Build your own or let us know your interest byopening an issue.

Migrating

You can learn more on theMigrating page.

License

Released under theMIT License.

About

🌀 OpenAPI to TypeScript codegen. Production-ready SDKs, Zod schemas, TanStack Query hooks, and 20+ plugins. Used by Vercel, OpenCode, and PayPal.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Contributors104

Languages


[8]ページ先頭

©2009-2026 Movatter.jp