# @typesafe-api/open-api

> OpenAPI is a well-used spec that can be used to define APIs. This spec can then be used in collaboration with other tools to generate docs and API clients etc.

Latest version **3.0.3** (published 2023-04-05) · 0 weekly downloads

## Install

```sh
npm install @typesafe-api/open-api
pnpm add @typesafe-api/open-api
yarn add @typesafe-api/open-api
bun add @typesafe-api/open-api
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2023-04-05 |
| First published | 2023-03-25 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | typesafe-api |

## Links

- npm: https://www.npmjs.com/package/@typesafe-api/open-api
- npm.io page: https://npm.io/package/@typesafe-api/open-api

## Recent versions

- 3.0.3 (latest) — 2023-04-05
- 3.0.2 — 2023-03-31
- 3.0.1 — 2023-03-26
- 3.0.0-15 — 2023-03-26
- 3.0.0-14 — 2023-03-26
- 3.0.0-13 — 2023-03-26
- 3.0.0-12 — 2023-03-26
- 3.0.0-11 — 2023-03-26
- 3.0.0-9 — 2023-03-26
- 3.0.0-8 — 2023-03-26
- 3.0.0-7 — 2023-03-26
- 3.0.0-6 — 2023-03-26
- 3.0.0-5 — 2023-03-26
- 3.0.0-4 — 2023-03-25
- 3.0.0-3 — 2023-03-25
- … 5 more at https://npm.io/package/@typesafe-api/open-api/versions

## README

# OpenAPI

OpenAPI is a well-used spec that can be used to define APIs. This spec can then be used in collaboration with other tools to generate docs and API clients etc.

Install the package with:
```typescript
npm i -D @typesafe-api/open-api
```

Then call the cli like:
```typescript
npx tsx node_modules/@typesafe-api/open-api/src/cli.js --help
```

These are the cli options: 
```
Options:
  --tsConfigFile <path to tsconfig.json>  The path to the tsconfig file to use. (default: "tsconfig.json")
  --version <version>                     The version number to your for your api spec (default: "1.0.0")
  --output <filepath>                     The path to the yaml file where you want to output your API spec (default: "openapi.yml")
  --title <api title>                     The title of your api
  --routes <glob path(s)>                 The glob path or comma separated paths to your routes files, make sure you wrap it in quotes!
  -h, --help                              display help for command
```

An example command to generate an OpenApi spec would be:
```typescript
npx tsx node_modules/@typesafe-api/open-api/src/cli.js --title my-api --routes "path-to-route-definitions/**/*.ts"
```

### Development

Run this command from the root of the project in order to test the cli

```typescript
npx tsx ./packages/open-api/src/cli.ts --title my-api --tsConfigFile packages/core/tsconfig.spec.json --routes "packages/core/test/**/*.ts"
```

---
_Source: https://npm.io/package/@typesafe-api/open-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
