All Projects → lukeautry → openapi-ts-client-gen

lukeautry / openapi-ts-client-gen

Licence: other
An OpenAPI (Swagger) TypeScript client generator

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Overview

Generate a TypeScript client from a swagger.json file

Install

[yarn add | npm install] openapi-ts-client-gen

Usage

CLI

openapi-ts-client-gen

generate client

Options:
  --help           Show help                                           [boolean]
  --version        Show version number                                 [boolean]
  --namespace, -n  Module namespace                                   [required]
  --url, -u        URL of swagger.json file
  --file, -f       Path of swagger.json file
  --out, -o        Output path (e.g. ./out/swagger.json)              [required]
  --baseUrl, -b    Base URL of API

Programmatic

import { generate } from "openapi-ts-client-gen";

generate({
    destPath: "./api.ts",
    namespace: "Api",
    srcPath: "./swagger.json",
    type: "file",
}).then(() => console.log("success!"))
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].