# @sandumo/openapi-client-generator

> This package generates a client for an OpenAPI specification.

Latest version **0.0.3** (published 2026-09-03) · 0 weekly downloads

## Install

```sh
npm install @sandumo/openapi-client-generator
pnpm add @sandumo/openapi-client-generator
yarn add @sandumo/openapi-client-generator
bun add @sandumo/openapi-client-generator
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; recently updated.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2026-09-03 |
| First published | 2024-05-05 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 46.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sandu Morari |
| Maintainers | sandu.m.md |
| Keywords | openapi, client, generator |

## Links

- npm: https://www.npmjs.com/package/@sandumo/openapi-client-generator
- Repository: https://github.com/sandumo/packages
- Homepage: https://github.com/sandumo/packages/blob/main/packages/openapi-client-generator/README.md
- Issues: https://github.com/sandumo/packages/issues
- npm.io page: https://npm.io/package/@sandumo/openapi-client-generator

## Dependencies (2)

- [ts-node](https://npm.io/package/ts-node.md) ^10.0.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.2.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2026-09-03
- 0.0.2 — 2024-12-29
- 0.0.1 — 2024-05-05

## README

# @sandumo/openapi-client-generator

This package generates a client for an OpenAPI specification.

## Installation

```bash
npm install @sandumo/openapi-client-generator
```

## Usage

### Generating client code

```typescript
import { OpenAPIClientGenerator } from '@sandumo/openapi-client-generator';

const schema = JSON.parse(fs.readFileSync('path/to/openapi-schema.json', 'utf8'));
const outputFile = 'path/to/output/file.ts';

new OpenAPIClientGenerator()
  .fromSchema(schema)
  .toPath(outputFile)
  .generate();
```

### Using the generated client

```typescript
import api from './path/to/output/file';

api.axios.defaults.baseURL = 'https://api.example.com'; // api.axios is an Axios instance

await api.users.getUsers();
```

#### react-query

```typescript
import api from './path/to/output/file';

export function ContextSettings() {
  // Set the queryClient for the api-client
  const queryClient = useQueryClient();

  useEffect(() => {
    api.config.queryClient = queryClient;
  }, [queryClient]);

  return <></>;
}

export function Component() {
  const { data: users } = useQuery(api.users.getUsersQuery());

  return <></>
}
```

---
_Source: https://npm.io/package/@sandumo/openapi-client-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
