Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/osomepteltd/openapi-ts-sdk
Osome TypeScript SDK Generator
https://github.com/osomepteltd/openapi-ts-sdk
openapi sdk typescript
Last synced: 15 days ago
JSON representation
Osome TypeScript SDK Generator
- Host: GitHub
- URL: https://github.com/osomepteltd/openapi-ts-sdk
- Owner: OsomePteLtd
- Created: 2020-08-11T13:07:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T10:25:20.000Z (7 months ago)
- Last Synced: 2024-05-28T21:52:06.079Z (6 months ago)
- Topics: openapi, sdk, typescript
- Language: TypeScript
- Homepage:
- Size: 277 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# 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
```bash
npm install -D openapi-ts-sdk
```You will also need some dependencies used by the generated code:
```bash
npm install -S axios qs
npm install -D @types/qs
```## Usage sample
```bash
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:
```ts
import { createSdkClient } from '../sdk';const sdk = createSdkClient({
baseUrl: process.env.API_URL,
});const { company } = await sdk.companies.id(9526).get();
console.log(company);
```