# @codegena/oapi3ts-cli

> CLI Application API for codegeneration from OAS3

Latest version **2.1.10-alpha.8** (published 2020-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @codegena/oapi3ts-cli
pnpm add @codegena/oapi3ts-cli
yarn add @codegena/oapi3ts-cli
bun add @codegena/oapi3ts-cli
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.10-alpha.8 |
| Published | 2020-08-19 |
| First published | 2019-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 302.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 41 |
| Author | koshevy@gmail.com |
| Maintainers | koshevy |
| Keywords | swagger, oas, oas3, oas 3, openapi, openapi3, open-api, open api, codegeneration, code generation, typescript, angular |

## Links

- npm: https://www.npmjs.com/package/@codegena/oapi3ts-cli
- Repository: https://github.com/koshevy/codegena
- npm.io page: https://npm.io/package/@codegena/oapi3ts-cli

## Dependencies (6)

- [ajv](https://npm.io/package/ajv.md) >= 6
- [lodash](https://npm.io/package/lodash.md) >= 4
- [hash.js](https://npm.io/package/hash.js.md) >= 1
- [prettier](https://npm.io/package/prettier.md) >= 1
- [@codegena/oapi3ts](https://npm.io/package/@codegena/oapi3ts.md) 2.2.0-alpha.2
- [@codegena/ng-api-service](https://npm.io/package/@codegena/ng-api-service.md) 2.2.0-alpha.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 2.1.10-alpha.8 (latest) — 2020-08-19
- 2.1.10-alpha.7 — 2020-08-16
- 2.1.10-alpha.6 — 2020-06-07
- 2.1.10-alpha.5 — 2020-05-17
- 2.1.10-alpha.4 — 2020-05-04
- 2.1.10-alpha.3 — 2020-05-03
- 2.1.10-alpha.2 — 2020-05-01
- 2.1.10-alpha.1 — 2020-05-01
- 2.1.10-alpha.0 — 2020-04-25
- 2.1.9 — 2020-04-25
- 2.1.8 — 2020-04-25
- 2.1.7 — 2020-04-13
- 2.1.6 — 2020-03-29
- 2.1.5 — 2020-03-05
- 2.1.4 — 2020-01-26
- … 6 more at https://npm.io/package/@codegena/oapi3ts-cli/versions

## README

# CLI Application API for codegeneration from OAS3

> This is an experimental library. Now supporting TypeScript data types and model. Also, generating experimental Angular2+ services.
>
> Supporting of other languages and frameworks might be possible in the future.

It's a part of [@codegena](https://github.com/koshevy/codegena) scope.

See in action: https://codegena-playground.stackblitz.io/ / https://stackblitz.com/edit/codegena-playground.

## Using in NodeJS scripts

Install (without optional dependencies):

```
npm i @codegena/oapi3ts-cli --no-optional
```

or

```
yarn add @codegena/oapi3ts-cli --ignore-optional
```

So you can use `@codegena/oapi3ts-cli` in NodeJS scripts. For example, lets create `update-typings.js` script with code:

```javascript
"use strict";

var cliLib = require('@codegena/oapi3ts-cli');
var cliApp = new cliLib.CliApplication;

cliApp.createTypings();
cliApp.createServices('angular');
```

Then launch:

```
node ./update-typings.js --srcPath ./specs/todo-app-spec.json --destPath ./ --separatedFiles true
```

Class `CliApplication` will get command line arguments `destPath`, `srcPath` and `separatedFiles` by itself.

#### CLI arguments


| CLI Argument       | Description                                                                   |
|--------------------|-------------------------------------------------------------------------------|
| **srcPath**        | Path of url of JSON file with OpenAPI3 specification                          |
| **destPath**       | Path for destination directory                                                |
| **separatedFiles** | Whether should converted types been saved in separate files, or in single file |

Also, you can set some of options for convertor's [configuration](https://github.com/koshevy/oapi3codegen/blob/master/core/config.ts#L99)
config via CLI:

| Option                          | Description                                                                   |
|---------------------------------|-------------------------------------------------------------------------------|
| **defaultContentType**          | Default content-type contains no prefixes/suffixes in type names.             |
| **implicitTypesRefReplacement** | Mode when models that refer to any models via `$ref` are replacing implicitly even if firsts have names |

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