# openapi-generator

> [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][down

Latest version **0.1.39** (published 2020-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install openapi-generator
pnpm add openapi-generator
yarn add openapi-generator
bun add openapi-generator
```

Provides the command `openapi-generator`.

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.39 |
| Published | 2020-11-02 |
| First published | 2018-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 64.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 14 |
| Author | zhang740 |
| Maintainers | zhang740 |

## Links

- npm: https://www.npmjs.com/package/openapi-generator
- Repository: https://github.com/zhang740/openapi-generator
- Homepage: https://github.com/zhang740/openapi-generator#readme
- Issues: https://github.com/zhang740/openapi-generator/issues
- npm.io page: https://npm.io/package/openapi-generator

## Dependencies (10)

- [debug](https://npm.io/package/debug.md) ^4.1.0
- [tslib](https://npm.io/package/tslib.md) ^1.9.3
- [request](https://npm.io/package/request.md) ^2.88.0
- [colorful](https://npm.io/package/colorful.md) ^2.1.0
- [nunjucks](https://npm.io/package/nunjucks.md) ^3.1.3
- [commander](https://npm.io/package/commander.md) ^2.19.0
- [openapi3-ts](https://npm.io/package/openapi3-ts.md) ^1.1.0
- [@types/request](https://npm.io/package/@types/request.md) ^2.48.0
- [@types/nunjucks](https://npm.io/package/@types/nunjucks.md) ^3.1.0
- [swagger2openapi](https://npm.io/package/swagger2openapi.md) ^5.3.1

## Recent versions

- 0.1.39 (latest) — 2020-11-02
- 0.1.38 — 2020-11-02
- 0.1.37 — 2020-05-13
- 0.1.36 — 2020-04-16
- 0.1.35 — 2020-04-08
- 0.1.34 — 2019-12-18
- 0.1.33 — 2019-12-17
- 0.1.32 — 2019-12-13
- 0.1.31 — 2019-11-29
- 0.1.30 — 2019-09-27
- 0.1.29 — 2019-05-15
- 0.1.28 — 2019-02-19
- 0.1.27 — 2019-01-18
- 0.1.26 — 2019-01-04
- 0.1.25 — 2019-01-02
- … 25 more at https://npm.io/package/openapi-generator/versions

## README

# openapi-generator

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/openapi-generator.svg?style=flat-square
[npm-url]: https://npmjs.org/package/openapi-generator
[travis-image]: https://img.shields.io/travis/zhang740/openapi-generator.svg?style=flat-square
[travis-url]: https://travis-ci.org/zhang740/openapi-generator
[codecov-image]: https://codecov.io/github/zhang740/openapi-generator/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/zhang740/openapi-generator?branch=master
[david-image]: https://img.shields.io/david/zhang740/openapi-generator.svg?style=flat-square
[david-url]: https://david-dm.org/zhang740/openapi-generator
[snyk-image]: https://snyk.io/test/npm/openapi-generator/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/openapi-generator
[download-image]: https://img.shields.io/npm/dm/openapi-generator.svg?style=flat-square
[download-url]: https://npmjs.org/package/openapi-generator

# Quick View

openapi-generator from swagger 2.0 or OpenAPI 3.0:

## Simple

`openapi-generator url http://xxx/v2/api-docs -c true`

## Use Config

`openapi-generator config ./xxx.js` or `openapi-generator config ./xxx.json`

Config interface:

```ts
interface CliConfig {
  api: string;

  /** dir for openapi-generator */
  sdkDir: string;
  /** path of service template */
  templatePath?: string;
  /** path of interface template */
  interfaceTemplatePath?: string;
  /** request lib */
  requestLib = true;
  /** filename style, true 为大驼峰，lower 为小驼峰 */
  camelCase?: boolean | 'lower' = false;
  /** gen type */
  type?: 'ts' | 'js' = 'ts';
  /** service type */
  serviceType?: 'function' | 'class' = 'function';
  /** namespace of typings */
  namespace?: string = 'API';
  /** 自动清除旧文件时忽略列表 */
  ignoreDelete: string[] = [];
}
```

### genAPISDK

`function genAPISDK(data: RouteMetadataType[], config: GenConfig) => void`

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