|
5 | 5 | - [Installation](#installation) |
6 | 6 | - [Usage](#usage) |
7 | 7 | - [The script](#the-script) |
| 8 | + - [Config file](#config-file) |
| 9 | + - [Create the config file (you choose the name and the location)](#create-the-config-file-you-choose-the-name-and-the-location) |
| 10 | + - [Launch the script](#launch-the-script) |
8 | 11 | - [Main CLI commands](#main-cli-commands) |
9 | 12 | - [Development](#development) |
10 | 13 | - [Run with watch (internet file)](#run-with-watch-internet-file) |
@@ -46,25 +49,51 @@ Is recommended to add a script to your `package.json` or package manager that yo |
46 | 49 | transform-swagger -f URI/TO/SWAGGER/JSON/OR/YAML -o src/generatedApi/ -t angular2 |
47 | 50 | ``` |
48 | 51 |
|
| 52 | +### Config file |
| 53 | + |
| 54 | +> The settings of the config file are the same than cli one (but in `camelCase`). |
| 55 | +
|
| 56 | +#### Create the config file (you choose the name and the location) |
| 57 | + |
| 58 | +We will name for example `transfrom-config.json` |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "clean": true, |
| 63 | + "file": "./examples/openApiFiles/passportescaperoom.com.json", |
| 64 | + "outputFolder": "./examples/generated/angular2", |
| 65 | + "template": "angular2", |
| 66 | + "saveFile": "./openApiFiles/passportescaperoom.com" |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +#### Launch the script |
| 71 | + |
| 72 | +```bash |
| 73 | +transform-swagger config-file ./examples/transform-config.json |
| 74 | +``` |
| 75 | + |
49 | 76 | ### Main CLI commands |
50 | 77 |
|
51 | 78 | ```bash |
52 | 79 | Usage: transform-swagger [options] |
53 | 80 |
|
54 | 81 | Options: |
55 | | - --version, -v Show version number [boolean] |
| 82 | + --version, -v Show version number [boolean] |
| 83 | + --config-file Configuration file to use (values from cli will overwrite |
| 84 | + the files one). |
56 | 85 | --clean No clean the output-folder, so old files will remain |
57 | | - [boolean] [default: true] |
58 | | - -f, --file Path OR URL to the swagger document to parse |
59 | | - [required] |
| 86 | + [boolean] [default: true] |
| 87 | + -f, --file Path OR URL to the swagger document to parse [required] |
60 | 88 | -o, --output-folder Specify the output folder (generated folders will be |
61 | | - replaced) [default: "output"] |
| 89 | + replaced) [default: "output"] |
62 | 90 | -t, --template Template (preset) name or path to a template |
63 | | - -h, --help Show help [boolean] |
| 91 | + -h, --help Show help [boolean] |
| 92 | + -s, --save-file [default: "./openapi_temp"] |
64 | 93 |
|
65 | 94 | Examples: |
66 | | - transform-swagger -f swagger.js -o Convert a Swagger JSON file to |
67 | | - api/ -t angular2 compatible-angular API |
| 95 | + cli -f swagger.js -o api/ -t angular2 Convert a Swagger JSON file to |
| 96 | + compatible-angular API |
68 | 97 | ``` |
69 | 98 |
|
70 | 99 | ## Development |
|
0 commit comments