swagger-typescript-api 13.2.15 → 13.2.17

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