openapi-ts-client-gen
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

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!"))

Package Sidebar

Install

npm i openapi-ts-client-gen

Weekly Downloads

3

Version

1.3.1

License

MIT

Unpacked Size

154 kB

Total Files

27

Last publish

Collaborators

  • lukeautry