Skip to content

Commit 6f18309

Browse files
Added examples for config-file
1 parent a593198 commit 6f18309

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

Readme.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
- [Installation](#installation)
66
- [Usage](#usage)
77
- [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)
811
- [Main CLI commands](#main-cli-commands)
912
- [Development](#development)
1013
- [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
4649
transform-swagger -f URI/TO/SWAGGER/JSON/OR/YAML -o src/generatedApi/ -t angular2
4750
```
4851

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+
4976
### Main CLI commands
5077

5178
```bash
5279
Usage: transform-swagger [options]
5380

5481
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).
5685
--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]
6088
-o, --output-folder Specify the output folder (generated folders will be
61-
replaced) [default: "output"]
89+
replaced) [default: "output"]
6290
-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"]
6493

6594
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
6897
```
6998

7099
## Development

examples/Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ You can also try to use `the original files` from each source or test with `your
2121
**Local file command:**
2222
```bash
2323
npm start -- -f examples/openApiFiles/passportescaperoom.com.json -o examples/generated/angular2 -t angular2
24+
# OR
25+
npm start -- config-file ./examples/transform-config.json
2426
```
2527

2628
**Generate from url**

0 commit comments

Comments
 (0)