openapi-ts-sdk

1.48.0 • Public • Published

OpenAPI TypeScript SDK Generator

This tool allows generating a TypeScript SDK from OpenAPI specification files. This will provide you with fully typed API library to use in a client-side application.

Install

npm install -D openapi-ts-sdk

You will also need some dependencies used by the generated code:

npm install -S axios qs
npm install -D @types/qs

Usage sample

openapi-ts-sdk /path/to/service1/openapi.json /path/to/service2/openapi.json --outDir /path/to/client/sdk

This command will take your openapi.json files and generate a TypeScript SDK within your client-side project. You will then be able to import it in your code:

import { createSdkClient } from '../sdk';

const sdk = createSdkClient({
  baseUrl: process.env.API_URL,
});

const { company } = await sdk.companies.id(9526).get();
console.log(company);

Readme

Keywords

none

Package Sidebar

Install

npm i openapi-ts-sdk

Weekly Downloads

154

Version

1.48.0

License

MIT

Unpacked Size

37.5 kB

Total Files

17

Last publish

Collaborators

  • alekseyleshko