swagger-typescript-api 11.0.2 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![NPM badge](https://img.shields.io/npm/v/swagger-typescript-api.svg)](https://www.npmjs.com/package/swagger-typescript-api)
4
4
  [![CI](https://github.com/acacode/swagger-typescript-api/actions/workflows/main.yml/badge.svg?branch=next)](https://github.com/acacode/swagger-typescript-api/actions/workflows/main.yml) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
5
- [![All Contributors](https://img.shields.io/badge/all_contributors-31-orange.svg)](#contributors)
5
+ [![All Contributors](https://img.shields.io/badge/all_contributors-32-orange.svg)](#contributors)
6
6
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
7
7
 
8
8
  <img src="https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/swagger-typescript-api-logo.png" align="left"
@@ -504,7 +504,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
504
504
  <td align="center"><a href="https://marcusdunn.github.io"><img src="https://avatars.githubusercontent.com/u/51931484?v=4?s=100" width="100px;" alt="Marcus Dunn"/><br /><sub><b>Marcus Dunn</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=MarcusDunn" title="Code">💻</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3AMarcusDunn" title="Bug reports">🐛</a></td>
505
505
  <td align="center"><a href="https://www.danielplayfaircal.com/"><img src="https://avatars.githubusercontent.com/u/1217649?v=4?s=100" width="100px;" alt="Daniel Playfair Cal"/><br /><sub><b>Daniel Playfair Cal</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=hedgepigdaniel" title="Code">💻</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Ahedgepigdaniel" title="Bug reports">🐛</a></td>
506
506
  <td align="center"><a href="https://www.linkedin.com/in/patrick-shaw/"><img src="https://avatars.githubusercontent.com/u/5153619?v=4?s=100" width="100px;" alt="Patrick Shaw"/><br /><sub><b>Patrick Shaw</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/pulls?q=is%3Apr+reviewed-by%3APatrickShaw" title="Reviewed Pull Requests">👀</a></td>
507
- <td align="center"><a href="https://www.linkedin.com/in/jinkwon-lee"><img src="https://avatars.githubusercontent.com/u/1798916?v=4?s=100" width="100px;" alt="JK"/><br /><sub><b>JK</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=jinkwon" title="Code">💻</a></td>
507
+ <td align="center"><a href="http://brook.dev"><img src="https://avatars.githubusercontent.com/u/9323190?v=4?s=100" width="100px;" alt="Brook Jordan"/><br /><sub><b>Brook Jordan</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=brookjordan" title="Code">💻</a></td>
508
508
  <td align="center"><a href="https://github.com/RoCat"><img src="https://avatars.githubusercontent.com/u/3562317?v=4?s=100" width="100px;" alt="RoCat"/><br /><sub><b>RoCat</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=RoCat" title="Code">💻</a> <a href="#ideas-RoCat" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-RoCat" title="Design">🎨</a></td>
509
509
  </tr>
510
510
  <tr>
package/cli/index.js CHANGED
File without changes
package/index.d.ts CHANGED
@@ -450,6 +450,7 @@ export interface GenerateApiConfiguration {
450
450
  };
451
451
  routeNameDuplicatesMap: Map<string, string>;
452
452
  apiClassName: string;
453
+ requestOptions?: import("node-fetch").RequestInit;
453
454
  };
454
455
  modelTypes: ModelType[];
455
456
  rawModelTypes: SchemaComponent[];
package/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-typescript-api",
3
- "version": "11.0.2",
3
+ "version": "11.1.0",
4
4
  "description": "Generate typescript/javascript api from swagger schema",
5
5
  "scripts": {
6
6
  "cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts",
@@ -57,10 +57,9 @@
57
57
  "typings": "./index.d.ts",
58
58
  "main": "src/index.js",
59
59
  "devDependencies": {
60
- "@types/axios": "^0.14.0",
61
- "@types/lodash": "^4.14.182",
62
- "@types/node": "^15.0.2",
63
- "@types/prettier": "^2.7.0",
60
+ "@types/lodash": "^4.14.186",
61
+ "@types/node": "^18.11.7",
62
+ "@types/prettier": "^2.7.1",
64
63
  "all-contributors-cli": "^6.20.0",
65
64
  "cross-env": "^7.0.3",
66
65
  "git-diff": "^2.0.6",
@@ -69,7 +68,6 @@
69
68
  },
70
69
  "dependencies": {
71
70
  "@types/swagger-schema-official": "2.0.22",
72
- "axios": "0.27.2",
73
71
  "cosmiconfig": "7.0.1",
74
72
  "didyoumean": "^1.2.2",
75
73
  "eta": "1.12.3",
@@ -78,6 +76,7 @@
78
76
  "make-dir": "3.1.0",
79
77
  "nanoid": "3.3.4",
80
78
  "node-emoji": "1.11.0",
79
+ "node-fetch": "^3.2.10",
81
80
  "prettier": "2.7.1",
82
81
  "swagger-schema-official": "2.0.0-bab6bed",
83
82
  "swagger2openapi": "7.0.8",
@@ -144,6 +144,7 @@ class CodeGenConfig {
144
144
  spec = null;
145
145
  fileName = "";
146
146
  authorizationToken = void 0;
147
+ requestOptions = null;
147
148
 
148
149
  jsPrimitiveTypes = [];
149
150
  jsEmptyTypes = [];
package/src/index.js CHANGED
File without changes
@@ -1,8 +1,7 @@
1
1
  const _ = require("lodash");
2
2
  const converter = require("swagger2openapi");
3
- const https = require("https");
4
- const axios = require("axios");
5
3
  const yaml = require("js-yaml");
4
+ const { Request } = require("./util/request");
6
5
 
7
6
  class SwaggerSchemaResolver {
8
7
  /**
@@ -17,11 +16,16 @@ class SwaggerSchemaResolver {
17
16
  * @type {FileSystem}
18
17
  */
19
18
  fileSystem;
19
+ /**
20
+ * @type {Request}
21
+ */
22
+ request;
20
23
 
21
- constructor(configuration, logger, fileSystem) {
22
- this.config = configuration;
24
+ constructor(config, logger, fileSystem) {
25
+ this.config = config;
23
26
  this.logger = logger;
24
27
  this.fileSystem = fileSystem;
28
+ this.request = new Request(config, logger);
25
29
  }
26
30
 
27
31
  /**
@@ -95,45 +99,19 @@ class SwaggerSchemaResolver {
95
99
  });
96
100
  }
97
101
 
98
- fetchSwaggerSchemaFile(pathToSwagger, urlToSwagger, disableStrictSSL, disableProxy, authorizationToken) {
99
- return new Promise((resolve, reject) => {
100
- if (this.fileSystem.pathIsExist(pathToSwagger)) {
101
- this.logger.log(`try to get swagger by path "${pathToSwagger}"`);
102
- resolve(this.fileSystem.getFileContent(pathToSwagger));
103
- } else {
104
- this.logger.log(`try to get swagger by URL "${urlToSwagger}"`);
105
- // setup options for Axios
106
- const axiosOptions = {
107
- maxContentLength: Infinity,
108
- maxBodyLength: Infinity,
109
- };
110
- //
111
- if (disableStrictSSL) {
112
- axiosOptions.httpsAgent = new https.Agent({
113
- rejectUnauthorized: false,
114
- });
115
- }
116
- //
117
- if (authorizationToken) {
118
- axiosOptions.headers = {
119
- Authorization: authorizationToken,
120
- };
121
- }
122
- //
123
- if (disableProxy) axiosOptions.proxy = false;
124
- //
125
- axios
126
- .get(urlToSwagger, axiosOptions)
127
- .then((res) => resolve(res.data))
128
- .catch((error) => {
129
- const message = `error while getting swagger by URL ${urlToSwagger}`;
130
-
131
- this.logger.error(message, "response" in error ? error.response : error);
132
-
133
- reject(message);
134
- });
135
- }
136
- });
102
+ async fetchSwaggerSchemaFile(pathToSwagger, urlToSwagger, disableStrictSSL, disableProxy, authToken) {
103
+ if (this.fileSystem.pathIsExist(pathToSwagger)) {
104
+ this.logger.log(`try to get swagger by path "${pathToSwagger}"`);
105
+ return this.fileSystem.getFileContent(pathToSwagger);
106
+ } else {
107
+ this.logger.log(`try to get swagger by URL "${urlToSwagger}"`);
108
+ return await this.request.download({
109
+ url: urlToSwagger,
110
+ disableStrictSSL,
111
+ authToken,
112
+ disableProxy,
113
+ });
114
+ }
137
115
  }
138
116
 
139
117
  processSwaggerSchemaFile(file) {
@@ -0,0 +1,61 @@
1
+ const https = require("https");
2
+ const fetch = require("node-fetch-h2");
3
+
4
+ class Request {
5
+ /**
6
+ * @type {CodeGenConfig}
7
+ */
8
+ config;
9
+ /**
10
+ * @type {Logger}
11
+ */
12
+ logger;
13
+
14
+ constructor(config, logger) {
15
+ this.config = config;
16
+ this.logger = logger;
17
+ }
18
+
19
+ /**
20
+ *
21
+ * @param url
22
+ * @param disableStrictSSL
23
+ * @param authToken
24
+ * @param options {Partial<import("node-fetch").RequestInit>}
25
+ * @return {Promise<string>}
26
+ */
27
+ async download({ url, disableStrictSSL, authToken, ...options }) {
28
+ /**
29
+ * @type {Partial<import("node-fetch").RequestInit>}
30
+ */
31
+ const requestOptions = {
32
+ ...(this.config.requestOptions || {}),
33
+ };
34
+
35
+ if (disableStrictSSL) {
36
+ requestOptions.agent = new https.Agent({
37
+ rejectUnauthorized: false,
38
+ });
39
+ }
40
+ if (authToken) {
41
+ requestOptions.headers = {
42
+ Authorization: authToken,
43
+ };
44
+ }
45
+
46
+ Object.assign(requestOptions, options);
47
+
48
+ try {
49
+ const response = await fetch(url, requestOptions);
50
+ return await response.text();
51
+ } catch (error) {
52
+ const message = `error while fetching data from URL "${url}"`;
53
+ this.logger.error(message, "response" in error ? error.response : error);
54
+ return message;
55
+ }
56
+ }
57
+ }
58
+
59
+ module.exports = {
60
+ Request,
61
+ };
package/CHANGELOG.md DELETED
@@ -1,1100 +0,0 @@
1
- # next release
2
-
3
- # 11.0.2
4
-
5
- - fix: problems with --http-client option in `generate-templates` command
6
- - fix: rewrite file content in `generate-templates` command (`--rewrite` flag)
7
-
8
- # 11.0.0
9
-
10
- ## Breaking changes
11
-
12
- - `data-contract-jsdoc.ejs` file uses new input structure. Please update your local copy.
13
- - new codebase (class way)
14
- - ability to change everything in codegen process configuration with using NodeJS Api
15
- - ability to call `generateApi` function 2 and more times per 1 NodeJS process.
16
- - new command `generate-templates` to create source templates
17
-
18
- ## [feature] Ability to generate source templates
19
- New command `generate-templates` which allow you to generate source templates which using with option `--templates`
20
-
21
- ## [feature] Ability to modify internal codegen typescript structs
22
- Everything which creates codegen about output typescript code now contains in `Ts` field in [`src/configuration`](src/configuration.js).
23
- And this thing is available for end user modifications with using NodeJS Cli option `codeGenConstructs`.
24
- It contains almost all which is not contains in `.eta`\ `.ejs` templates. For example: `Record<string, any>`, `readonly typeField?: value`, etc
25
-
26
- Structure of `Ts` property
27
- ```ts
28
- const Ts = {
29
- Keyword: {
30
- Number: "number",
31
- String: "string",
32
- Boolean: "boolean",
33
- Any: "any",
34
- Void: "void",
35
- Unknown: "unknown",
36
- Null: "null",
37
- Undefined: "undefined",
38
- Object: "object",
39
- File: "File",
40
- Date: "Date",
41
- Type: "type",
42
- Enum: "enum",
43
- Interface: "interface",
44
- Array: "Array",
45
- Record: "Record",
46
- Intersection: "&",
47
- Union: "|",
48
- },
49
- CodeGenKeyword: {
50
- UtilRequiredKeys: "UtilRequiredKeys",
51
- },
52
- /**
53
- * $A[] or Array<$A>
54
- */
55
- ArrayType: (content) => {
56
- if (this.anotherArrayType) {
57
- return Ts.TypeWithGeneric(Ts.Keyword.Array, [content]);
58
- }
59
-
60
- return `${Ts.ExpressionGroup(content)}[]`;
61
- },
62
- /**
63
- * "$A"
64
- */
65
- StringValue: (content) => `"${content}"`,
66
- /**
67
- * $A
68
- */
69
- BooleanValue: (content) => `${content}`,
70
- /**
71
- * $A
72
- */
73
- NumberValue: (content) => `${content}`,
74
- /**
75
- * $A
76
- */
77
- NullValue: (content) => content,
78
- /**
79
- * $A1 | $A2
80
- */
81
- UnionType: (contents) => _.join(_.uniq(contents), ` ${Ts.Keyword.Union} `),
82
- /**
83
- * ($A1)
84
- */
85
- ExpressionGroup: (content) => (content ? `(${content})` : ""),
86
- /**
87
- * $A1 & $A2
88
- */
89
- IntersectionType: (contents) => _.join(_.uniq(contents), ` ${Ts.Keyword.Intersection} `),
90
- /**
91
- * Record<$A1, $A2>
92
- */
93
- RecordType: (key, value) => Ts.TypeWithGeneric(Ts.Keyword.Record, [key, value]),
94
- /**
95
- * readonly $key?:$value
96
- */
97
- TypeField: ({ readonly, key, optional, value }) =>
98
- _.compact([readonly && "readonly ", key, optional && "?", ": ", value]).join(""),
99
- /**
100
- * [key: $A1]: $A2
101
- */
102
- InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`,
103
- /**
104
- * $A1 = $A2
105
- */
106
- EnumField: (key, value) => `${key} = ${value}`,
107
- /**
108
- * $A0.key = $A0.value,
109
- * $A1.key = $A1.value,
110
- * $AN.key = $AN.value,
111
- */
112
- EnumFieldsWrapper: (contents) =>
113
- _.map(contents, ({ key, value }) => ` ${Ts.EnumField(key, value)}`).join(",\n"),
114
- /**
115
- * {\n $A \n}
116
- */
117
- ObjectWrapper: (content) => `{\n${content}\n}`,
118
- /**
119
- * /** $A *\/
120
- */
121
- MultilineComment: (contents, formatFn) =>
122
- [
123
- ...(contents.length === 1
124
- ? [`/** ${contents[0]} */`]
125
- : ["/**", ...contents.map((content) => ` * ${content}`), " */"]),
126
- ].map((part) => `${formatFn ? formatFn(part) : part}\n`),
127
- /**
128
- * $A1<...$A2.join(,)>
129
- */
130
- TypeWithGeneric: (typeName, genericArgs) => {
131
- return `${typeName}${genericArgs.length ? `<${genericArgs.join(",")}>` : ""}`;
132
- },
133
- }
134
- ```
135
-
136
- ## [feature] Ability to modify swagger schema type/format to typescript construction translators
137
- Swagger schema has constructions like `{ "type": "string" | "integer" | etc, "format": "date-time" | "float" | "etc" }` where field `type` is not "readable" for TypeScript.
138
- And because of this `swagger-typescript-api` has key value group to translate swagger schema fields `type`/`format` to TypeScript constructions.
139
- See more about [swagger schema type/format data here](https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times)
140
- For example, current version of default configuration translates this schema
141
- ```json
142
- {
143
- "type": "string",
144
- "format": "date-time"
145
- }
146
- ```
147
- translates to
148
- ```ts
149
- string
150
- ```
151
- If you need to see `Date` instead of `string` you are able to change it with using `primitiveTypeConstructs`
152
- ```ts
153
- generateApiForTest({
154
- // ...
155
- primitiveTypeConstructs: (construct) => ({
156
- string: {
157
- 'date-time': 'Date'
158
- }
159
- })
160
- })
161
- ```
162
-
163
- Structure of `primitiveTypes` property
164
- ```ts
165
- const primitiveTypes = {
166
- integer: () => Ts.Keyword.Number,
167
- number: () => Ts.Keyword.Number,
168
- boolean: () => Ts.Keyword.Boolean,
169
- object: () => Ts.Keyword.Object,
170
- file: () => Ts.Keyword.File,
171
- string: {
172
- $default: () => Ts.Keyword.String,
173
-
174
- /** formats */
175
- binary: () => Ts.Keyword.File,
176
- file: () => Ts.Keyword.File,
177
- "date-time": () => Ts.Keyword.String,
178
- time: () => Ts.Keyword.String,
179
- date: () => Ts.Keyword.String,
180
- duration: () => Ts.Keyword.String,
181
- email: () => Ts.Keyword.String,
182
- "idn-email": () => Ts.Keyword.String,
183
- "idn-hostname": () => Ts.Keyword.String,
184
- ipv4: () => Ts.Keyword.String,
185
- ipv6: () => Ts.Keyword.String,
186
- uuid: () => Ts.Keyword.String,
187
- uri: () => Ts.Keyword.String,
188
- "uri-reference": () => Ts.Keyword.String,
189
- "uri-template": () => Ts.Keyword.String,
190
- "json-pointer": () => Ts.Keyword.String,
191
- "relative-json-pointer": () => Ts.Keyword.String,
192
- regex: () => Ts.Keyword.String,
193
- },
194
- array: ({ items, ...schemaPart }, parser) => {
195
- const content = parser.getInlineParseContent(items);
196
- return parser.checkAndAddNull(schemaPart, Ts.ArrayType(content));
197
- },
198
- }
199
- ```
200
-
201
- ## Other
202
- feat: `--another-array-type` cli option (#414)
203
- fix: path params with dot style (truck.id) (#413)
204
-
205
-
206
-
207
- # 10.0.3
208
- fix: CRLF -> LF (#423)
209
- docs: add docs for addReadonly nodeJS api flag (#425)
210
- chore: remove useless trailing whitespaces which make test edit harder (thanks @qboot, #422)
211
- internal: add test snapshots (git diff + nodejs assertions)
212
- chore: add logging (project version, node version, npm version)
213
-
214
- # 10.0.2
215
-
216
- fix: host.fileExists is not a function
217
- fix: other problems linked with new typescript version (4.8.*) (thanks @elkeis, @Jnig)
218
- fix: problem with required nested properties based on root required properties list
219
- fix: fetch http client headers content type priority
220
- fix: fs.rmSync (thanks @smorimoto)
221
- fix: locally overridden security schemes (security flag) (#418, thanks @EdwardSalter)
222
- docs: add documentation for `unwrapResponseData` nodejs option (thanks @simowe)
223
- BREAKING_CHANGE: rename `.eta` file extensions to `.ejs`. Backward capability should be existed.
224
- fix: problem with `--sort-types` option
225
-
226
- # 10.0.*
227
-
228
- fix: problem with default http request headers in axios client
229
-
230
- # 10.0.1
231
-
232
- - fix problem linked with [this.name is not a function](https://github.com/acacode/swagger-typescript-api/issues/381)
233
- - [internal] add cli tests
234
- - fix problem with not correct working the `--no-client` option
235
- - separate data-contracts.ejs onto 4 pieces (enum, interface, type, jsdoc)
236
-
237
- # 10.0.0
238
-
239
- - `--extract-response-body` option - extract response body type to data contract
240
- - `--extract-response-error` option - extract response error type to data contract
241
- - `--add-readonly` option - generate readonly properties
242
- - `authorizationToken` for axios fetch swagger schema request
243
- - fix: change COMPLEX_NOT_OF to COMPLEX_NOT (internal)
244
- - feat: improve `@deprecated` jsdoc info
245
- - feat: improve `required` field in complex data schemas (anyOf, oneOf, allOf etc)
246
- - feat: abortSignal for fetch http client
247
- - chore: improve typings in index.d.ts
248
- - fixed [Request falls if FormData attachment is File instance](https://github.com/acacode/swagger-typescript-api/issues/293)
249
- - fixed [Response format - global default or override ?](https://github.com/acacode/swagger-typescript-api/issues/251)
250
-
251
- > Co-authored-by: Sergey S. Volkov <js2me@outlook.com>
252
- > Co-authored-by: Xavier Cassel <57092100+xcassel@users.noreply.github.com>
253
- > Co-authored-by: cassel <xavier.cassel35@gmail.com>
254
- > Co-authored-by: Adrian Wieprzkowicz <Argeento@users.noreply.github.com>
255
- > Co-authored-by: EvgenBabenko <evgen.babenko@gmail.com>
256
- > Co-authored-by: RoCat <catoio.romain@gmail.com>
257
- > Co-authored-by: rcatoio <rcatoio@doubletrade.com>
258
- > Co-authored-by: 卡色 <cipchk@qq.com>
259
- > Co-authored-by: 江麻妞 <50100681+jiangmaniu@users.noreply.github.com>
260
- > Co-authored-by: Kasper Moskwiak <kasper.moskwiak@gmail.com>
261
- > Co-authored-by: Ben Watkins <ben@outdatedversion.com>
262
- > Co-authored-by: bonukai <bonukai@protonmail.com>
263
- > Co-authored-by: baggoedw <92381702+baggoedw@users.noreply.github.com>
264
- > Co-authored-by: Marcus Dunn <51931484+MarcusDunn@users.noreply.github.com>
265
- > Co-authored-by: Daniele De Matteo <daniele@kuama.net>
266
- > Co-authored-by: Daniel Playfair Cal <daniel.playfair.cal@gmail.com>
267
- > Co-authored-by: Anders Cassidy <anders.cassidy@dailypay.com>
268
- > Co-authored-by: Daniel Playfair Cal <dcal@atlassian.com>
269
-
270
- # 9.2.0
271
-
272
- Features:
273
- - full response typing for status code, data and headers. (#272, thanks @rustyconover)
274
- - --unwrap-response-data to unwrap the data item from the response (#268, thanks @laktak)
275
-
276
- Fixes:
277
- - fix: formdata in axios template (#277, thanks @tiagoskaneta)
278
-
279
- # 9.1.2
280
-
281
- Fixes:
282
- - Bug with --single-http-client and private `http` property
283
-
284
- # 9.1.1
285
-
286
- Fixes:
287
- - Bug with nested objects in FormData (issue #262, thanks @avlnche64)
288
-
289
- # 9.1.0
290
-
291
- Fixes:
292
- - Critical bug linked with `templateRequire` in ETA templates
293
- - Critical bugs linked with `--type-prefix`, `--type-suffix`
294
-
295
- Internal:
296
- - Improve manual testing scripts
297
-
298
- # 9.0.2
299
-
300
- Fixes:
301
- - 9.0.1 won't build with tsc when imported (thanks @mastermatt)
302
-
303
- # 9.0.1
304
-
305
- Fixes:
306
- - Can't compile 9.0.0 version (thanks @Nihisil )
307
-
308
- # 9.0.0
309
-
310
- NOTE: This version is not compatible with previous templates (removed `route.request.params`, `apiConfig.props`, `apiConfig.generic`, `apiConfig.description`, `apiConfig.hasDescription`)
311
-
312
- Fixes:
313
- - Consider 2xx a successful status (thanks @wyozi)
314
- - GET method query option bug (thanks @rhkdgns95, @SaschaGalley)
315
- - `silent` property missed in `.d.ts` file (thanks @mastermatt)
316
- - axios file upload `formData` type (thanks @guhyeon)
317
- - make property `instance` to public in axios http client (It can be helpful in #226)
318
- - variable name "params" doesn't uniq (thanks @mixalbl4-127 )
319
-
320
- Features:
321
- - `--disableProxy` option (thanks @kel666)
322
- - `--extract-request-body` option. Allows to extract request body type to data contract
323
- - Add TSDoc tag for deprecated route (thanks @wyozi)
324
-
325
-
326
- # 8.0.3
327
-
328
- - Fixes encoding array query params in `fetch` http templates (thanks @prog13)
329
-
330
- # 8.0.2
331
-
332
- Fixes:
333
- - Wrong working the `format` option in `fetch` http client
334
-
335
- # 8.0.1
336
-
337
- Fixes:
338
- - Not working `customFetch`
339
- Error: `Failed to execute 'fetch' on 'Window': Illegal invocation`
340
-
341
- # 8.0.0
342
-
343
- BREAKING_CHANGES:
344
- - remove default `json` format of the response type (both for `axios` and `fetch` http clients) (issue #213, thanks @po5i)
345
-
346
- Features:
347
- - Allow passing custom fetch function (`fetch` http client only)
348
- - Allow to set global response type format through `HttpClient` constructor
349
- Example:
350
- ```ts
351
- const httpClient = new HttpClient({ format: 'json' });
352
- // all request responses will been formatted as json
353
- ```
354
- Fixes:
355
- - Missing `schema.$ref` in inline enum schemas
356
- - Array query param values are serialized with the (non-default) comma separated style (issue #222, thanks @Styn, PR #223)
357
- - TypeScript error "TS6133: 'E' is declared but its value is never read." (`axios` http client) (issue #220, thanks @pmbednarczyk )
358
-
359
- # 7.0.1
360
-
361
- Fixes:
362
- - "securityWorker" is only used if "secure" option is specified on each request (issue #212, thanks @dkamyshov)
363
- NOTE: added global `secure` option for `axios` http client
364
- - `index.d.ts` file (add `rawModelTypes`)
365
-
366
- # 7.0.0
367
-
368
- BREAKING_CHANGES:
369
- - format `namespace` name in `--route-types` as camelCase with upper first capitalized letter
370
- `foo_bar` -> `FooBar`
371
-
372
- Fixes:
373
- - Incorrect working the `--route-types` option with `--modular` option (route types should be splitted on files)
374
- - Fix critical bug linked with enums with boolean type (thanks @haedaal)
375
-
376
- Features:
377
- - Ability to return `false` in `onCreateRoute` hook, it allow to ignore route
378
- - Add output util functions
379
- ```ts
380
- createFile: (params: {
381
- path: string;
382
- fileName: string;
383
- content: string;
384
- withPrefix?: boolean;
385
- }) => void;
386
- renderTemplate: (
387
- templateContent: string,
388
- data: Record<string, unknown>,
389
- etaOptions?: import("eta/dist/types/config").PartialConfig
390
- ) => string;
391
- getTemplate: (params: {
392
- fileName?: string;
393
- name?: string;
394
- path?: string;
395
- }) => string
396
- formatTSContent: (content: string) => string;
397
-
398
-
399
- // ...
400
-
401
- generateApi({ /* ... */ }).then(({ createFile, renderTemplate, getTemplate }) => {
402
- // do something
403
- })
404
- ```
405
-
406
- # 6.4.2
407
-
408
- Fixes:
409
- - Bug with missing `name` property in in-path requests parameters
410
- - Problem with usage `--route-types` with `--modular` option (mising import data contracts)
411
-
412
- # 6.4.1
413
-
414
- Fixes:
415
- - Bug with axios headers (thanks @mutoe)
416
-
417
- # 6.4.0
418
-
419
- Features:
420
- - `onFormatRouteName(routeInfo: RawRouteInfo, templateRouteName: string)` hook. Allows to format route name, as you like :)
421
-
422
- Fixes:
423
- - Bug with wrong complex types (anyOf, oneOf, allOf) when some child schema contains only description
424
- ![example](./assets/changelog_assets/fixComplexTypeAny.jpg)
425
- - Bug with number enums which have `x-enumNames`
426
- - Problem with not existing `title` property in `info`
427
-
428
- Minor:
429
- - Improve description for complex types
430
- - Improve description in single api file
431
-
432
- # 6.3.0
433
-
434
- Features:
435
- - `--type-suffix` option. Allows to set suffix for data contract name. (issue #191, thanks @the-ult)
436
- - `--type-prefix` option. Allows to set prefix for data contract name. (issue #191, thanks @the-ult)
437
- Examples [here](./spec/typeSuffixPrefix/schema.ts)
438
- - `onFormatTypeName(usageTypeName, rawTypeName)` hook. Allow to format data contract names as you want.
439
-
440
- Internal:
441
- - rename and split `checkAndRenameModelName` -> `formatModelName`, `fixModelName`
442
-
443
- # 6.2.1
444
-
445
- Fixes:
446
- - missing `generateUnionEnums?: boolean;` in `index.d.ts` file (thanks @artsaban)
447
- - missing default params to axios http client (`--axios`) (issue #192, thanks @Nihisil)
448
-
449
- # 6.2.0
450
-
451
- Features:
452
- - `--module-name-first-tag` option. Splits routes based on the first tag (thanks @jnpoyser)
453
-
454
- # 6.1.2
455
-
456
- Fixes:
457
- - Problems with using both `--axios` and `--modular` options together (TS, `organizeImports` crashed the codegeneration)
458
-
459
- # 6.1.1
460
-
461
- Fixes:
462
- - Problems with `--axios` option
463
- - ignoring `path`, `format`, `type` payload properties in `request()` method of `HttpClient`
464
- - Missing `format` property for requests in `--modular` option
465
-
466
- # 6.1.0
467
-
468
- Features:
469
- - `--silent` option. Output only errors to console (default: false)
470
-
471
- Fixes:
472
- - Bug with `kebab-case` path params (issue #184, thanks @Mr-sgreen)
473
- - Typings for `--js` option
474
-
475
- # 6.0.0
476
-
477
- BREAKING_CHANGES:
478
- - Ability to override only one template (issue #166, thanks @Nihisil)
479
- - removed `TPromise` type for `--responses` options (perf. problem, issue #182, thanks @mixalbl4-127)
480
- - breaking changes in `http-client.eta`
481
- - `securityWorker` now can return `Promise<RequestParams | void> | RequestParams | void`
482
-
483
- Features:
484
- - template path prefixes `@base`, `@default`, `@modular` (using in Eta templates, `includeFile()`, see README.md)
485
- - `--axios` option for axios http client (issue #142, thanks @msklvsk, @mixalbl4-127 )
486
-
487
- # 5.1.7
488
-
489
- Fixes:
490
- - Do not fail if template file does not exist (issue #166, thanks @armsnyder )
491
- Caveat: With this fix it will still error if the overridden template uses `includeFile` on a template file that is not overridden
492
-
493
- # 5.1.6
494
-
495
- Fixes:
496
- - The contentFormatter for ContentType:Json does not correctly format strings (issue #176, thanks @Styn)
497
-
498
- # 5.1.5
499
-
500
- Fixes:
501
- - ContentType.FormData no longer sets the correct boundary (issue #172, thanks @Styn)
502
-
503
- # 5.1.4
504
-
505
- Fixes:
506
- - header overwrite in `default` and `modular` API templates (issue #171 by @Styn, thanks @emilecantin for PR with fix)
507
-
508
- # 5.1.3
509
-
510
- Fixes:
511
- - Ignored `x-nullable` field
512
- - Schema type names which starts with number or special characters
513
-
514
- # 5.1.2
515
-
516
- Fixes:
517
- - Linter disable rules is not working (issue #164, thanks @Haritaso)
518
-
519
- # 5.1.1
520
-
521
- Fixes:
522
- - The HttpResponse type is no longer exported from http-client (issue #161, thanks @Styn)
523
-
524
- # 5.1.0
525
-
526
- Fixes:
527
- - Bug with optional nested properties of object schema type (issue #156, thanks @Fabiencdp)
528
-
529
- Features:
530
- - `onCreateRouteName(routeNameInfo: RouteNameInfo, rawRouteInfo: RawRouteInfo): RouteNameInfo | void` hook
531
- Which allows to customize route name without customizing `route-name.eta` template
532
- - Improved content kinds for request infos
533
- - `--single-http-client` option which allows to send HttpClient instance to Api constructor and not to create many count of HttpClient instances with `--modular` api (issue #155)
534
-
535
- Minor:
536
- - A bit improve type declaration file (index.d.ts) for this tool
537
- - make exportable `ApiConfig` interface
538
-
539
- Internal:
540
- - clearing `routeNameDuplicatesMap` before each `parseRoutes()` function call
541
- - Changed templates:
542
- - `http-client.eta`
543
- - `procedure-call.eta`
544
- - `api.eta`
545
-
546
- # 5.0.0
547
-
548
- Fixes:
549
- - Request content types auto substitution
550
- i.e. if request body is form data, then request body content type will be `multipart/form-data`
551
- - Strange method name (issue #152, thanks @RoXuS)
552
- - Hardcoded Content-Type causes issues with some endpoints (issue #153, thanks @po5i)
553
- - Critical bug with `:paramName` path params (issue #154)
554
-
555
- Features:
556
- - Ability to provide custom formatting `fetch` response
557
- - `"IMAGE"` content kind for response\request data objects
558
- - `RequestParams` `RequestHeaders` types for `--route-types` (`routeTypes: true`) option (issue #150, thanks @Fabiencdp )
559
- - `--default-response` option. Allows to set default type for empty response schema (default: `void`) (based on issue #14)
560
- - Request cancellation support (issue #96, thanks @ApacheEx)
561
- `RequestParams` type now have the `cancelToken` field
562
- `HttpClient` instance now have the `abortRequest(cancelToken)` method
563
-
564
- BREAKING_CHANGES:
565
- - Fully refactored `http-client.eta` template, make it more flexible and simpler.
566
- `HttpClient["request"]` takes one argument with type `FullRequestParams`
567
- (previously it takes many count of arguments which was not flexible)
568
- - Changed the default response body type from `any` to `void` (issue #14)
569
-
570
- Internal:
571
- - Changed templates:
572
- - `http-client.eta`
573
- - `procedure-call.eta`
574
- - `api.eta`
575
-
576
- This version works with previous templates.
577
-
578
- # 4.4.0
579
-
580
- Fixes:
581
- - Client generation for `Content-Type: application/x-www-form-urlencoded` (issue #146, thanks @Larox)
582
-
583
- Internal:
584
- - Changed templates:
585
- - `http-client.eta`
586
- - `procedure-call.eta`
587
-
588
- # 4.3.0
589
-
590
- Fixes:
591
- - enum + nullable: true doesn't compute the good type (issue #145, thanks @RoXuS)
592
- - Underscores are omitted from enum keys (issue #108, thanks @eolant)
593
- - CLI silently fails if the directory to put new files in doesn't exist yet (issue #141, thanks @Styn)
594
-
595
- Features:
596
- - Improved type description
597
-
598
- Internal:
599
- - dependencies update:
600
- - `"js-yaml": "^4.0.0"` (`"^3.14.1"`)
601
- - `"make-dir": "^3.1.0"`
602
- - `"swagger2openapi": "^7.0.5"` (`"^7.0.4"`)
603
- - Difference in templates:
604
- - `data-contracts.eta`
605
- ![dataContracts430](./assets/changelog_assets/http-client-template-diff-4.3.0.jpg)
606
-
607
- # 4.2.0
608
- Features:
609
- - new hook `onCreateRequestParams` which allows modify request params (`--extract-request-params` option) before sending it to route info
610
- ![onCreateRequestParams](./assets/changelog_assets/onCreateRequestParamsHook.jpg)
611
- How to use:
612
- ```ts
613
- generateApi({
614
- // ... your config,
615
- hooks: {
616
- onCreateRequestParams: (rawType) => {
617
- if (Object.keys(rawType.properties).length > 1) return rawType;
618
-
619
- return rawType;
620
- }
621
- }
622
- })
623
- ```
624
- - response content types (array of string like `application/json`, `image/png`) which allows to customize declaration of request response
625
- Exist in `procedure-call.eta` template `it.route.response.contentTypes`
626
-
627
- Internal:
628
- - Difference in templates:
629
- - `procedure-call.eta`
630
- ![procedureCallEta1](./assets/changelog_assets/changes_procedure_call_1.jpg)
631
-
632
-
633
- # 4.1.0
634
-
635
- Features:
636
- - Improve `require()` function used in ETA templates (using relative path imports)
637
- - `--clean-output` option.
638
- clean output folder before generate api
639
-
640
- Fixes:
641
- - Error: `Unexpected token =` (Issue #136, Thanks @jlow-mudbath)
642
- - Output folder creation (Issue #137, Thanks @Rinta01)
643
- Create output folder if it is not exist
644
-
645
- # 4.0.5
646
-
647
- BREAKING_CHANGE:
648
- - remove `'prettier-plugin-organize-imports'` dependency from package
649
-
650
- Fixes:
651
- - issue #134 (Thanks @mrfratello)
652
-
653
- # 4.0.4
654
-
655
- Features:
656
- - add `require()` to template `utils` object
657
-
658
- Docs:
659
- - add information about contributors
660
-
661
- # 4.0.3
662
-
663
- Features:
664
- - `--disableStrictSSL` option for disable strict SSL statement with fetching swagger schema. (Thanks @kel666 for PR with feature request)
665
- This option fix problem #114
666
-
667
- # 4.0.2
668
-
669
- Fixes:
670
- - `Unexpected token '.'` on v4 (Thanks @savingprivatebryan for issue #111)
671
- Replaced all new syntax sugar like `?.` or `??` to prev. alternatives for support nodejs 12
672
-
673
- # 4.0.1
674
-
675
- Fixes:
676
- - `Cannot find module 'prettier-plugin-organize-imports'` #109
677
-
678
- # 4.0.0
679
-
680
- BREAKING_CHANGES:
681
- - Migrate from [mustache](https://mustache.github.io/) template engine to [ETA](https://eta.js.org/) template engine. (Thanks @Fl0pZz)
682
- - Critical change in `HttpResponse` type (Remove `D | null`, `E | null` unions)
683
- ```diff
684
- interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
685
- - data: D | null;
686
- + data: D;
687
- - error: E | null;
688
- + error: E;
689
- }
690
- ```
691
-
692
- Features:
693
- - `--modular` option. Allows to generate api class per module name.
694
- Example: [here](./tests/spec/modular)
695
- - new templates on [ETA](https://eta.js.org/) (enhanced EJS) which can improve your templates! (Thanks @Fl0pZz)
696
- [ETA extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=shadowtime2000.eta-vscode) (thanks @shadowtime2000)
697
- Also moved out to templates:
698
- - `procedure-call.eta` (request api method template)
699
- - `route-name.eta` (api method name template)
700
- - `route-docs.eta` (api method docs template)
701
-
702
- No worry about strange syntax it is very simple in usage :)
703
- - Optional templates feature (Except templates using in `includeFile` `ETA` directive)
704
- Now you can store only the `ETA` templates which you need to change for yourself.
705
- - `--extract-request-params` option. Generate path and query request params data contract and modify request payload args
706
- Example:
707
- ![extract-request-params](./assets/changelog_assets/extractRequestParams.jpg)
708
- - Improve `data-contracts.eta` template. Added more power :)
709
- - Add `extraTemplates` property for `generateApi()`. Allows to generate extra files via this tool.
710
- - Add `hooks` property for `generateApi()`
711
- ```ts
712
- hooks?: Partial<{
713
- onCreateComponent: (component: SchemaComponent) => SchemaComponent | void;
714
- onParseSchema: (originalSchema: any, parsedSchema: any) => any | void;
715
- onCreateRoute: (routeData: ParsedRoute) => ParsedRoute | void;
716
- /** Start point of work this tool (after fetching schema) */
717
- onInit?: <C extends GenerateApiConfiguration["config"]>(configuration: C) => C | void;
718
- /** Allows to customize configuration object before sending it to templates. */
719
- onPrepareConfig?: <C extends GenerateApiConfiguration>(currentConfiguration: C) => C | void;
720
- }>;
721
- ```
722
- ```ts
723
- generateApi({
724
- input: "./schema.json",
725
- output: "./__generated__",
726
- hooks: {
727
- onCreateComponent(component) {
728
- // do something
729
- return component;
730
- },
731
- // ...
732
- }
733
- })
734
- ```
735
-
736
- Internal:
737
- - Update all dependencies to latest
738
-
739
- Fixes:
740
- - `x-enumNames` support for enums
741
- - Problem of complex types (`oneOf`, `allOf`) with `properties` field
742
- - `additionalProperties: true` should make `[key: string]: any` for object types (Thanks @brookjordan for issue #103)
743
-
744
- Common:
745
- - `HttpClient` is exportable by default
746
- - Improve typings when use `swagger-typescript-api` with NodeJS (`index.d.ts`)
747
-
748
- # 3.1.2
749
- Fixes:
750
- - axios vulnerability (#101 issue, thanks @Mvbraathen)
751
-
752
- # 3.1.1
753
-
754
- Fixes:
755
- - `name.includes is not a function` (issue #98)
756
-
757
- # 3.1.0
758
-
759
- Features:
760
- - `--moduleNameIndex` option. determines which path index should be used for routes separation (Thanks @nikalun)
761
- Examples:
762
- GET:api/v1/fruites/getFruit -> index:2 -> moduleName -> fruites
763
- GET:api/v1/fruites/getFruit -> index:0 -> moduleName -> api
764
-
765
- # 3.0.1
766
-
767
- Fixes:
768
- - invalid default templates path (#92, thanks @larrybotha for quick fix)
769
-
770
- # 3.0.0
771
-
772
- BREAKING_CHANGES:
773
- - Renamed mustache templates:
774
- - `api.mustache` -> `data-contracts.mustache`
775
- - `client.mustache` -> `http.client.mustache` + `api.mustache`
776
- - Split the `client.mustache` template into two parts: `http-client.mustache` and `api.mustache`
777
-
778
- Fixes:
779
- - Fixed unsafe clone() of Response causing json() hang. (Thanks @Benjamin-Dobell)
780
-
781
- # 2.0.0
782
-
783
- Features:
784
- - `--js` CLI option. [[feature request]](https://github.com/acacode/swagger-typescript-api/issues/79)
785
-
786
- BREAKING_CHANGES:
787
- - Requests returns `Promise<HttpResponse<Data, Error>>` type.
788
- `HttpResponse` it is [Fetch.Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) wrapper with fields `data` and `error`
789
- Example:
790
- ```ts
791
- const api = new Api()
792
-
793
- //
794
- const response: HttpResponse<Data, Error> = await api.fruits.getAll()
795
-
796
- response.data // Data (can be null if response.ok is false)
797
- response.error // Error (can be null if response.ok is true)
798
- ```
799
- - Breaking changes in the `client.mustache` template. Needs to update local custom templates.
800
-
801
- Fixes:
802
- - Security configuration in methods. When the security definition is in the main configuration of the swagger definition
803
-
804
-
805
- # 1.12.0
806
-
807
- Features:
808
- - Can provide ability to generate from swagger JSON directly not from a file? #69 (Thanks @JennieJi)
809
-
810
- Fixes:
811
- - handling `x-omitempty` property for definition properties #68
812
- - Additional properties map to empty interfaces (OpenAPI v3) #76
813
- - Pattern fields in Path Item Object are treated as operations #75
814
- - Remove const enum from default template #73
815
- - enums with spaces throw an error #71
816
-
817
-
818
- # 1.11.0
819
-
820
- Features:
821
- - Improve the naming of model types ([#65 issue](https://github.com/acacode/swagger-typescript-api/issues/65))
822
-
823
- # 1.10.0
824
-
825
- Features:
826
- - `--templates` CLI option. [[feature request]](https://github.com/acacode/swagger-typescript-api/issues/54)
827
- Provide custom `mustache` templates folder which allows to generate custom code (models, Api class, routes)
828
- - `--union-enums` CLI option. [[feature request]](https://github.com/acacode/swagger-typescript-api/issues/58)
829
- Allows to generate all enums as union types.
830
- For example, schema part:
831
- ```
832
- "StringEnum": {
833
- "enum": ["String1", "String2", "String3", "String4"],
834
- "type": "string"
835
- }
836
- ```
837
- will be converted into:
838
- ```
839
- export type StringEnum = "String1" | "String2" | "String3" | "String4";
840
- ```
841
-
842
-
843
- # 1.8.4
844
-
845
- Fixes:
846
- - Multiple types for a property in Swagger 2 are not handled correctly ([#55 issue](https://github.com/acacode/swagger-typescript-api/issues/55))
847
-
848
- # 1.8.3
849
-
850
- Fixes:
851
- - Generating invalid code in composed schema contexts ([#51 issue](https://github.com/acacode/swagger-typescript-api/issues/51))
852
- ```yaml
853
- components:
854
- schemas:
855
- Test:
856
- type: object
857
- allOf:
858
- - type: object
859
- properties:
860
- x:
861
- type: array
862
- items:
863
- type: string
864
- enum:
865
- - A-B
866
- - type: object
867
- properties:
868
- y:
869
- type: string
870
- ```
871
- ```ts
872
- export type Test = XAB & { y?: string };
873
- ```
874
-
875
- # 1.8.2
876
-
877
- Fixes:
878
- - Broken types for arrays of union types ([issue](https://github.com/acacode/swagger-typescript-api/issues/49))
879
-
880
- # 1.8.1
881
-
882
- Fixes:
883
- - form data request body (request body content `multipart/form-data`)
884
-
885
- Minor:
886
- - inline comments of the data contract type properties
887
- ![one line comments](./assets/changelog_assets/one-line-comments.jpg)
888
- - remove `Array<T>` type usage (now the more simple type `T[]`)
889
-
890
- # 1.8.0
891
-
892
- Features:
893
-
894
- - **Partially** support FormData body types
895
- - Support to generate query params of nested query objects (Partial fix of [this issue](https://github.com/acacode/swagger-typescript-api/issues/45))
896
-
897
-
898
- # 1.7.2
899
-
900
- Fixes:
901
-
902
- - Critical bug with converting inline object into name of type for request body.
903
- - Fix bug when path parameters is not set but contains in endpoint url.
904
- ![path params bug 1](./assets/changelog_assets/bug-with-no-path-args.jpg)
905
- ![path params bug 2](./assets/changelog_assets/bug-with-no-path-args2.jpg)
906
-
907
-
908
- # 1.7.0
909
-
910
- Breaking Changes:
911
-
912
- - Remove `title` and `version` public Api class properties (moved it to Api class JSDOC)([fixes this issue](https://github.com/acacode/swagger-typescript-api/issues/41))
913
- ![removed title and version properties](./assets/changelog_assets/removed-title-version-props.jpg)
914
- - Move out all http client handlers/properties into `HttpClient` local class in module
915
- ![http-client-class1](./assets/changelog_assets/http-client-class1.jpg)
916
- ![http-client-class2](./assets/changelog_assets/http-client-class2.jpg)
917
-
918
- Chore:
919
-
920
- - default value for `SecurityDataType` Api class generic type
921
-
922
-
923
- # 1.6.3
924
-
925
- Fixes:
926
-
927
- - Handling of nullable for $ref in OpenAPI 3.0 ([issue](https://github.com/acacode/swagger-typescript-api/issues/39))
928
- Plus based on this issue was fixed most other problems with using `required` and `nullable` properties
929
-
930
-
931
- # 1.6.2
932
-
933
- Fixes:
934
-
935
- - Nullable not included in type definition ([issue](https://github.com/acacode/swagger-typescript-api/issues/36))
936
-
937
- Internal:
938
-
939
- - Update `swagger2openapi`(`6.0.0`) dependency
940
-
941
- # 1.6.1
942
-
943
- Internal:
944
-
945
- - Update `prettier`(`2.0.2`), `swagger2openapi`(`5.4.0`) dependencies
946
-
947
- # 1.6.0
948
-
949
- Features:
950
-
951
- - Improvenment in optional request params (request body, query params, path params)
952
-
953
- Fixes:
954
-
955
- - Fix bug when `path` request param have the same name as `query`
956
- - Fix bug when `path` request param have the same name as `params`
957
-
958
- Minor/Internal:
959
-
960
- - changed `addQueryParams()` method
961
- - up `swagger2openapi` dependency version to `5.3.4`
962
-
963
- # 1.5.0
964
-
965
- Features:
966
-
967
- - Add `prettier` for beautify output typescript api module
968
- - Support `additionalProperties` type data
969
- ![additional properties](./assets/changelog_assets/additional-properties-types.jpg)
970
-
971
- Fixes:
972
-
973
- - Fix problem with array `type` definitions without `type` property([#26](https://github.com/acacode/swagger-typescript-api/issues/26))
974
-
975
- # 1.4.1
976
-
977
- Fixes:
978
-
979
- - Fix TS problem with `addQueryParams` Api class method (issue [#22](https://github.com/acacode/swagger-typescript-api/issues/22), thanks [genaby](https://github.com/genaby))
980
-
981
- # 1.4.0
982
-
983
- Breaking Changes:
984
-
985
- - Rename default typescript output api file name (prev `api.ts`, now `Api.ts`)
986
- Features:
987
- - `-d, --default-as-success` option. Allows to use "default" status codes as success response type
988
- - `-r, --responses` option. Response declarations in request rescription
989
- This option adds comments of the possible responses from request
990
- ![responses comments](./assets/changelog_assets/responses-comments.jpg)
991
- Also typings for `.catch()` callback
992
- ![responses catch types](./assets/changelog_assets/responses-catch-types.jpg)
993
- - Improve response body type definitions
994
- - Types for bad responses
995
- Changes:
996
- - \[minor\] fix jsdoc comments space
997
- ![right comments space](./assets/changelog_assets/right-comments-space.jpg)
998
-
999
- # 1.3.0
1000
-
1001
- Features:
1002
-
1003
- - Api module description from schema info
1004
- ![api description](./assets/changelog_assets/api-module-description.jpg)
1005
- - Generate API type declarations (CLI flag `--route-types`, thanks [azz](https://github.com/azz))
1006
- ![route types](./assets/changelog_assets/route-types.jpg)
1007
- - Ability to not generate clint API class (CLI flag `--no-client`, thanks [azz](https://github.com/azz))
1008
-
1009
- Fixes:
1010
-
1011
- - Improve response body type definition
1012
-
1013
- Internal:
1014
-
1015
- - refactored `generate` and `validate` test scripts
1016
-
1017
- # 1.2.6
1018
-
1019
- Fixes: create api without `-o` option (use default `./` output)
1020
-
1021
- # 1.2.5
1022
-
1023
- Features: better naming of routes without `operationId`
1024
- ![route naming](./assets/changelog_assets/1.2.5_route_naming.jpg)
1025
- Changes: rename `@security true` -> `@secure`, `@duplicate true` -> `@duplicate`
1026
- Fixes: Support generated swagger schemes from tsoa 3.x with complex types (Omit, Pick, etc)
1027
-
1028
- # 1.2.4
1029
-
1030
- Features: add .d.ts file into npm package
1031
- Changes: update help block in CLI
1032
- Internal: add greenkeeper, update npm keywords
1033
-
1034
- # 1.2.3
1035
-
1036
- Features: @summary, @description comments at each route
1037
- Fixes: parsing schema without routes
1038
- Changes: update documentation
1039
- Internal: add anyOf, allOf test schemas, slack notifications in CI
1040
-
1041
- # 1.2.2
1042
-
1043
- Fixes: fix complex types (oneOf, anyOf), required fields of object type was not required
1044
-
1045
- # 1.2.0
1046
-
1047
- Changes: rename `ApiParams` to `RequestParams`, secure module always exist in generated API module, update documentation
1048
- Fixes: Query params was all required, parse yaml files, typescript minor warnings (;)
1049
- Internal: test schemas + manual testing, add travis CI/CD
1050
-
1051
- # 1.1.0
1052
-
1053
- Fixes: catching http errors with use API module
1054
-
1055
- # 1.0.9
1056
-
1057
- Features: add description to interfaces and their fields
1058
- Changes: update documentation
1059
-
1060
- # 1.0.8
1061
-
1062
- Changes: update documentation
1063
-
1064
- # 1.0.7
1065
-
1066
- Changes: update documentation (+ add logo), add comment about author in generated module
1067
-
1068
- # 1.0.6
1069
-
1070
- Fixes: route naming, http(s) requests for getting swagger schema, integer enums
1071
- Changes: include only required files into npm pacakge
1072
-
1073
- # 1.0.5
1074
-
1075
- Changes: update documentation
1076
-
1077
- # 1.0.4
1078
-
1079
- Changes: disable linters rules for generated API module
1080
- Fixes: TS issues in template
1081
-
1082
- # 1.0.3
1083
-
1084
- Fixes: NodeJS main script cannot been called on Unix\* machines
1085
- Changes: add LICENSE, update README
1086
-
1087
- # 1.0.2
1088
-
1089
- Changes(Internal): change dependencies
1090
-
1091
- # 1.0.1
1092
-
1093
- New features: query params, separating routes on submodules, common params in constructor, swagger v2 + yaml parsers
1094
- Enhancements: better type extracting.
1095
- Fixes: mustache escaping chars
1096
- Changes: order of request params, emojis messages in console
1097
-
1098
- # 1.0.0
1099
-
1100
- Initial project.