swagger-typescript-api 13.2.16 → 13.2.18

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/CHANGELOG.md DELETED
@@ -1,1770 +0,0 @@
1
- # swagger-typescript-api
2
-
3
- ## 13.2.16
4
-
5
- ### Patch Changes
6
-
7
- - [#1459](https://github.com/acacode/swagger-typescript-api/pull/1459) [`6b485dd`](https://github.com/acacode/swagger-typescript-api/commit/6b485dd70228a7e3697c4bd4a9ca5537e456f512) Thanks [@smorimoto](https://github.com/smorimoto)! - Downgrade eta from 4.0.1 to 3.5.0 to fix module resolution error.
8
-
9
- After the upgrade to eta@4.0.1 in version 13.2.11, API generation started
10
- failing with `ERR_PACKAGE_PATH_NOT_EXPORTED: No "exports" main defined in
11
- eta/package.json`. This issue is caused by incorrect package export
12
- configuration in eta@4.0.1, which is tracked in the upstream repository.
13
-
14
- Downgrading to eta@3.5.0 resolves the module resolution error whilst
15
- maintaining compatibility with the existing template system.
16
-
17
- Fixes #1427.
18
-
19
- ## 13.2.15
20
-
21
- ### Patch Changes
22
-
23
- - [`afc2448`](https://github.com/acacode/swagger-typescript-api/commit/afc24481bbbe891942264c1dacf1101e521f039a) Thanks [@js2me](https://github.com/js2me)! - added ability to override usageSchema and originalSchema after onInit hook and before all other operations
24
-
25
- ## 13.2.14
26
-
27
- ### Patch Changes
28
-
29
- - [#1398](https://github.com/acacode/swagger-typescript-api/pull/1398) [`d987aee`](https://github.com/acacode/swagger-typescript-api/commit/d987aee6a2f7dbf6edba73b58a2df2fceb32a876) Thanks [@k1rd3rf](https://github.com/k1rd3rf)! - Fix modular template to always generate class property syntax.
30
-
31
- The modular template was incorrectly using object method syntax (`:` and
32
- `,`) when route.namespace was present, introduced by PR #1326. This
33
- caused TypeScript syntax errors in generated code.
34
-
35
- The modular template should always generate class properties with arrow
36
- functions (`=` and `;`), regardless of namespace presence.
37
-
38
- This resolves the issue reported in #1366 where version 13.2.8 generated
39
- invalid TypeScript code with modular templates.
40
-
41
- ## 13.2.13
42
-
43
- ### Patch Changes
44
-
45
- - [#1424](https://github.com/acacode/swagger-typescript-api/pull/1424) [`aa79764`](https://github.com/acacode/swagger-typescript-api/commit/aa79764bc27fc1787924c46a5905769dccbf385c) Thanks [@smorimoto](https://github.com/smorimoto)! - Ensure discriminator mappings use union enum literals.
46
-
47
- Resolve discriminator mapping generation to use literal values when
48
- `generateUnionEnums` is enabled to avoid emitting enum member references.
49
- Add regression coverage that snapshots the discriminator output with
50
- union enums.
51
-
52
- - [#1422](https://github.com/acacode/swagger-typescript-api/pull/1422) [`724b0cd`](https://github.com/acacode/swagger-typescript-api/commit/724b0cd3d37acac1ac24fd547e2ad7af3a74bfd6) Thanks [@smorimoto](https://github.com/smorimoto)! - Replace `js-yaml` with `yaml`.
53
-
54
- Switch YAML parsing from `js-yaml` to `yaml`. Update the resolver to
55
- use `YAML.parse` when `JSON.parse` fails. Remove `js-yaml` and its types,
56
- add `yaml` as a runtime dependency. No public API changes.
57
-
58
- ## 13.2.12
59
-
60
- ### Patch Changes
61
-
62
- - [#1420](https://github.com/acacode/swagger-typescript-api/pull/1420) [`426433b`](https://github.com/acacode/swagger-typescript-api/commit/426433b3f6144b6f28f0b79614df28dd3dea2012) Thanks [@smorimoto](https://github.com/smorimoto)! - Move `@types/lodash` and `openapi-types` to dependencies.
63
-
64
- These type packages are referenced by the published declarations, so consumers
65
- require them at install time for correct type resolution. Moving them from
66
- `devDependencies` prevents downstream TypeScript errors whilst having no
67
- runtime impact.
68
-
69
- ## 13.2.11
70
-
71
- ### Patch Changes
72
-
73
- - [#1390](https://github.com/acacode/swagger-typescript-api/pull/1390) [`5897e4b`](https://github.com/acacode/swagger-typescript-api/commit/5897e4ba1e3d21adf9ccb161bfc6eb0f1dde966c) Thanks [@MatanAvneri](https://github.com/MatanAvneri)! - Fix being able to call getComponentByRef from templates.
74
-
75
- - [#1393](https://github.com/acacode/swagger-typescript-api/pull/1393) [`9a7c788`](https://github.com/acacode/swagger-typescript-api/commit/9a7c788edc8efefbb8412bcc331e909b80ece317) Thanks [@RoCat](https://github.com/RoCat)! - Ensure discriminators are just after enums in components list to avoid cyclic errors.
76
-
77
- - [#1416](https://github.com/acacode/swagger-typescript-api/pull/1416) [`cd127a9`](https://github.com/acacode/swagger-typescript-api/commit/cd127a94e3386ef5eece740ba9335715fb7d13e0) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix fetch client response parsing without re-reading body.
78
-
79
- ## 13.2.10
80
-
81
- ### Patch Changes
82
-
83
- - [`7b7351f`](https://github.com/acacode/swagger-typescript-api/commit/7b7351f90b250f7702cb57976c5c293ede353312) Thanks [@js2me](https://github.com/js2me)! - Fix missing exported interfaces and types.
84
-
85
- ## 13.2.9
86
-
87
- ### Patch Changes
88
-
89
- - [#1384](https://github.com/acacode/swagger-typescript-api/pull/1384) [`0caea2c`](https://github.com/acacode/swagger-typescript-api/commit/0caea2c9c1132b2ba5e74ec51d9cb12b73e32f5e) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix enum const parsing for substrings of primitive types.
90
-
91
- - [#1381](https://github.com/acacode/swagger-typescript-api/pull/1381) [`ba052f4`](https://github.com/acacode/swagger-typescript-api/commit/ba052f4038b53358381caa0a20d1edc07a59e7bd) Thanks [@smorimoto](https://github.com/smorimoto)! - Support extracting request parameters for routes that only declare path parameters, such as `DELETE` methods.
92
-
93
- - [#1382](https://github.com/acacode/swagger-typescript-api/pull/1382) [`792e96c`](https://github.com/acacode/swagger-typescript-api/commit/792e96c44255bd5e2f26a5043959a9e1693df896) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix enum string value quoting when schema type mismatches.
94
-
95
- - [#1385](https://github.com/acacode/swagger-typescript-api/pull/1385) [`859fc64`](https://github.com/acacode/swagger-typescript-api/commit/859fc64aa4fd58f024d17d516cb82c916abacfe6) Thanks [@smorimoto](https://github.com/smorimoto)! - Avoid response cloning in fetch HTTP client to prevent memory leaks (#779).
96
-
97
- - [#1383](https://github.com/acacode/swagger-typescript-api/pull/1383) [`8191970`](https://github.com/acacode/swagger-typescript-api/commit/8191970c479d24236c80b5068bcab2f5f10597cd) Thanks [@smorimoto](https://github.com/smorimoto)! - Automatically extract enums when using enum names as values.
98
-
99
- - [#1376](https://github.com/acacode/swagger-typescript-api/pull/1376) [`bec35e8`](https://github.com/acacode/swagger-typescript-api/commit/bec35e8b885a6b69dceec06487690f1ea81dbea0) Thanks [@smorimoto](https://github.com/smorimoto)! - Merge `GenerateApiParamsBase` into `GenerateApiConfiguration` to remove duplicated type definitions and expose missing configuration fields. Document configuration defaults with JSDoc tags.
100
-
101
- - [#1378](https://github.com/acacode/swagger-typescript-api/pull/1378) [`912e521`](https://github.com/acacode/swagger-typescript-api/commit/912e5217868973943197b03dd67b26108e430c6f) Thanks [@smorimoto](https://github.com/smorimoto)! - Allow partial `extractingOptions` in `generateApi` configuration.
102
-
103
- - [#1380](https://github.com/acacode/swagger-typescript-api/pull/1380) [`fec0a09`](https://github.com/acacode/swagger-typescript-api/commit/fec0a09774512d7254bbc5bbebee22858812adb8) Thanks [@smorimoto](https://github.com/smorimoto)! - Add test verifying primitive + object `anyOf` unions.
104
-
105
- - [#1376](https://github.com/acacode/swagger-typescript-api/pull/1376) [`bec35e8`](https://github.com/acacode/swagger-typescript-api/commit/bec35e8b885a6b69dceec06487690f1ea81dbea0) Thanks [@smorimoto](https://github.com/smorimoto)! - Restore `modular` option typing in `generateApi` parameters.
106
-
107
- - [#1379](https://github.com/acacode/swagger-typescript-api/pull/1379) [`339a167`](https://github.com/acacode/swagger-typescript-api/commit/339a167d5dc46e128d8e960490c701fb85aa4cef) Thanks [@smorimoto](https://github.com/smorimoto)! - Support synchronous `require` in templates using Node's `createRequire`.
108
-
109
- ## 13.2.8
110
-
111
- ### Patch Changes
112
-
113
- - [#1326](https://github.com/acacode/swagger-typescript-api/pull/1326) [`99b5f50`](https://github.com/acacode/swagger-typescript-api/commit/99b5f5055bfdf207d9dfe316ef8ff2490d474443) Thanks [@thejhh](https://github.com/thejhh)! - Fix TypeScript generation failure for operationIds starting with numbers
114
-
115
- **What:** Fixed an issue where operationIds starting with numbers (e.g., "123getUser") would cause TypeScript generation to fail due to invalid identifier names.
116
-
117
- **Why:** OperationIds that start with numbers are not valid JavaScript identifiers, causing syntax errors in the generated TypeScript code.
118
-
119
- **How:** Modified the template logic to quote property names for invalid identifiers. OperationIds starting with numbers are now generated as quoted properties (e.g., `"123GetUser": ...`) instead of unquoted invalid identifiers.
120
-
121
- This resolves GitHub issue #952.
122
-
123
- - [#1008](https://github.com/acacode/swagger-typescript-api/pull/1008) [`c2d3e6a`](https://github.com/acacode/swagger-typescript-api/commit/c2d3e6aab97d57a8cd7788c8e2adc909bcf26e1f) Thanks [@frazar](https://github.com/frazar)! - Fix handling of FormData inputs in Fetch HTTP client
124
-
125
- Previously, when users passed a `FormData` object directly to the Fetch
126
- client's `multipart/form-data` formatter, it would incorrectly attempt to use
127
- `Object.keys()` on the FormData instance, which returns an empty array. This
128
- caused the FormData to be processed incorrectly.
129
-
130
- The fix adds a type check to return FormData instances unchanged, allowing
131
- users to have full control over FormData construction when needed whilst
132
- maintaining backwards compatibility for object inputs. This aligns the Fetch
133
- client behaviour with the existing Axios client implementation.
134
-
135
- This resolves issues where users needed to send multipart requests with
136
- multiple entries for the same key, which is only possible with direct FormData
137
- manipulation.
138
-
139
- ## 13.2.7
140
-
141
- ### Patch Changes
142
-
143
- - [#1308](https://github.com/acacode/swagger-typescript-api/pull/1308) [`36fc899`](https://github.com/acacode/swagger-typescript-api/commit/36fc899c9078e9df55ef97dfb83cbf654914fd7a) Thanks [@js2me](https://github.com/js2me)! - add missing required state for query param with $ref
144
-
145
- ## 13.2.6
146
-
147
- ### Patch Changes
148
-
149
- - [#1306](https://github.com/acacode/swagger-typescript-api/pull/1306) [`fe125cb`](https://github.com/acacode/swagger-typescript-api/commit/fe125cb6820621447f2cbf35c8bc0604fcc466dd) Thanks [@js2me](https://github.com/js2me)! - better extracting description for request body extacting types
150
-
151
- ## 13.2.5
152
-
153
- ### Patch Changes
154
-
155
- - [#1302](https://github.com/acacode/swagger-typescript-api/pull/1302) [`790fece`](https://github.com/acacode/swagger-typescript-api/commit/790fecea92920ecc996d90dbad5a984421e16aa8) Thanks [@js2me](https://github.com/js2me)! - added support x-propertyNames, propertyNames for object types
156
-
157
- ## 13.2.4
158
-
159
- ### Patch Changes
160
-
161
- - [#1299](https://github.com/acacode/swagger-typescript-api/pull/1299) [`9552c0a`](https://github.com/acacode/swagger-typescript-api/commit/9552c0a3341583be69aaa2cdf2b4e830a1919b01) Thanks [@js2me](https://github.com/js2me)! - added support of x-enum-descriptions property
162
-
163
- ## 13.2.3
164
-
165
- ### Patch Changes
166
-
167
- - [#1293](https://github.com/acacode/swagger-typescript-api/pull/1293) [`a87883b`](https://github.com/acacode/swagger-typescript-api/commit/a87883bdeb3e71330b8aab7d26ae62b68b51e323) Thanks [@smorimoto](https://github.com/smorimoto)! - Bump Biome to 2.0.
168
-
169
- ## 13.2.2
170
-
171
- ### Patch Changes
172
-
173
- - [#1287](https://github.com/acacode/swagger-typescript-api/pull/1287) [`87da340`](https://github.com/acacode/swagger-typescript-api/commit/87da340e5583eef6fd487c15318e396d9908c9f3) Thanks [@smorimoto](https://github.com/smorimoto)! - Pin versions of internal Biome packages.
174
-
175
- ## 13.2.1
176
-
177
- ### Patch Changes
178
-
179
- - [#1260](https://github.com/acacode/swagger-typescript-api/pull/1260) [`31b628f`](https://github.com/acacode/swagger-typescript-api/commit/31b628f3f553e3d5024ff711a46c810151ea6521) Thanks [@parsaghk](https://github.com/parsaghk)! - Fix enum key generation for values like `ENUM_123_VALUE_456`.
180
-
181
- - [#1277](https://github.com/acacode/swagger-typescript-api/pull/1277) [`3fd6224`](https://github.com/acacode/swagger-typescript-api/commit/3fd62241a75a2578961069b799b850941cfc4545) Thanks [@smorimoto](https://github.com/smorimoto)! - Revert "Integrate `generateCommand` arguments and run method into main command (#1198)".
182
-
183
- - [`8a059bd`](https://github.com/acacode/swagger-typescript-api/commit/8a059bdd005a7af540148bf01c3eeda4a6d7dbdb) Thanks [@smorimoto](https://github.com/smorimoto)! - Update Node.js version requirements.
184
-
185
- ## 13.2.0
186
-
187
- ### Minor Changes
188
-
189
- - [#1187](https://github.com/acacode/swagger-typescript-api/pull/1187) [`1039ff1`](https://github.com/acacode/swagger-typescript-api/commit/1039ff1ac1c40c1875e31799ae9405f2f57862fd) Thanks [@gletournel](https://github.com/gletournel)! - Add support for json:api content type.
190
-
191
- ### Patch Changes
192
-
193
- - [#1225](https://github.com/acacode/swagger-typescript-api/pull/1225) [`a013686`](https://github.com/acacode/swagger-typescript-api/commit/a013686d8ce4e82bc16e5159d35a7fd1870497ab) Thanks [@smorimoto](https://github.com/smorimoto)! - Update the internal Biome to latest beta release.
194
-
195
- - [#1266](https://github.com/acacode/swagger-typescript-api/pull/1266) [`469ded7`](https://github.com/acacode/swagger-typescript-api/commit/469ded79d412b9fd4b3bed8dd493f63ebf48331f) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update the internal Biome to latest beta release.
196
-
197
- - [#1235](https://github.com/acacode/swagger-typescript-api/pull/1235) [`0e251bb`](https://github.com/acacode/swagger-typescript-api/commit/0e251bb042bdec35fd6efa714868486ff882c7e4) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix typos in CLI option description and warning message.
198
-
199
- - [#1270](https://github.com/acacode/swagger-typescript-api/pull/1270) [`c79625e`](https://github.com/acacode/swagger-typescript-api/commit/c79625e785b26926f1e1ca20a4ba847952a557da) Thanks [@smorimoto](https://github.com/smorimoto)! - Remove `required` field from command definitions for now.
200
-
201
- ## 13.1.3
202
-
203
- ### Patch Changes
204
-
205
- - [#1200](https://github.com/acacode/swagger-typescript-api/pull/1200) [`3cc0194`](https://github.com/acacode/swagger-typescript-api/commit/3cc01941e25be15856eabde81417401a12d73ec5) Thanks [@smorimoto](https://github.com/smorimoto)! - Search `swagger-typescript-api.config` instead of `config` by default.
206
-
207
- ## 13.1.2
208
-
209
- ### Patch Changes
210
-
211
- - [#1198](https://github.com/acacode/swagger-typescript-api/pull/1198) [`1cb1c9c`](https://github.com/acacode/swagger-typescript-api/commit/1cb1c9c0d39dacefb89a6b44eaf2a6266334f3c6) Thanks [@smorimoto](https://github.com/smorimoto)! - Integrate `generateCommand` arguments and run method into main command.
212
-
213
- ## 13.1.1
214
-
215
- ### Patch Changes
216
-
217
- - [#1163](https://github.com/acacode/swagger-typescript-api/pull/1163) [`e477b58`](https://github.com/acacode/swagger-typescript-api/commit/e477b5850504b3f4829b2749d1dbc5d310e9bca1) Thanks [@RoXuS](https://github.com/RoXuS)! - Ensure enums are at the top of the components to avoid issue on recursive schema parsing.
218
-
219
- ## 13.1.0
220
-
221
- ### Minor Changes
222
-
223
- - [#1144](https://github.com/acacode/swagger-typescript-api/pull/1144) [`ea1df18`](https://github.com/acacode/swagger-typescript-api/commit/ea1df18aebec54109972f22e32199a5aeacf7c7f) Thanks [@smorimoto](https://github.com/smorimoto)! - Use `c12` for wider configuration file format support.
224
-
225
- ### Patch Changes
226
-
227
- - [#1171](https://github.com/acacode/swagger-typescript-api/pull/1171) [`c1cc45a`](https://github.com/acacode/swagger-typescript-api/commit/c1cc45a6f27698f2b21cc35696cf529b0e9a210d) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix TypeScript declaration file path.
228
-
229
- - [#1149](https://github.com/acacode/swagger-typescript-api/pull/1149) [`9d2d66a`](https://github.com/acacode/swagger-typescript-api/commit/9d2d66ab52a7eaba70b51cf2d52e6528f7f69ff5) Thanks [@smorimoto](https://github.com/smorimoto)! - Re-add TypeScript definitions for better type support.
230
-
231
- - [#1145](https://github.com/acacode/swagger-typescript-api/pull/1145) [`73f6bfd`](https://github.com/acacode/swagger-typescript-api/commit/73f6bfddb501211a30f9dca0e1098f905761badb) Thanks [@smorimoto](https://github.com/smorimoto)! - Replace Prettier with Biome as the code formatter to improve performance during the code generation phase.
232
-
233
- - [#1141](https://github.com/acacode/swagger-typescript-api/pull/1141) [`821bfad`](https://github.com/acacode/swagger-typescript-api/commit/821bfad0dc8dffc7a8571a052b38f96c3d1c8087) Thanks [@dding-g](https://github.com/dding-g)! - Remove redundant `union-enums` option in favor of `generate-union-enums`.
234
-
235
- ## 13.0.28
236
-
237
- ### Patch Changes
238
-
239
- - [`6851bdc`](https://github.com/acacode/swagger-typescript-api/commit/6851bdcafa83a80a2be09ea3d95b2ec45b81d24a) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix description for `client` option in `generateCommand`.
240
-
241
- - [#1121](https://github.com/acacode/swagger-typescript-api/pull/1121) [`5eadf67`](https://github.com/acacode/swagger-typescript-api/commit/5eadf67b038ef16f0489c6c7b614f3fdc57f1498) Thanks [@takayukioda](https://github.com/takayukioda)! - Fix to not use `no-` prefix in options.
242
-
243
- - [`edca5de`](https://github.com/acacode/swagger-typescript-api/commit/edca5ded764b0fa4356ac49389f5d71b6784352d) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix option name for `generateUnionEnums` in `generateCommand`.
244
-
245
- - [`9fa8f41`](https://github.com/acacode/swagger-typescript-api/commit/9fa8f4113c8c24070da79cf2d3242ba433ca94d3) Thanks [@smorimoto](https://github.com/smorimoto)! - Sort the CLI arguments alphabetically.
246
-
247
- ## 13.0.27
248
-
249
- ### Patch Changes
250
-
251
- - [#1119](https://github.com/acacode/swagger-typescript-api/pull/1119) [`c5e8d45`](https://github.com/acacode/swagger-typescript-api/commit/c5e8d45d08edad509c23b3f66c2a6c0ffed570a2) Thanks [@smorimoto](https://github.com/smorimoto)! - Add `shims` option in tsup configuration and update `rootDir` path in templates generation process.
252
-
253
- - [#1119](https://github.com/acacode/swagger-typescript-api/pull/1119) [`c5e8d45`](https://github.com/acacode/swagger-typescript-api/commit/c5e8d45d08edad509c23b3f66c2a6c0ffed570a2) Thanks [@smorimoto](https://github.com/smorimoto)! - Resolve internal references in Swagger v2 to OpenAPI v3 conversion by adding `resolveInternal` option and enhancing type definitions for request payloads.
254
-
255
- - [#1119](https://github.com/acacode/swagger-typescript-api/pull/1119) [`c5e8d45`](https://github.com/acacode/swagger-typescript-api/commit/c5e8d45d08edad509c23b3f66c2a6c0ffed570a2) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix default value for `no-client` option in `generateCommand` to `false`.
256
-
257
- - [#1119](https://github.com/acacode/swagger-typescript-api/pull/1119) [`c5e8d45`](https://github.com/acacode/swagger-typescript-api/commit/c5e8d45d08edad509c23b3f66c2a6c0ffed570a2) Thanks [@smorimoto](https://github.com/smorimoto)! - Add `required` property to output path in `generateTemplatesCommand`.
258
-
259
- - [#1119](https://github.com/acacode/swagger-typescript-api/pull/1119) [`c5e8d45`](https://github.com/acacode/swagger-typescript-api/commit/c5e8d45d08edad509c23b3f66c2a6c0ffed570a2) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix documentation and type definition to align with actual implementation by renaming `name` to `fileName`.
260
-
261
- ## 13.0.26
262
-
263
- ### Patch Changes
264
-
265
- - [#1106](https://github.com/acacode/swagger-typescript-api/pull/1106) [`9208816`](https://github.com/acacode/swagger-typescript-api/commit/920881663b9601e026b1798896f41eeb6112cd91) Thanks [@smorimoto](https://github.com/smorimoto)! - Add boolean type for `extract-request-params` in command configuration.
266
-
267
- - [#1106](https://github.com/acacode/swagger-typescript-api/pull/1106) [`c124f88`](https://github.com/acacode/swagger-typescript-api/commit/c124f888e93547f408ed15cb2ca41b9ed145c1d2) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix generateClient logic to exclude only `no-client` argument.
268
-
269
- - [#1108](https://github.com/acacode/swagger-typescript-api/pull/1108) [`1e3b70e`](https://github.com/acacode/swagger-typescript-api/commit/1e3b70ea476ef4b5a6cdb407ce250a58ff64368b) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix default value for `no-client` argument in command configuration.
270
-
271
- - [#1106](https://github.com/acacode/swagger-typescript-api/pull/1106) [`4809884`](https://github.com/acacode/swagger-typescript-api/commit/480988407de42d5be5a2be58bd700e2e3dc89e37) Thanks [@smorimoto](https://github.com/smorimoto)! - Initialise `customConfig` to `undefined` in command run function.
272
-
273
- ## 13.0.25
274
-
275
- ### Patch Changes
276
-
277
- - [#1102](https://github.com/acacode/swagger-typescript-api/pull/1102) [`13da52a`](https://github.com/acacode/swagger-typescript-api/commit/13da52aa9eab24f90f06316943e810b34767324b) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix CLI executable by adding the required shebang to the entry file.
278
-
279
- - [#1102](https://github.com/acacode/swagger-typescript-api/pull/1102) [`13da52a`](https://github.com/acacode/swagger-typescript-api/commit/13da52aa9eab24f90f06316943e810b34767324b) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix query params detection on route name parsing
280
-
281
- - [#1102](https://github.com/acacode/swagger-typescript-api/pull/1102) [`13da52a`](https://github.com/acacode/swagger-typescript-api/commit/13da52aa9eab24f90f06316943e810b34767324b) Thanks [@smorimoto](https://github.com/smorimoto)! - Improve type safety by adding proper types to SchemaComponent and introducing flags for extracted elements such as request parameters, request body, response body, and response errors.
282
-
283
- ## 13.0.24
284
-
285
- ### Patch Changes
286
-
287
- - [#1046](https://github.com/acacode/swagger-typescript-api/pull/1046) [`40dd9d8`](https://github.com/acacode/swagger-typescript-api/commit/40dd9d864d69a897f53880c991bed7257d290b97) Thanks [@AugusDogus](https://github.com/AugusDogus)! - Respect debug and silent logging configuration for both cli and lib modes
288
-
289
- - [#1048](https://github.com/acacode/swagger-typescript-api/pull/1048) [`bd49e34`](https://github.com/acacode/swagger-typescript-api/commit/bd49e34dee067101d997aab44224cf01ffd10e82) Thanks [@smorimoto](https://github.com/smorimoto)! - Remove types fields from package.json as there are no types yet
290
-
291
- - [#929](https://github.com/acacode/swagger-typescript-api/pull/929) [`1e2e00e`](https://github.com/acacode/swagger-typescript-api/commit/1e2e00e373b0aa405adb7bf27f5b4d4d1d457875) Thanks [@BoltDoggy](https://github.com/BoltDoggy)! - Fix route regex pattern in route name generation
292
-
293
- - [#701](https://github.com/acacode/swagger-typescript-api/pull/701) [`0a71f2b`](https://github.com/acacode/swagger-typescript-api/commit/0a71f2b381c40433bc86e39c174e448cb9a14572) Thanks [@nicky1038](https://github.com/nicky1038)! - Remove unnecessary camel case conversion for query params
294
-
295
- - [#1041](https://github.com/acacode/swagger-typescript-api/pull/1041) [`47381de`](https://github.com/acacode/swagger-typescript-api/commit/47381dec5fde08e96d49164997db9592755dc08a) Thanks [@Jerome1337](https://github.com/Jerome1337)! - Add ts-nocheck comment to auto-generated file
296
-
297
- ## 13.0.23
298
-
299
- - use import pattern that supports windows external drives by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/983
300
-
301
- ## 13.0.22
302
-
303
- - Consola by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/903
304
-
305
- ## 13.0.21
306
-
307
- - Fix `e.values(...).some is not a function` by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/884
308
-
309
- ## 13.0.20
310
-
311
- - Fix #880 by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/881
312
-
313
- ## 13.0.19
314
-
315
- - Use default export for lodash by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/878
316
-
317
- ## 13.0.18
318
-
319
- - This was a version bump only, there were no code changes.
320
-
321
- ## 13.0.17
322
-
323
- - Fix types by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/872
324
- - Fix build warnings by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/873
325
- - Reduce use of lodash by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/874
326
- - Fix build warnings by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/875
327
-
328
- ## 13.0.16
329
-
330
- - Revert "Fix contentFormatter for FormData returning an empty FormData object" by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/863
331
-
332
- ## 13.0.15
333
-
334
- - Make types slightly better by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/859
335
- - Set the build target to Node.js 18 by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/861
336
-
337
- ## 13.0.14
338
-
339
- - fix: format option of requests when using extractResponseBody by @TaopaiC in https://github.com/acacode/swagger-typescript-api/pull/742
340
- - Fix #671 - Content-Type: "multipart/form-data" is ignored (when using axios) by @cf-dlangston in https://github.com/acacode/swagger-typescript-api/pull/831
341
-
342
- ## 13.0.13
343
-
344
- - Fix types by @raing3 in https://github.com/acacode/swagger-typescript-api/pull/825
345
- - Custom config: handle default export by @shrpne in https://github.com/acacode/swagger-typescript-api/pull/828
346
-
347
- ## 13.0.12
348
-
349
- - Fix types by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/812
350
-
351
- ## 13.0.11
352
-
353
- - Fix contentFormatter for FormData returning an empty FormData object by @JorensM in https://github.com/acacode/swagger-typescript-api/pull/747
354
- - Checking if instanceof FormData before creating one by @dolevl in https://github.com/acacode/swagger-typescript-api/pull/680
355
- - feat: add security in raw route info by @xfoxfu in https://github.com/acacode/swagger-typescript-api/pull/602
356
- - Get rid of `require` by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/807
357
-
358
- ## 13.0.10
359
-
360
- - Add support for both ESM and CJS by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/803
361
-
362
- ## 13.0.9
363
-
364
- - ESM by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/788
365
-
366
- ## 13.0.8
367
-
368
- - Fix type errors by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/787
369
-
370
- ## 13.0.7
371
-
372
- - fix: support shared prettier config files by @pebo in https://github.com/acacode/swagger-typescript-api/pull/781
373
-
374
- ## 13.0.6
375
-
376
- - Relax version constraints on dependencies by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/773
377
- - Keep some dependency constraints tight by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/774
378
-
379
- ## 13.0.5
380
-
381
- - This was a version bump only, there were no code changes.
382
-
383
- ## 13.0.4
384
-
385
- - add missing apiClassName to GenerateApiParamsBase by @Mearman in https://github.com/acacode/swagger-typescript-api/pull/635
386
- - fix: fix options manipulation by @vgprst in https://github.com/acacode/swagger-typescript-api/pull/631
387
- - Fix typos by @szepeviktor in https://github.com/acacode/swagger-typescript-api/pull/698
388
- - The default branch has been renamed and the next branch has been deprecated by @smorimoto in https://github.com/acacode/swagger-typescript-api/pull/735
389
- - Clone the response in fetch HTTP client by @depsimon in https://github.com/acacode/swagger-typescript-api/pull/670
390
-
391
- ## 13.0.3
392
-
393
- fix: problem with type `any` as base type of discriminator schema (cases when schema without discriminator is empty)
394
-
395
- ## 13.0.2
396
-
397
- fix: problem with incorrect settings type suffix for internal discriminator mappings
398
-
399
- ## 13.0.1
400
-
401
- feat: `const` keyword OpenAPI 3.0 draft
402
- fix: problem with using `anyOf`
403
- feat: `--extract-responses` (nodejs: `extractResponses`) option to extract all schemas from `/components/responses`
404
- fix: discriminator and mapping with invalid discriminator property name (#551)
405
- fix: problem with incorrect resolving type name of discriminator mapping types data contracts
406
-
407
- ## 13.0.0
408
-
409
- BREAKING_CHANGE: disable support NodeJS 14.x
410
- BREAKING_CHANGE: change swagger-typescript-api NodeJS "generateApi" function return type
411
- BREAKING_CHANGE: remove `rawModelTypes` from output api configuration
412
- feat: `--custom-config <string>` option (#503)
413
- feat: `--sort-routes` option, ability to sort routes;
414
- fix: critical bugs based with extract types and enums
415
- fix: sort types option (sort was not correctly work with nested or extracted types)
416
- fix: problems based with extracting enums;
417
- fix: nullable enum with integer values (#543)
418
- fix: generation enum numbers as strings one (#534)
419
- chore: refactoring the axios imports
420
- fix: non-object custom spec extensions (#500)
421
- fix(docs): input instead of output in readme
422
- internal: remove redundant internal scripts
423
- internal: change process with using custom templates
424
-
425
- ```diff
426
- interface GenerateApiOutput {
427
- ...
428
- - files: { name: string; content: string; declaration: { name: string; content: string } | null }[];
429
- + files: { fileName: string; fileContent: string; fileExtension: string }[];
430
- ...
431
- }
432
- ```
433
-
434
- internal: refactor schema parser code (preparing it for async code execution)
435
- fix: problem with filtering primitive in complex types (#459)
436
- feat: add discriminator property support (#456)
437
- internal: prepare code + templates for async code execution (next plans)
438
- fix: problems with dot in query params (hard fix) (#460)
439
- feature: ability to send custom Ts output code translator to js. Example:
440
-
441
- ```ts
442
- const {
443
- Translator,
444
- } = require("swagger-typescript-api/src/translators/translator");
445
- const {
446
- JavascriptTranslator,
447
- } = require("swagger-typescript-api/src/translators/javascript");
448
-
449
- class MyTranslator extends Translator {
450
- // or use extends JavascriptTranslator
451
- translate({ fileName, fileExtension, fileContent }) {
452
- // format ts\js code with using this codeFormatter (prettier + ts import fixer)
453
- this.codeFormatter.format(fileContent);
454
- // config of the code gen process
455
- // logger
456
- this.config.this.logger.return[
457
- {
458
- fileName,
459
- fileExtension,
460
- fileContent,
461
- }
462
- ];
463
- }
464
- }
465
- ```
466
-
467
- ## 12.0.4
468
-
469
- fix: onCreateRoute skip behaviour
470
- fix: problems with prefixes\suffixes for extracted requests params, enums
471
-
472
- **Full Changelog**: https://github.com/acacode/swagger-typescript-api/compare/12.0.3...12.0.4
473
-
474
- ## 12.0.3
475
-
476
- security: update the `eta` package to address CVE-2022-25967
477
-
478
- ## 12.0.2
479
-
480
- fix: missing option `--extract-enums` (#344)
481
-
482
- ## 12.0.1
483
-
484
- fix: problem based with http requests and `disableStrictSSL` option (#453)
485
- docs: update docs for `requestOptions` nodejs option
486
-
487
- ## 12.0.0
488
-
489
- new hooks:
490
-
491
- ```ts
492
- /** calls before parse\process route path */
493
- onPreBuildRoutePath: (routePath: string) => string | void;
494
- /** calls after parse\process route path */
495
- onBuildRoutePath: (data: BuildRoutePath) => BuildRoutePath | void;
496
- /** calls before insert path param name into string path interpolation */
497
- onInsertPathParam: (paramName: string, index: number, arr: BuildRouteParam[], resultRoute: string) => string | void;
498
- /** calls before parse any kind of schema */
499
- onPreParseSchema: (originalSchema: any, typeName: string, schemaType: string) => any;
500
- ```
501
-
502
- BREAKING_CHANGE: add ability to custom prefix for autofix invalid enum keys, invalid type names with nodejs options (`fixInvalidTypeNamePrefix: string`, `fixInvalidEnumKeyPrefix: string`)
503
- BREAKING_CHANGE: by default all component enum schemas (even numeric) extracting as `enum` TS constructions (#344)
504
- feature: ability to extract all enums from nested types\interfaces to `enum` TS construction using `--extract-enums` option (#344)
505
- feature: ability to modify route path params before insert them into string (request url, #446, with using hook `onInsertPathParam`)
506
- feature: (nodejs) ability to add prefix\suffix for type names and enum keys
507
-
508
- ```ts
509
- typePrefix?: string;
510
- typeSuffix?: string;
511
- enumKeyPrefix?: string;
512
- enumKeySuffix?: string;
513
- ```
514
-
515
- feature: ability to customize resolving process of the extracting type names (`extractingOptions` nodejs option)
516
-
517
- ```ts
518
- extractingOptions = {
519
- // requestBodySuffix: ["Payload", "Body", "Input"],
520
- // or
521
- // requestBodyNameResolver: (typeName, reservedNames) => string;
522
- // requestParamsSuffix: ["Params"],
523
- // or
524
- // requestParamsNameResolver: (typeName, reservedNames) => string;
525
- // responseBodySuffix: ["Data", "Result", "Output"],
526
- // or
527
- // responseBodyNameResolver: (typeName, reservedNames) => string;
528
- // responseErrorSuffix: ["Error", "Fail", "Fails", "ErrorData", "HttpError", "BadResponse"],
529
- // or
530
- // responseErrorNameResolver: (typeName, reservedNames) => string;
531
- };
532
- ```
533
-
534
- docs: update docs for `extraTemplates` option
535
- fix: problem with default name of single api file (Api.ts)
536
- fix: problem based with tuple types (#445)
537
- fix: problem with `defaultResponseType` declaration type
538
-
539
- ## 11.1.3
540
-
541
- fix: problems with `text/*` content types (axios, fetch http clients) (thanks @JochenDiekenbrock, #312, #443)
542
- fix: problem with `application/json*` content type (thanks @JochenDiekenbrock, #440, #441)
543
- fix: different query type parameters declarations (in route name `{?accountStatus,createdT`, #439)
544
-
545
- ## 11.1.2
546
-
547
- fix: problems with missing type imports in `.d.ts` files with using option `--js`
548
- internal: add extra spec tests
549
- fix: additionalProperties management problem in Swagger 2 (#343)
550
- fix: hanging cli after execution finished (#436, thanks @Soarc)
551
-
552
- ## 11.1.1
553
-
554
- fix: `--api-class-name` option has no default value (#433)
555
-
556
- ## 11.1.0
557
-
558
- BREAKING_CHANGE: replace `axios` to `node-fetch`
559
- feat: ability to send request options for getting swagger schema by url (`requestOptions` property)
560
-
561
- ## 11.0.2
562
-
563
- - fix: problems with --http-client option in `generate-templates` command
564
- - fix: rewrite file content in `generate-templates` command (`--rewrite` flag)
565
-
566
- ## 11.0.0
567
-
568
- ### Breaking changes
569
-
570
- - `data-contract-jsdoc.ejs` file uses new input structure. Please update your local copy.
571
- - new codebase (class way)
572
- - ability to change everything in codegen process configuration with using NodeJS Api
573
- - ability to call `generateApi` function 2 and more times per 1 NodeJS process.
574
- - new command `generate-templates` to create source templates
575
-
576
- ### [feature] Ability to generate source templates
577
-
578
- New command `generate-templates` which allow you to generate source templates which using with option `--templates`
579
-
580
- ### [feature] Ability to modify internal codegen typescript structs
581
-
582
- Everything which creates codegen about output typescript code now contains in `Ts` field in [`src/configuration`](src/configuration.js).
583
- And this thing is available for end user modifications with using NodeJS Cli option `codeGenConstructs`.
584
- It contains almost all which is not contains in `.eta`\ `.ejs` templates. For example: `Record<string, any>`, `readonly typeField?: value`, etc
585
-
586
- Structure of `Ts` property
587
-
588
- ```ts
589
- const Ts = {
590
- Keyword: {
591
- Number: "number",
592
- String: "string",
593
- Boolean: "boolean",
594
- Any: "any",
595
- Void: "void",
596
- Unknown: "unknown",
597
- Null: "null",
598
- Undefined: "undefined",
599
- Object: "object",
600
- File: "File",
601
- Date: "Date",
602
- Type: "type",
603
- Enum: "enum",
604
- Interface: "interface",
605
- Array: "Array",
606
- Record: "Record",
607
- Intersection: "&",
608
- Union: "|",
609
- },
610
- CodeGenKeyword: {
611
- UtilRequiredKeys: "UtilRequiredKeys",
612
- },
613
- /**
614
- * $A[] or Array<$A>
615
- */
616
- ArrayType: (content) => {
617
- if (this.anotherArrayType) {
618
- return Ts.TypeWithGeneric(Ts.Keyword.Array, [content]);
619
- }
620
-
621
- return `${Ts.ExpressionGroup(content)}[]`;
622
- },
623
- /**
624
- * "$A"
625
- */
626
- StringValue: (content) => `"${content}"`,
627
- /**
628
- * $A
629
- */
630
- BooleanValue: (content) => `${content}`,
631
- /**
632
- * $A
633
- */
634
- NumberValue: (content) => `${content}`,
635
- /**
636
- * $A
637
- */
638
- NullValue: (content) => content,
639
- /**
640
- * $A1 | $A2
641
- */
642
- UnionType: (contents) => _.join(_.uniq(contents), ` ${Ts.Keyword.Union} `),
643
- /**
644
- * ($A1)
645
- */
646
- ExpressionGroup: (content) => (content ? `(${content})` : ""),
647
- /**
648
- * $A1 & $A2
649
- */
650
- IntersectionType: (contents) =>
651
- _.join(_.uniq(contents), ` ${Ts.Keyword.Intersection} `),
652
- /**
653
- * Record<$A1, $A2>
654
- */
655
- RecordType: (key, value) =>
656
- Ts.TypeWithGeneric(Ts.Keyword.Record, [key, value]),
657
- /**
658
- * readonly $key?:$value
659
- */
660
- TypeField: ({ readonly, key, optional, value }) =>
661
- _.compact([
662
- readonly && "readonly ",
663
- key,
664
- optional && "?",
665
- ": ",
666
- value,
667
- ]).join(""),
668
- /**
669
- * [key: $A1]: $A2
670
- */
671
- InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`,
672
- /**
673
- * $A1 = $A2
674
- */
675
- EnumField: (key, value) => `${key} = ${value}`,
676
- /**
677
- * $A0.key = $A0.value,
678
- * $A1.key = $A1.value,
679
- * $AN.key = $AN.value,
680
- */
681
- EnumFieldsWrapper: (contents) =>
682
- _.map(contents, ({ key, value }) => ` ${Ts.EnumField(key, value)}`).join(
683
- ",\n"
684
- ),
685
- /**
686
- * {\n $A \n}
687
- */
688
- ObjectWrapper: (content) => `{\n${content}\n}`,
689
- /**
690
- * /** $A *\/
691
- */
692
- MultilineComment: (contents, formatFn) =>
693
- [
694
- ...(contents.length === 1
695
- ? [`/** ${contents[0]} */`]
696
- : ["/**", ...contents.map((content) => ` * ${content}`), " */"]),
697
- ].map((part) => `${formatFn ? formatFn(part) : part}\n`),
698
- /**
699
- * $A1<...$A2.join(,)>
700
- */
701
- TypeWithGeneric: (typeName, genericArgs) => {
702
- return `${typeName}${
703
- genericArgs.length ? `<${genericArgs.join(",")}>` : ""
704
- }`;
705
- },
706
- };
707
- ```
708
-
709
- ### [feature] Ability to modify swagger schema type/format to typescript construction translators
710
-
711
- Swagger schema has constructions like `{ "type": "string" | "integer" | etc, "format": "date-time" | "float" | "etc" }` where field `type` is not "readable" for TypeScript.
712
- And because of this `swagger-typescript-api` has key value group to translate swagger schema fields `type`/`format` to TypeScript constructions.
713
- See more about [swagger schema type/format data here](https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times)
714
- For example, current version of default configuration translates this schema
715
-
716
- ```json
717
- {
718
- "type": "string",
719
- "format": "date-time"
720
- }
721
- ```
722
-
723
- translates to
724
-
725
- ```ts
726
- string;
727
- ```
728
-
729
- If you need to see `Date` instead of `string` you are able to change it with using `primitiveTypeConstructs`
730
-
731
- ```ts
732
- generateApiForTest({
733
- // ...
734
- primitiveTypeConstructs: (construct) => ({
735
- string: {
736
- "date-time": "Date",
737
- },
738
- }),
739
- });
740
- ```
741
-
742
- Structure of `primitiveTypes` property
743
-
744
- ```ts
745
- const primitiveTypes = {
746
- integer: () => Ts.Keyword.Number,
747
- number: () => Ts.Keyword.Number,
748
- boolean: () => Ts.Keyword.Boolean,
749
- object: () => Ts.Keyword.Object,
750
- file: () => Ts.Keyword.File,
751
- string: {
752
- $default: () => Ts.Keyword.String,
753
-
754
- /** formats */
755
- binary: () => Ts.Keyword.File,
756
- file: () => Ts.Keyword.File,
757
- "date-time": () => Ts.Keyword.String,
758
- time: () => Ts.Keyword.String,
759
- date: () => Ts.Keyword.String,
760
- duration: () => Ts.Keyword.String,
761
- email: () => Ts.Keyword.String,
762
- "idn-email": () => Ts.Keyword.String,
763
- "idn-hostname": () => Ts.Keyword.String,
764
- ipv4: () => Ts.Keyword.String,
765
- ipv6: () => Ts.Keyword.String,
766
- uuid: () => Ts.Keyword.String,
767
- uri: () => Ts.Keyword.String,
768
- "uri-reference": () => Ts.Keyword.String,
769
- "uri-template": () => Ts.Keyword.String,
770
- "json-pointer": () => Ts.Keyword.String,
771
- "relative-json-pointer": () => Ts.Keyword.String,
772
- regex: () => Ts.Keyword.String,
773
- },
774
- array: ({ items, ...schemaPart }, parser) => {
775
- const content = parser.getInlineParseContent(items);
776
- return parser.safeAddNullToType(schemaPart, Ts.ArrayType(content));
777
- },
778
- };
779
- ```
780
-
781
- ### Other
782
-
783
- feat: `--another-array-type` cli option (#414)
784
- fix: path params with dot style (truck.id) (#413)
785
-
786
- ## 10.0.3
787
-
788
- fix: CRLF -> LF (#423)
789
- docs: add docs for addReadonly nodeJS api flag (#425)
790
- chore: remove useless trailing whitespaces which make test edit harder (thanks @qboot, #422)
791
- internal: add test snapshots (git diff + nodejs assertions)
792
- chore: add logging (project version, node version, npm version)
793
-
794
- ## 10.0.2
795
-
796
- fix: host.fileExists is not a function
797
- fix: other problems linked with new typescript version (4.8.\*) (thanks @elkeis, @Jnig)
798
- fix: problem with required nested properties based on root required properties list
799
- fix: fetch http client headers content type priority
800
- fix: fs.rmSync (thanks @smorimoto)
801
- fix: locally overridden security schemes (security flag) (#418, thanks @EdwardSalter)
802
- docs: add documentation for `unwrapResponseData` nodejs option (thanks @simowe)
803
- BREAKING_CHANGE: rename `.eta` file extensions to `.ejs`. Backward capability should be existed.
804
- fix: problem with `--sort-types` option
805
-
806
- ## 10.0.\*
807
-
808
- fix: problem with default http request headers in axios client
809
-
810
- ## 10.0.1
811
-
812
- - fix problem linked with [this.name is not a function](https://github.com/acacode/swagger-typescript-api/issues/381)
813
- - [internal] add cli tests
814
- - fix problem with not correct working the `--no-client` option
815
- - separate data-contracts.ejs onto 4 pieces (enum, interface, type, jsdoc)
816
-
817
- ## 10.0.0
818
-
819
- - `--extract-response-body` option - extract response body type to data contract
820
- - `--extract-response-error` option - extract response error type to data contract
821
- - `--add-readonly` option - generate readonly properties
822
- - `authorizationToken` for axios fetch swagger schema request
823
- - fix: change COMPLEX_NOT_OF to COMPLEX_NOT (internal)
824
- - feat: improve `@deprecated` jsdoc info
825
- - feat: improve `required` field in complex data schemas (anyOf, oneOf, allOf etc)
826
- - feat: abortSignal for fetch http client
827
- - chore: improve typings in index.d.ts
828
- - fixed [Request falls if FormData attachment is File instance](https://github.com/acacode/swagger-typescript-api/issues/293)
829
- - fixed [Response format - global default or override ?](https://github.com/acacode/swagger-typescript-api/issues/251)
830
-
831
- > Co-authored-by: Sergey S. Volkov <js2me@outlook.com>
832
- > Co-authored-by: Xavier Cassel <57092100+xcassel@users.noreply.github.com>
833
- > Co-authored-by: cassel <xavier.cassel35@gmail.com>
834
- > Co-authored-by: Adrian Wieprzkowicz <Argeento@users.noreply.github.com>
835
- > Co-authored-by: EvgenBabenko <evgen.babenko@gmail.com>
836
- > Co-authored-by: RoCat <catoio.romain@gmail.com>
837
- > Co-authored-by: rcatoio <rcatoio@doubletrade.com>
838
- > Co-authored-by: 卡色 <cipchk@qq.com>
839
- > Co-authored-by: 江麻妞 <50100681+jiangmaniu@users.noreply.github.com>
840
- > Co-authored-by: Kasper Moskwiak <kasper.moskwiak@gmail.com>
841
- > Co-authored-by: Ben Watkins <ben@outdatedversion.com>
842
- > Co-authored-by: bonukai <bonukai@protonmail.com>
843
- > Co-authored-by: baggoedw <92381702+baggoedw@users.noreply.github.com>
844
- > Co-authored-by: Marcus Dunn <51931484+MarcusDunn@users.noreply.github.com>
845
- > Co-authored-by: Daniele De Matteo <daniele@kuama.net>
846
- > Co-authored-by: Daniel Playfair Cal <daniel.playfair.cal@gmail.com>
847
- > Co-authored-by: Anders Cassidy <anders.cassidy@dailypay.com>
848
- > Co-authored-by: Daniel Playfair Cal <dcal@atlassian.com>
849
-
850
- ## 9.2.0
851
-
852
- Features:
853
-
854
- - full response typing for status code, data and headers. (#272, thanks @rustyconover)
855
- - --unwrap-response-data to unwrap the data item from the response (#268, thanks @laktak)
856
-
857
- Fixes:
858
-
859
- - fix: formdata in axios template (#277, thanks @tiagoskaneta)
860
-
861
- ## 9.1.2
862
-
863
- Fixes:
864
-
865
- - Bug with --single-http-client and private `http` property
866
-
867
- ## 9.1.1
868
-
869
- Fixes:
870
-
871
- - Bug with nested objects in FormData (issue #262, thanks @avlnche64)
872
-
873
- ## 9.1.0
874
-
875
- Fixes:
876
-
877
- - Critical bug linked with `templateRequire` in ETA templates
878
- - Critical bugs linked with `--type-prefix`, `--type-suffix`
879
-
880
- Internal:
881
-
882
- - Improve manual testing scripts
883
-
884
- ## 9.0.2
885
-
886
- Fixes:
887
-
888
- - 9.0.1 won't build with tsc when imported (thanks @mastermatt)
889
-
890
- ## 9.0.1
891
-
892
- Fixes:
893
-
894
- - Can't compile 9.0.0 version (thanks @Nihisil )
895
-
896
- ## 9.0.0
897
-
898
- NOTE: This version is not compatible with previous templates (removed `route.request.params`, `apiConfig.props`, `apiConfig.generic`, `apiConfig.description`, `apiConfig.hasDescription`)
899
-
900
- Fixes:
901
-
902
- - Consider 2xx a successful status (thanks @wyozi)
903
- - GET method query option bug (thanks @rhkdgns95, @SaschaGalley)
904
- - `silent` property missed in `.d.ts` file (thanks @mastermatt)
905
- - axios file upload `formData` type (thanks @guhyeon)
906
- - make property `instance` to public in axios http client (It can be helpful in #226)
907
- - variable name "params" doesn't uniq (thanks @mixalbl4-127 )
908
-
909
- Features:
910
-
911
- - `--disableProxy` option (thanks @kel666)
912
- - `--extract-request-body` option. Allows to extract request body type to data contract
913
- - Add TSDoc tag for deprecated route (thanks @wyozi)
914
-
915
- ## 8.0.3
916
-
917
- - Fixes encoding array query params in `fetch` http templates (thanks @prog13)
918
-
919
- ## 8.0.2
920
-
921
- Fixes:
922
-
923
- - Wrong working the `format` option in `fetch` http client
924
-
925
- ## 8.0.1
926
-
927
- Fixes:
928
-
929
- - Not working `customFetch`
930
- Error: `Failed to execute 'fetch' on 'Window': Illegal invocation`
931
-
932
- ## 8.0.0
933
-
934
- BREAKING_CHANGES:
935
-
936
- - remove default `json` format of the response type (both for `axios` and `fetch` http clients) (issue #213, thanks @po5i)
937
-
938
- Features:
939
-
940
- - Allow passing custom fetch function (`fetch` http client only)
941
- - Allow to set global response type format through `HttpClient` constructor
942
- Example:
943
-
944
- ```ts
945
- const httpClient = new HttpClient({ format: "json" });
946
- // all request responses will been formatted as json
947
- ```
948
-
949
- Fixes:
950
-
951
- - Missing `schema.$ref` in inline enum schemas
952
- - Array query param values are serialized with the (non-default) comma separated style (issue #222, thanks @Styn, PR #223)
953
- - TypeScript error "TS6133: 'E' is declared but its value is never read." (`axios` http client) (issue #220, thanks @pmbednarczyk )
954
-
955
- ## 7.0.1
956
-
957
- Fixes:
958
-
959
- - "securityWorker" is only used if "secure" option is specified on each request (issue #212, thanks @dkamyshov)
960
- NOTE: added global `secure` option for `axios` http client
961
- - `index.d.ts` file (add `rawModelTypes`)
962
-
963
- ## 7.0.0
964
-
965
- BREAKING_CHANGES:
966
-
967
- - format `namespace` name in `--route-types` as camelCase with upper first capitalized letter
968
- `foo_bar` -> `FooBar`
969
-
970
- Fixes:
971
-
972
- - Incorrect working the `--route-types` option with `--modular` option (route types should be splitted on files)
973
- - Fix critical bug linked with enums with boolean type (thanks @haedaal)
974
-
975
- Features:
976
-
977
- - Ability to return `false` in `onCreateRoute` hook, it allow to ignore route
978
- - Add output util functions
979
-
980
- ```ts
981
- createFile: (params: {
982
- path: string;
983
- fileName: string;
984
- content: string;
985
- withPrefix?: boolean;
986
- }) => void;
987
- renderTemplate: (
988
- templateContent: string,
989
- data: Record<string, unknown>,
990
- etaOptions?: import("eta/dist/types/config").PartialConfig
991
- ) => string;
992
- getTemplate: (params: {
993
- fileName?: string;
994
- name?: string;
995
- path?: string;
996
- }) => string
997
- formatTSContent: (content: string) => Promise<string>;
998
-
999
-
1000
- // ...
1001
-
1002
- generateApi({ /* ... */ }).then(({ createFile, renderTemplate, getTemplate }) => {
1003
- // do something
1004
- })
1005
- ```
1006
-
1007
- ## 6.4.2
1008
-
1009
- Fixes:
1010
-
1011
- - Bug with missing `name` property in in-path requests parameters
1012
- - Problem with usage `--route-types` with `--modular` option (mising import data contracts)
1013
-
1014
- ## 6.4.1
1015
-
1016
- Fixes:
1017
-
1018
- - Bug with axios headers (thanks @mutoe)
1019
-
1020
- ## 6.4.0
1021
-
1022
- Features:
1023
-
1024
- - `onFormatRouteName(routeInfo: RawRouteInfo, templateRouteName: string)` hook. Allows to format route name, as you like :)
1025
-
1026
- Fixes:
1027
-
1028
- - Bug with wrong complex types (anyOf, oneOf, allOf) when some child schema contains only description
1029
- ![example](./assets/changelog_assets/fixComplexTypeAny.jpg)
1030
- - Bug with number enums which have `x-enumNames`
1031
- - Problem with not existing `title` property in `info`
1032
-
1033
- Minor:
1034
-
1035
- - Improve description for complex types
1036
- - Improve description in single api file
1037
-
1038
- ## 6.3.0
1039
-
1040
- Features:
1041
-
1042
- - `--type-suffix` option. Allows to set suffix for data contract name. (issue #191, thanks @the-ult)
1043
- - `--type-prefix` option. Allows to set prefix for data contract name. (issue #191, thanks @the-ult)
1044
- Examples [here](./spec/typeSuffixPrefix/schema.ts)
1045
- - `onFormatTypeName(usageTypeName, rawTypeName, schemaType)` hook. Allow to format data contract names as you want.
1046
-
1047
- Internal:
1048
-
1049
- - rename and split `checkAndRenameModelName` -> `formatModelName`, `fixModelName`
1050
-
1051
- ## 6.2.1
1052
-
1053
- Fixes:
1054
-
1055
- - missing `generateUnionEnums?: boolean;` in `index.d.ts` file (thanks @artsaban)
1056
- - missing default params to axios http client (`--axios`) (issue #192, thanks @Nihisil)
1057
-
1058
- ## 6.2.0
1059
-
1060
- Features:
1061
-
1062
- - `--module-name-first-tag` option. Splits routes based on the first tag (thanks @jnpoyser)
1063
-
1064
- ## 6.1.2
1065
-
1066
- Fixes:
1067
-
1068
- - Problems with using both `--axios` and `--modular` options together (TS, `organizeImports` crashed the codegeneration)
1069
-
1070
- ## 6.1.1
1071
-
1072
- Fixes:
1073
-
1074
- - Problems with `--axios` option
1075
- - ignoring `path`, `format`, `type` payload properties in `request()` method of `HttpClient`
1076
- - Missing `format` property for requests in `--modular` option
1077
-
1078
- ## 6.1.0
1079
-
1080
- Features:
1081
-
1082
- - `--silent` option. Output only errors to console (default: false)
1083
-
1084
- Fixes:
1085
-
1086
- - Bug with `kebab-case` path params (issue #184, thanks @Mr-sgreen)
1087
- - Typings for `--js` option
1088
-
1089
- ## 6.0.0
1090
-
1091
- ### BREAKING_CHANGES:
1092
-
1093
- - Ability to override only one template (issue #166, thanks @Nihisil)
1094
- - removed `TPromise` type for `--responses` options (perf. problem, issue #182, thanks @mixalbl4-127)
1095
- - breaking changes in `http-client.eta`
1096
- - `securityWorker` now can return `Promise<RequestParams | void> | RequestParams | void`
1097
-
1098
- ### Features:
1099
-
1100
- - template path prefixes `@base`, `@default`, `@modular` (using in Eta templates, `includeFile()`, see README.md)
1101
- - `--axios` option for axios http client (issue #142, thanks @msklvsk, @mixalbl4-127 )
1102
-
1103
- ## 5.1.7
1104
-
1105
- ### Fixes:
1106
-
1107
- - Do not fail if template file does not exist (issue #166, thanks @armsnyder )
1108
- Caveat: With this fix it will still error if the overridden template uses `includeFile` on a template file that is not overridden
1109
-
1110
- ## 5.1.6
1111
-
1112
- ### Fixes:
1113
-
1114
- - The contentFormatter for ContentType:Json does not correctly format strings (issue #176, thanks @Styn)
1115
-
1116
- ## 5.1.5
1117
-
1118
- ### Fixes:
1119
-
1120
- - ContentType.FormData no longer sets the correct boundary (issue #172, thanks @Styn)
1121
-
1122
- ## 5.1.4
1123
-
1124
- ### Fixes:
1125
-
1126
- - header overwrite in `default` and `modular` API templates (issue #171 by @Styn, thanks @emilecantin for PR with fix)
1127
-
1128
- ## 5.1.3
1129
-
1130
- ### Fixes:
1131
-
1132
- - Ignored `x-nullable` field
1133
- - Schema type names which starts with number or special characters
1134
-
1135
- ## 5.1.2
1136
-
1137
- ### Fixes:
1138
-
1139
- - Linter disable rules is not working (issue #164, thanks @Haritaso)
1140
-
1141
- ## 5.1.1
1142
-
1143
- ### Fixes:
1144
-
1145
- - The HttpResponse type is no longer exported from http-client (issue #161, thanks @Styn)
1146
-
1147
- ## 5.1.0
1148
-
1149
- ### Fixes:
1150
-
1151
- - Bug with optional nested properties of object schema type (issue #156, thanks @Fabiencdp)
1152
-
1153
- ### Features:
1154
-
1155
- - `onCreateRouteName(routeNameInfo: RouteNameInfo, rawRouteInfo: RawRouteInfo): RouteNameInfo | void` hook
1156
- Which allows to customize route name without customizing `route-name.eta` template
1157
- - Improved content kinds for request infos
1158
- - `--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)
1159
-
1160
- ### Minor:
1161
-
1162
- - A bit improve type declaration file (index.d.ts) for this tool
1163
- - make exportable `ApiConfig` interface
1164
-
1165
- ### Internal:
1166
-
1167
- - clearing `routeNameDuplicatesMap` before each `parseRoutes()` function call
1168
- - Changed templates:
1169
- - `http-client.eta`
1170
- - `procedure-call.eta`
1171
- - `api.eta`
1172
-
1173
- ## 5.0.0
1174
-
1175
- ### Fixes:
1176
-
1177
- - Request content types auto substitution
1178
- i.e. if request body is form data, then request body content type will be `multipart/form-data`
1179
- - Strange method name (issue #152, thanks @RoXuS)
1180
- - Hardcoded Content-Type causes issues with some endpoints (issue #153, thanks @po5i)
1181
- - Critical bug with `:paramName` path params (issue #154)
1182
-
1183
- ### Features:
1184
-
1185
- - Ability to provide custom formatting `fetch` response
1186
- - `"IMAGE"` content kind for response\request data objects
1187
- - `RequestParams` `RequestHeaders` types for `--route-types` (`routeTypes: true`) option (issue #150, thanks @Fabiencdp )
1188
- - `--default-response` option. Allows to set default type for empty response schema (default: `void`) (based on issue #14)
1189
- - Request cancellation support (issue #96, thanks @ApacheEx)
1190
- `RequestParams` type now have the `cancelToken` field
1191
- `HttpClient` instance now have the `abortRequest(cancelToken)` method
1192
-
1193
- ### BREAKING_CHANGES:
1194
-
1195
- - Fully refactored `http-client.eta` template, make it more flexible and simpler.
1196
- `HttpClient["request"]` takes one argument with type `FullRequestParams`
1197
- (previously it takes many count of arguments which was not flexible)
1198
- - Changed the default response body type from `any` to `void` (issue #14)
1199
-
1200
- ### Internal:
1201
-
1202
- - Changed templates:
1203
- - `http-client.eta`
1204
- - `procedure-call.eta`
1205
- - `api.eta`
1206
-
1207
- This version works with previous templates.
1208
-
1209
- ## 4.4.0
1210
-
1211
- ### Fixes:
1212
-
1213
- - Client generation for `Content-Type: application/x-www-form-urlencoded` (issue #146, thanks @Larox)
1214
-
1215
- ### Internal:
1216
-
1217
- - Changed templates:
1218
- - `http-client.eta`
1219
- - `procedure-call.eta`
1220
-
1221
- # 4.3.0
1222
-
1223
- ### Fixes:
1224
-
1225
- - enum + nullable: true doesn't compute the good type (issue #145, thanks @RoXuS)
1226
- - Underscores are omitted from enum keys (issue #108, thanks @eolant)
1227
- - CLI silently fails if the directory to put new files in doesn't exist yet (issue #141, thanks @Styn)
1228
-
1229
- ### Features:
1230
-
1231
- - Improved type description
1232
-
1233
- ### Internal:
1234
-
1235
- - dependencies update:
1236
- - `"js-yaml": "^4.0.0"` (`"^3.14.1"`)
1237
- - `"make-dir": "^3.1.0"`
1238
- - `"swagger2openapi": "^7.0.5"` (`"^7.0.4"`)
1239
- - Difference in templates:
1240
- - `data-contracts.eta`
1241
- ![dataContracts430](./assets/changelog_assets/http-client-template-diff-4.3.0.jpg)
1242
-
1243
- ## 4.2.0
1244
-
1245
- ### Features:
1246
-
1247
- - new hook `onCreateRequestParams` which allows modify request params (`--extract-request-params` option) before sending it to route info
1248
- ![onCreateRequestParams](./assets/changelog_assets/onCreateRequestParamsHook.jpg)
1249
- How to use:
1250
-
1251
- ```ts
1252
- generateApi({
1253
- // ... your config,
1254
- hooks: {
1255
- onCreateRequestParams: (rawType) => {
1256
- if (Object.keys(rawType.properties).length > 1) return rawType;
1257
-
1258
- return rawType;
1259
- },
1260
- },
1261
- });
1262
- ```
1263
-
1264
- - response content types (array of string like `application/json`, `image/png`) which allows to customize declaration of request response
1265
- Exist in `procedure-call.eta` template `it.route.response.contentTypes`
1266
-
1267
- ### Internal:
1268
-
1269
- - Difference in templates:
1270
- - `procedure-call.eta`
1271
- ![procedureCallEta1](./assets/changelog_assets/changes_procedure_call_1.jpg)
1272
-
1273
- ## 4.1.0
1274
-
1275
- ### Features:
1276
-
1277
- - Improve `require()` function used in ETA templates (using relative path imports)
1278
- - `--clean-output` option.
1279
- clean output folder before generate api
1280
-
1281
- ### Fixes:
1282
-
1283
- - Error: `Unexpected token =` (Issue #136, Thanks @jlow-mudbath)
1284
- - Output folder creation (Issue #137, Thanks @Rinta01)
1285
- Create output folder if it is not exist
1286
-
1287
- ## 4.0.5
1288
-
1289
- ### BREAKING_CHANGE:
1290
-
1291
- - remove `'prettier-plugin-organize-imports'` dependency from package
1292
-
1293
- ### Fixes:
1294
-
1295
- - issue #134 (Thanks @mrfratello)
1296
-
1297
- ## 4.0.4
1298
-
1299
- ### Features:
1300
-
1301
- - add `require()` to template `utils` object
1302
-
1303
- ### Docs:
1304
-
1305
- - add information about contributors
1306
-
1307
- ## 4.0.3
1308
-
1309
- ### Features:
1310
-
1311
- - `--disableStrictSSL` option for disable strict SSL statement with fetching swagger schema. (Thanks @kel666 for PR with feature request)
1312
- This option fix problem #114
1313
-
1314
- ## 4.0.2
1315
-
1316
- ### Fixes:
1317
-
1318
- - `Unexpected token '.'` on v4 (Thanks @savingprivatebryan for issue #111)
1319
- Replaced all new syntax sugar like `?.` or `??` to prev. alternatives for support nodejs 12
1320
-
1321
- ## 4.0.1
1322
-
1323
- ### Fixes:
1324
-
1325
- - `Cannot find module 'prettier-plugin-organize-imports'` #109
1326
-
1327
- ## 4.0.0
1328
-
1329
- ### BREAKING_CHANGES:
1330
-
1331
- - Migrate from [mustache](https://mustache.github.io/) template engine to [ETA](https://eta.js.org/) template engine. (Thanks @Fl0pZz)
1332
- - Critical change in `HttpResponse` type (Remove `D | null`, `E | null` unions)
1333
-
1334
- ```diff
1335
- interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
1336
- - data: D | null;
1337
- + data: D;
1338
- - error: E | null;
1339
- + error: E;
1340
- }
1341
- ```
1342
-
1343
- ### Features:
1344
-
1345
- - `--modular` option. Allows to generate api class per module name.
1346
- Example: [here](./tests/spec/modular)
1347
- - new templates on [ETA](https://eta.js.org/) (enhanced EJS) which can improve your templates! (Thanks @Fl0pZz)
1348
- [ETA extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=shadowtime2000.eta-vscode) (thanks @shadowtime2000)
1349
- Also moved out to templates:
1350
-
1351
- - `procedure-call.eta` (request api method template)
1352
- - `route-name.eta` (api method name template)
1353
- - `route-docs.eta` (api method docs template)
1354
-
1355
- No worry about strange syntax it is very simple in usage :)
1356
-
1357
- - Optional templates feature (Except templates using in `includeFile` `ETA` directive)
1358
- Now you can store only the `ETA` templates which you need to change for yourself.
1359
- - `--extract-request-params` option. Generate path and query request params data contract and modify request payload args
1360
- Example:
1361
- ![extract-request-params](./assets/changelog_assets/extractRequestParams.jpg)
1362
- - Improve `data-contracts.eta` template. Added more power :)
1363
- - Add `extraTemplates` property for `generateApi()`. Allows to generate extra files via this tool.
1364
- - Add `hooks` property for `generateApi()`
1365
- ```ts
1366
- hooks?: Partial<{
1367
- onCreateComponent: (component: SchemaComponent) => SchemaComponent | void;
1368
- onParseSchema: (originalSchema: any, parsedSchema: any) => any | void;
1369
- onCreateRoute: (routeData: ParsedRoute) => ParsedRoute | void;
1370
- /** Start point of work this tool (after fetching schema) */
1371
- onInit?: <C extends GenerateApiConfiguration["config"]>(configuration: C) => C | void;
1372
- /** Allows to customize configuration object before sending it to templates. */
1373
- onPrepareConfig?: <C extends GenerateApiConfiguration>(currentConfiguration: C) => C | void;
1374
- }>;
1375
- ```
1376
- ```ts
1377
- generateApi({
1378
- input: "./schema.json",
1379
- output: "./__generated__",
1380
- hooks: {
1381
- onCreateComponent(component) {
1382
- // do something
1383
- return component;
1384
- },
1385
- // ...
1386
- },
1387
- });
1388
- ```
1389
-
1390
- ### Internal:
1391
-
1392
- - Update all dependencies to latest
1393
-
1394
- ### Fixes:
1395
-
1396
- - `x-enumNames` support for enums
1397
- - Problem of complex types (`oneOf`, `allOf`) with `properties` field
1398
- - `additionalProperties: true` should make `[key: string]: any` for object types (Thanks @brookjordan for issue #103)
1399
-
1400
- ### Common:
1401
-
1402
- - `HttpClient` is exportable by default
1403
- - Improve typings when use `swagger-typescript-api` with NodeJS (`index.d.ts`)
1404
-
1405
- ## 3.1.2
1406
-
1407
- ### Fixes:
1408
-
1409
- - axios vulnerability (#101 issue, thanks @Mvbraathen)
1410
-
1411
- ## 3.1.1
1412
-
1413
- ### Fixes:
1414
-
1415
- - `name.includes is not a function` (issue #98)
1416
-
1417
- ## 3.1.0
1418
-
1419
- ### Features:
1420
-
1421
- - `--moduleNameIndex` option. determines which path index should be used for routes separation (Thanks @nikalun)
1422
- Examples:
1423
- GET:api/v1/fruites/getFruit -> index:2 -> moduleName -> fruites
1424
- GET:api/v1/fruites/getFruit -> index:0 -> moduleName -> api
1425
-
1426
- ## 3.0.1
1427
-
1428
- ### Fixes:
1429
-
1430
- - invalid default templates path (#92, thanks @larrybotha for quick fix)
1431
-
1432
- ## 3.0.0
1433
-
1434
- ### BREAKING_CHANGES:
1435
-
1436
- - Renamed mustache templates:
1437
- - `api.mustache` -> `data-contracts.mustache`
1438
- - `client.mustache` -> `http.client.mustache` + `api.mustache`
1439
- - Split the `client.mustache` template into two parts: `http-client.mustache` and `api.mustache`
1440
-
1441
- ### Fixes:
1442
-
1443
- - Fixed unsafe clone() of Response causing json() hang. (Thanks @Benjamin-Dobell)
1444
-
1445
- ## 2.0.0
1446
-
1447
- ### Features:
1448
-
1449
- - `--js` CLI option. [[feature request]](https://github.com/acacode/swagger-typescript-api/issues/79)
1450
-
1451
- ### BREAKING_CHANGES:
1452
-
1453
- - Requests returns `Promise<HttpResponse<Data, Error>>` type.
1454
- `HttpResponse` it is [Fetch.Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) wrapper with fields `data` and `error`
1455
- Example:
1456
-
1457
- ```ts
1458
- const api = new Api();
1459
-
1460
- //
1461
- const response: HttpResponse<Data, Error> = await api.fruits.getAll();
1462
-
1463
- response.data; // Data (can be null if response.ok is false)
1464
- response.error; // Error (can be null if response.ok is true)
1465
- ```
1466
-
1467
- - Breaking changes in the `client.mustache` template. Needs to update local custom templates.
1468
-
1469
- ### Fixes:
1470
-
1471
- - Security configuration in methods. When the security definition is in the main configuration of the swagger definition
1472
-
1473
- ## 1.12.0
1474
-
1475
- ### Features:
1476
-
1477
- - Can provide ability to generate from swagger JSON directly not from a file? #69 (Thanks @JennieJi)
1478
-
1479
- ### Fixes:
1480
-
1481
- - handling `x-omitempty` property for definition properties #68
1482
- - Additional properties map to empty interfaces (OpenAPI v3) #76
1483
- - Pattern fields in Path Item Object are treated as operations #75
1484
- - Remove const enum from default template #73
1485
- - enums with spaces throw an error #71
1486
-
1487
- ## 1.11.0
1488
-
1489
- ### Features:
1490
-
1491
- - Improve the naming of model types ([#65 issue](https://github.com/acacode/swagger-typescript-api/issues/65))
1492
-
1493
- ## 1.10.0
1494
-
1495
- ### Features:
1496
-
1497
- - `--templates` CLI option. [[feature request]](https://github.com/acacode/swagger-typescript-api/issues/54)
1498
- Provide custom `mustache` templates folder which allows to generate custom code (models, Api class, routes)
1499
- - `--union-enums` CLI option. [[feature request]](https://github.com/acacode/swagger-typescript-api/issues/58)
1500
- Allows to generate all enums as union types.
1501
- For example, schema part:
1502
- ```
1503
- "StringEnum": {
1504
- "enum": ["String1", "String2", "String3", "String4"],
1505
- "type": "string"
1506
- }
1507
- ```
1508
- will be converted into:
1509
- `export type StringEnum = "String1" | "String2" | "String3" | "String4";
1510
- `
1511
-
1512
- ## 1.8.4
1513
-
1514
- ### Fixes:
1515
-
1516
- - Multiple types for a property in Swagger 2 are not handled correctly ([#55 issue](https://github.com/acacode/swagger-typescript-api/issues/55))
1517
-
1518
- ## 1.8.3
1519
-
1520
- ### Fixes:
1521
-
1522
- - Generating invalid code in composed schema contexts ([#51 issue](https://github.com/acacode/swagger-typescript-api/issues/51))
1523
- ```yaml
1524
- components:
1525
- schemas:
1526
- Test:
1527
- type: object
1528
- allOf:
1529
- - type: object
1530
- properties:
1531
- x:
1532
- type: array
1533
- items:
1534
- type: string
1535
- enum:
1536
- - A-B
1537
- - type: object
1538
- properties:
1539
- y:
1540
- type: string
1541
- ```
1542
- ```ts
1543
- export type Test = XAB & { y?: string };
1544
- ```
1545
-
1546
- ## 1.8.2
1547
-
1548
- ### Fixes:
1549
-
1550
- - Broken types for arrays of union types ([issue](https://github.com/acacode/swagger-typescript-api/issues/49))
1551
-
1552
- ## 1.8.1
1553
-
1554
- ### Fixes:
1555
-
1556
- - form data request body (request body content `multipart/form-data`)
1557
-
1558
- ### Minor:
1559
-
1560
- - inline comments of the data contract type properties
1561
- ![one line comments](./assets/changelog_assets/one-line-comments.jpg)
1562
- - remove `Array<T>` type usage (now the more simple type `T[]`)
1563
-
1564
- ## 1.8.0
1565
-
1566
- ### Features:
1567
-
1568
- - **Partially** support FormData body types
1569
- - Support to generate query params of nested query objects (Partial fix of [this issue](https://github.com/acacode/swagger-typescript-api/issues/45))
1570
-
1571
- ## 1.7.2
1572
-
1573
- ### Fixes:
1574
-
1575
- - Critical bug with converting inline object into name of type for request body.
1576
- - Fix bug when path parameters is not set but contains in endpoint url.
1577
- ![path params bug 1](./assets/changelog_assets/bug-with-no-path-args.jpg)
1578
- ![path params bug 2](./assets/changelog_assets/bug-with-no-path-args2.jpg)
1579
-
1580
- ## 1.7.0
1581
-
1582
- ### Breaking Changes:
1583
-
1584
- - 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))
1585
- ![removed title and version properties](./assets/changelog_assets/removed-title-version-props.jpg)
1586
- - Move out all http client handlers/properties into `HttpClient` local class in module
1587
- ![http-client-class1](./assets/changelog_assets/http-client-class1.jpg)
1588
- ![http-client-class2](./assets/changelog_assets/http-client-class2.jpg)
1589
-
1590
- ### Chore:
1591
-
1592
- - default value for `SecurityDataType` Api class generic type
1593
-
1594
- ## 1.6.3
1595
-
1596
- ### Fixes:
1597
-
1598
- - Handling of nullable for $ref in OpenAPI 3.0 ([issue](https://github.com/acacode/swagger-typescript-api/issues/39))
1599
- Plus based on this issue was fixed most other problems with using `required` and `nullable` properties
1600
-
1601
- ## 1.6.2
1602
-
1603
- ### Fixes:
1604
-
1605
- - Nullable not included in type definition ([issue](https://github.com/acacode/swagger-typescript-api/issues/36))
1606
-
1607
- ### Internal:
1608
-
1609
- - Update `swagger2openapi`(`6.0.0`) dependency
1610
-
1611
- ## 1.6.1
1612
-
1613
- ### Internal:
1614
-
1615
- - Update `prettier`(`2.0.2`), `swagger2openapi`(`5.4.0`) dependencies
1616
-
1617
- ## 1.6.0
1618
-
1619
- ### Features:
1620
-
1621
- - Improvenment in optional request params (request body, query params, path params)
1622
-
1623
- ### Fixes:
1624
-
1625
- - Fix bug when `path` request param have the same name as `query`
1626
- - Fix bug when `path` request param have the same name as `params`
1627
-
1628
- ### Minor/Internal:
1629
-
1630
- - changed `addQueryParams()` method
1631
- - up `swagger2openapi` dependency version to `5.3.4`
1632
-
1633
- ## 1.5.0
1634
-
1635
- ### Features:
1636
-
1637
- - Add `prettier` for beautify output typescript api module
1638
- - Support `additionalProperties` type data
1639
- ![additional properties](./assets/changelog_assets/additional-properties-types.jpg)
1640
-
1641
- ### Fixes:
1642
-
1643
- - Fix problem with array `type` definitions without `type` property([#26](https://github.com/acacode/swagger-typescript-api/issues/26))
1644
-
1645
- ## 1.4.1
1646
-
1647
- ### Fixes:
1648
-
1649
- - 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))
1650
-
1651
- ## 1.4.0
1652
-
1653
- ### Breaking Changes:
1654
-
1655
- - Rename default typescript output api file name (prev `api.ts`, now `Api.ts`)
1656
- Features:
1657
- - `-d, --default-as-success` option. Allows to use "default" status codes as success response type
1658
- - `-r, --responses` option. Response declarations in request rescription
1659
- This option adds comments of the possible responses from request
1660
- ![responses comments](./assets/changelog_assets/responses-comments.jpg)
1661
- Also typings for `.catch()` callback
1662
- ![responses catch types](./assets/changelog_assets/responses-catch-types.jpg)
1663
- - Improve response body type definitions
1664
- - Types for bad responses
1665
- Changes:
1666
- - \[minor\] fix jsdoc comments space
1667
- ![right comments space](./assets/changelog_assets/right-comments-space.jpg)
1668
-
1669
- ## 1.3.0
1670
-
1671
- ### Features:
1672
-
1673
- - Api module description from schema info
1674
- ![api description](./assets/changelog_assets/api-module-description.jpg)
1675
- - Generate API type declarations (CLI flag `--route-types`, thanks [azz](https://github.com/azz))
1676
- ![route types](./assets/changelog_assets/route-types.jpg)
1677
- - Ability to not generate clint API class (CLI flag `--no-client`, thanks [azz](https://github.com/azz))
1678
-
1679
- ### Fixes:
1680
-
1681
- - Improve response body type definition
1682
-
1683
- ### Internal:
1684
-
1685
- - refactored `generate` and `validate` test scripts
1686
-
1687
- ## 1.2.6
1688
-
1689
- Fixes: create api without `-o` option (use default `./` output)
1690
-
1691
- ## 1.2.5
1692
-
1693
- Features: better naming of routes without `operationId`
1694
- ![route naming](./assets/changelog_assets/1.2.5_route_naming.jpg)
1695
- Changes: rename `@security true` -> `@secure`, `@duplicate true` -> `@duplicate`
1696
- Fixes: Support generated swagger schemes from tsoa 3.x with complex types (Omit, Pick, etc)
1697
-
1698
- ## 1.2.4
1699
-
1700
- Features: add .d.ts file into npm package
1701
- Changes: update help block in CLI
1702
- Internal: add greenkeeper, update npm keywords
1703
-
1704
- ## 1.2.3
1705
-
1706
- Features: @summary, @description comments at each route
1707
- Fixes: parsing schema without routes
1708
- Changes: update documentation
1709
- Internal: add anyOf, allOf test schemas, slack notifications in CI
1710
-
1711
- ## 1.2.2
1712
-
1713
- Fixes: fix complex types (oneOf, anyOf), required fields of object type was not required
1714
-
1715
- ## 1.2.0
1716
-
1717
- Changes: rename `ApiParams` to `RequestParams`, secure module always exist in generated API module, update documentation
1718
- Fixes: Query params was all required, parse yaml files, typescript minor warnings (;)
1719
- Internal: test schemas + manual testing, add travis CI/CD
1720
-
1721
- ## 1.1.0
1722
-
1723
- Fixes: catching http errors with use API module
1724
-
1725
- ## 1.0.9
1726
-
1727
- Features: add description to interfaces and their fields
1728
- Changes: update documentation
1729
-
1730
- ## 1.0.8
1731
-
1732
- Changes: update documentation
1733
-
1734
- ## 1.0.7
1735
-
1736
- Changes: update documentation (+ add logo), add comment about author in generated module
1737
-
1738
- ## 1.0.6
1739
-
1740
- Fixes: route naming, http(s) requests for getting swagger schema, integer enums
1741
- Changes: include only required files into npm pacakge
1742
-
1743
- ## 1.0.5
1744
-
1745
- Changes: update documentation
1746
-
1747
- ## 1.0.4
1748
-
1749
- Changes: disable linters rules for generated API module
1750
- Fixes: TS issues in template
1751
-
1752
- ## 1.0.3
1753
-
1754
- Fixes: NodeJS main script cannot been called on Unix\* machines
1755
- Changes: add LICENSE, update README
1756
-
1757
- ## 1.0.2
1758
-
1759
- Changes(Internal): change dependencies
1760
-
1761
- ## 1.0.1
1762
-
1763
- New features: query params, separating routes on submodules, common params in constructor, swagger v2 + yaml parsers
1764
- Enhancements: better type extracting.
1765
- Fixes: mustache escaping chars
1766
- Changes: order of request params, emojis messages in console
1767
-
1768
- ## 1.0.0
1769
-
1770
- Initial project.