Skip to content

Commit 9affd61

Browse files
committed
docs: update CHANGELOG
1 parent 68db34f commit 9affd61

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- new codebase (class way)
99
- ability to change everything in codegen process configuration with using NodeJS Api
1010
- ability to call `generateApi` function 2 and more times per 1 NodeJS process.
11+
- new command `generate-templates` to create source templates
12+
13+
## [feature] Ability to generate source templates
14+
New command `generate-templates` which allow you to generate source templates which using with option `--templates`
1115

1216
## [feature] Ability to modify internal codegen typescript structs
1317
Everything which creates codegen about output typescript code now contains in `Ts` field in [`src/configuration`](src/configuration.js).

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ All examples you can find [**here**](https://github.com/acacode/swagger-typescri
3434
```muse
3535
Usage: sta [options]
3636
Usage: swagger-typescript-api [options]
37+
Usage: swagger-typescript-api generate-templates [options]
3738
3839
Options:
3940
-v, --version output the current version
@@ -73,7 +74,18 @@ Options:
7374
--patch fix up small errors in the swagger source definition (default: false)
7475
--debug additional information about processes inside this tool (default: false)
7576
--another-array-type generate array types as Array<Type> (by default Type[]) (default: false)
77+
--sort-types sort fields and types (default: false)
7678
-h, --help display help for command
79+
80+
Commands:
81+
generate-templates Generate ".ejs" templates needed for generate api
82+
-o, --output <string> output path of generated templates
83+
-m, --modular generate templates needed to separate files for http client, data contracts, and routes (default: false)
84+
--http-client <string> http client type (possible values: "fetch", "axios") (default: "fetch")
85+
-c, --clean-output clean output folder before generate template. WARNING: May cause data loss (default: false)
86+
-r, --rewrite rewrite content in existing templates (default: false)
87+
--silent Output only errors to console (default: false)
88+
-h, --help display help for command
7789
```
7890

7991
Also you can use `npx`:
@@ -83,7 +95,7 @@ Also you can use `npx`:
8395

8496
You can use this package from nodejs:
8597
```js
86-
const { generateApi } = require('swagger-typescript-api');
98+
const { generateApi, generateTemplates } = require('swagger-typescript-api');
8799
const path = require("path");
88100
const fs = require("fs");
89101

@@ -158,6 +170,16 @@ generateApi({
158170
})
159171
.catch(e => console.error(e))
160172

173+
174+
generateTemplates({
175+
cleanOutput: false,
176+
output: PATH_TO_OUTPUT_DIR,
177+
httpClientType: "fetch",
178+
modular: false,
179+
silent: false,
180+
rewrite: false,
181+
})
182+
161183
```
162184

163185

@@ -220,6 +242,9 @@ When we change it to `--module-name-index 1` then Api class have two properties
220242
This option will group your API operations based on their first tag - mirroring how the Swagger UI groups displayed operations
221243

222244

245+
## `generate-templates` command
246+
This command allows you to generate source templates which using with option `--templates`
247+
223248
## Modification internal codegen structs with NodeJS API:
224249

225250
You are able to modify TypeScript internal structs using for generating output with using `generateApi` options `codeGenConstructs` and `primitiveTypeConstructs`.

0 commit comments

Comments
 (0)