Skip to content

Commit 36524ef

Browse files
authored
Merge pull request #16 from acacode/release/1.3.0
release/1.3.0
2 parents fdf23f3 + 55638d5 commit 36524ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+93193
-299
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2+
.vscode
23
swagger-test-cli.ts

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ jobs:
2222
include:
2323
- stage: generate&validate
2424
script:
25-
- npm run generate
26-
- npm run validate
25+
- npm run test:all
2726

2827
notifications:
2928
slack:

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# 1.3.0
2+
Features:
3+
- Api module description from schema info
4+
![api description](./assets/changelog_assets/api-module-description.jpg)
5+
- Generate API type declarations (CLI flag `--route-types`)
6+
![route types](./assets/changelog_assets/route-types.jpg)
7+
- Ability to not generate clint API class (CLI flag `--no-client`)
8+
9+
Fixes:
10+
- Improve response body type definition
11+
12+
Internal:
13+
- refactored `generate` and `validate` test scripts
14+
115
# 1.2.6
216
Fixes: create api without `-o` option (use default `./` output)
317

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ Usage: swagger-typescript-api [options]
3232
Options:
3333
-v, --version output the current version
3434
-p, --path <path> path/url to swagger scheme
35-
-o, --output <output> output path of typescript api file (default: ".")
35+
-o, --output <output> output path of typescript api file (default: "./")
3636
-n, --name <name> name of output typescript api file (default: "api.ts")
37+
--route-types generate type definitions for API routes (default: false)
38+
--no-client do not generate an API class
3739
-h, --help output usage information
3840
```
3941

@@ -64,7 +66,7 @@ generateApi({
6466

6567
```
6668

67-
## 🚀 How it looks
69+
## 🚀 How it looks
6870

6971
![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/npx.gif)
7072

@@ -73,6 +75,12 @@ generateApi({
7375
![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/typings1.gif)
7476

7577

78+
## 🛠️ Contribution
79+
80+
You can manually check your changes at schemas in `tests` folder before create a PR.
81+
To do that have scripts:
82+
- `npm run generate` - generate API modules from schemas in `tests` folder
83+
- `npm run validate` - validate generated API modules via TypeScript
7684

7785
## 📝 License
7886
Licensed under the [MIT License](https://github.com/acacode/swagger-typescript-api/blob/master/LICENSE).
Loading
37.9 KB
Loading

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ program
1616
.description("Generate api via swagger scheme.\nSupports OA 3.0, 2.0, JSON, yaml.")
1717
.requiredOption('-p, --path <path>', 'path/url to swagger scheme')
1818
.option('-o, --output <output>', 'output path of typescript api file', './')
19-
.option('-n, --name <name>', 'name of output typescript api file', 'api.ts');
19+
.option('-n, --name <name>', 'name of output typescript api file', 'api.ts')
20+
.option('--route-types', 'generate type definitions for API routes', false)
21+
.option('--no-client', 'do not generate an API class', false);
2022

2123
program.parse(process.argv);
2224

23-
const { path, output, name } = program;
25+
const { path, output, name, routeTypes, client } = program;
2426

2527
generateApi({
2628
name,
2729
url: path,
30+
generateRouteTypes: routeTypes,
31+
generateClient: client,
2832
input: resolve(process.cwd(), path),
2933
output: resolve(process.cwd(), output || '.')
3034
})

0 commit comments

Comments
 (0)