# @oas-typescript/express

> oas-typescript-express is a generator for [OpenAPI Specification 3](https://swagger.io/specification/v3/) to [express](https://expressjs.com/). This tool is powered by [openapi-zod-client](https://github.com/astahmer/openapi-zod-client) for the OAS parsin

Latest version **0.2.3** (published 2024-01-16) · 0 weekly downloads

## Install

```sh
npm install @oas-typescript/express
pnpm add @oas-typescript/express
yarn add @oas-typescript/express
bun add @oas-typescript/express
```

Provides the command `oas-typescript-express`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2024-01-16 |
| First published | 2023-11-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 6 |
| Unpacked size | 88.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | imballinst |

## Links

- npm: https://www.npmjs.com/package/@oas-typescript/express
- Repository: https://github.com/imballinst/oas-typescript
- Homepage: https://github.com/imballinst/oas-typescript#readme
- Issues: https://github.com/imballinst/oas-typescript/issues
- npm.io page: https://npm.io/package/@oas-typescript/express

## Dependencies (6)

- [meow](https://npm.io/package/meow.md) 12.0.1
- [yaml](https://npm.io/package/yaml.md) 2.3.4
- [prettier](https://npm.io/package/prettier.md) 3.0.3
- [title-case](https://npm.io/package/title-case.md) 3.0.3
- [openapi-zod-client](https://npm.io/package/openapi-zod-client.md) 1.15.1
- [@readme/openapi-parser](https://npm.io/package/@readme/openapi-parser.md) 2.5.0

## Recent versions

- 0.2.3 (latest) — 2024-01-16
- 0.2.2 — 2024-01-07
- 0.2.1 — 2023-12-12
- 0.2.0 — 2023-12-11
- 0.1.2 — 2023-11-25
- 0.1.0 — 2023-11-23

## README

# oas-typescript-express

oas-typescript-express is a generator for [OpenAPI Specification 3](https://swagger.io/specification/v3/) to [express](https://expressjs.com/). This tool is powered by [openapi-zod-client](https://github.com/astahmer/openapi-zod-client) for the OAS parsing.

## Installation

It is recommended to install this as a project dependency so that it can be used in CI consistently.

```bash
# With npm.
npm install --save-dev @oas-typescript/express

# With yarn.
yarn add -D @oas-typescript/express
```

## CLI guide

<!-- @@SYNCAPI-START nodejs-http-server-cli-options -->

| Option | Description | Default value |
| - | - | - |
|`--output`, `-o`|The output directory.|`(pwd)/oas-typescript`|
|`--app-security-schemes-field`|The security scheme field used in the OpenAPI Specification. Mostly useful when you have custom `securitySchemes` that are not supported by the specification.|`securitySchemes`|
|`--app-security-requirements-field`|The custom security requirements field used in the OpenAPI Specification. Mostly useful when you have custom `security` that are not supported by the specification.|`security`|
|`--module`|The output module. Available values are `cjs` or `esm`.|`esm`|

<!-- @@SYNCAPI-END -->

## Generating server stubs

To generate the server stubs, do this command:

```bash
npx oas-typescript-express generate ./api.json --output generated

# Or, using yarn:
yarn oas-typescript-express generate ./api.json --output generated

# Or, inside the `scripts` in package.json.
oas-typescript-express generate ./api.json --output generated
```

The command above will read the Open API Specification `api.json` and output them to the `generated` folder. The result will be as the following.

```
generated
├── controllers
│   ├── PetController.ts
│   ├── StoreController.ts
│   └── UserController.ts
├── static
│   ├── checksum.json
│   ├── client.ts
│   ├── controller-types
│   │   ├── PetControllerTypes.ts
│   │   ├── StoreControllerTypes.ts
│   │   └── UserControllerTypes.ts
│   ├── security-schemes.ts
│   ├── router.ts
│   ├── types.ts
│   └── utils.ts
└── middleware-helpers.ts
```

All files are stubs, except the ones in `controllers` folder and `middleware-helpers.ts`, where you will need to insert your own logic. The latter is mostly used for validating authorization from the incoming request.

## More information

For further documentation, please visit the documentation: https://imballinst.github.io/oas-typescript/docs/nodejs-server-stubs/adapters/express.

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