Carminepo2/openapi-ts-rest(新しいタブで開きます)
主要言語: TypeScript
A simple tool to generate a ts-rest contract (with zod validation) from an OpenAPI 3.0/3.1 specification.
- star 数
- 31
- watcher 数
- 2
- fork 数
- 3
- issue 数
- 20
- 最終更新
- 2026/10/27
主要言語: TypeScript
A simple tool to generate a ts-rest contract (with zod validation) from an OpenAPI 3.0/3.1 specification.
Warning
This project is still in development and is not ready for production use, there may be bugs, missing features and breaking changes. Use at your own risk.
A simple tool to generate a ts-rest contract (with zod validation) from an OpenAPI 3.0/3.1 specification.
---> Try it in the online playground! <---
You can use openapi-ts-rest in two ways: as a CLI tool or as a core library within your code.
pnpm add @openapi-ts-rest/cli
pnpm add @openapi-ts-rest/core
# If installed globally openapi-ts-rest path/to/openapi-spec.yaml -o path/to/output/dir # If installed in a project npx openapi-ts-rest path/to/openapi-spec.yaml -o path/to/output/dir
-o, --output: Directory where the generated TypeScript files will be saved.If you prefer to integrate the functionality directly into your code, you can do so with the core library:
import { generateContract } from "@openapi-ts-rest/core"; import fs from "fs"; const result = await generateContract({ openApi: "path/to/openapi-spec.yaml" }); fs.writeFileSync("path/to/output/dir", result);
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is heavily inspired by openapi-zod-client. Special thanks to the author for their work!