swagger-typescript-api
Advanced tools
Comparing version
@@ -11,3 +11,7 @@ # next release | ||
- ability to call `generateApi` function 2 and more times per 1 NodeJS process. | ||
- new command `generate-templates` to create source templates | ||
## [feature] Ability to generate source templates | ||
New command `generate-templates` which allow you to generate source templates which using with option `--templates` | ||
## [feature] Ability to modify internal codegen typescript structs | ||
@@ -14,0 +18,0 @@ Everything which creates codegen about output typescript code now contains in `Ts` field in [`src/configuration`](src/configuration.js). |
{ | ||
"name": "swagger-typescript-api", | ||
"version": "11.0.0--beta-6", | ||
"version": "11.0.0", | ||
"description": "Generate typescript/javascript api from swagger schema", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -37,2 +37,3 @@ # swagger-typescript-api | ||
Usage: swagger-typescript-api [options] | ||
Usage: swagger-typescript-api generate-templates [options] | ||
@@ -77,3 +78,14 @@ Options: | ||
--another-array-type generate array types as Array<Type> (by default Type[]) (default: false) | ||
--sort-types sort fields and types (default: false) | ||
-h, --help display help for command | ||
Commands: | ||
generate-templates Generate ".ejs" templates needed for generate api | ||
-o, --output <string> output path of generated templates | ||
-m, --modular generate templates needed to separate files for http client, data contracts, and routes (default: false) | ||
--http-client <string> http client type (possible values: "fetch", "axios") (default: "fetch") | ||
-c, --clean-output clean output folder before generate template. WARNING: May cause data loss (default: false) | ||
-r, --rewrite rewrite content in existing templates (default: false) | ||
--silent Output only errors to console (default: false) | ||
-h, --help display help for command | ||
``` | ||
@@ -88,3 +100,3 @@ | ||
```js | ||
const { generateApi } = require('swagger-typescript-api'); | ||
const { generateApi, generateTemplates } = require('swagger-typescript-api'); | ||
const path = require("path"); | ||
@@ -164,2 +176,12 @@ const fs = require("fs"); | ||
generateTemplates({ | ||
cleanOutput: false, | ||
output: PATH_TO_OUTPUT_DIR, | ||
httpClientType: "fetch", | ||
modular: false, | ||
silent: false, | ||
rewrite: false, | ||
}) | ||
``` | ||
@@ -227,2 +249,5 @@ | ||
## `generate-templates` command | ||
This command allows you to generate source templates which using with option `--templates` | ||
## Modification internal codegen structs with NodeJS API: | ||
@@ -229,0 +254,0 @@ |
@@ -69,3 +69,3 @@ const _ = require("lodash"); | ||
}); | ||
this.logger.event(`source templates has been successfully created in "${outputPath}"`); | ||
this.logger.success(`source templates has been successfully created in "${outputPath}"`); | ||
} | ||
@@ -72,0 +72,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
257513
0.56%0
-100%536
4.89%