# swagger2ng2

> Angular 2 API client generator from swagger JSON and YAML.

Latest version **0.0.45** (published 2017-03-23) · APACHE license · 0 weekly downloads

## Install

```sh
npm install swagger2ng2
pnpm add swagger2ng2
yarn add swagger2ng2
bun add swagger2ng2
```

Provides the command `swagger2ng2`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.45 |
| Published | 2017-03-23 |
| First published | 2017-02-27 |
| Weekly downloads | 0 |
| License | APACHE |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| Author | Robert Mayer |
| Maintainers | syron |
| Keywords | swagger, rest, angular2, angular, scaffolding, webapi, api, generator |

## Links

- npm: https://www.npmjs.com/package/swagger2ng2
- Repository: https://github.com/syron/angular2-swagger-client-generator
- Issues: https://github.com/syron/angular2-swagger-client-generator/issues
- npm.io page: https://npm.io/package/swagger2ng2

## Dependencies (10)

- [gulp](https://npm.io/package/gulp.md) ^3.9.1
- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [tslint](https://npm.io/package/tslint.md) ^3.1.1
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.8.1
- [request](https://npm.io/package/request.md) ^2.67.0
- [mustache](https://npm.io/package/mustache.md) ^2.2.0
- [optimist](https://npm.io/package/optimist.md) ^0.6.1
- [typescript](https://npm.io/package/typescript.md) ^1.7.3
- [js-beautify](https://npm.io/package/js-beautify.md) ^1.5.10

## 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.45 (latest) — 2017-03-23
- 0.0.44 — 2017-03-23
- 0.0.43 — 2017-03-23
- 0.0.42 — 2017-03-23
- 0.0.41 — 2017-03-23
- 0.0.40 — 2017-03-23
- 0.0.39 — 2017-03-23
- 0.0.38 — 2017-03-23
- 0.0.37 — 2017-03-23
- 0.0.36 — 2017-03-23
- 0.0.35 — 2017-03-23
- 0.0.34 — 2017-03-23
- 0.0.33 — 2017-03-23
- 0.0.32 — 2017-03-23
- 0.0.31 — 2017-03-23
- … 9 more at https://npm.io/package/swagger2ng2/versions

## README

# angular2-swagger-apiclient-generator
Angular 2 API client generator from swagger json

# Description
This package generates a angular2 typescript class from a swagger v2.0 specification file. The code is generated using mustache templates.

# How to get it working

## Installation
1. `npm install swagger2ng2`

or

1. get it from github `git clone https://github.com/syron/angular2-swagger-client-generator`
1. `cd angular2-swagger-client-generator`
1. `npm install`
1. `npm run build`
1. If you want to run globally run `npm install -g`

## Usage

From commandline run:
```
swagger2ng2 -s [your/path/to/swagger.json] -c [className] -g [GenerateParameter]
```

or
```
swagger2ng2 -u [url/of/your/swagger.json] -c [className] -g [GenerateParameter]
```

If parameter -c is not provided, class name will be ApiClient Service.

Available values for parameter -g are I, M, C or F, as well as you can combine them.  

## Parameters

Options:

  -s, --source      Path to your swagger.json file

  -u, --url         Url of your swagger.json file

  -o, --outputpath  Path where to store generated files

  -c, --className   Class name for Api client

  -g, --generate    What to generate, F for full (default), I for interfaces, M for models, C for classes

  -f, --fileName    Example '-f index' will generate both index.ts and index.interface.ts. 

  -p, --modelPath   If used, p provides a relative path to the place where models are stored.

## Example usage:

This command will generate API client described in swagger.json file to ./out folder
```
swagger2ng2 -s .\tests\apis\swagger.json -o ./out
```

or from repository directory run:
```
node ./src/main -s .\tests\apis\swagger.json -o ./out
```

##Note:
This project was inspired by:

[swagger-js-codegen](https://github.com/wcandillon/swagger-js-codegen) project

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