dtsgenerator 3.19.0 → 3.19.2
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 +157 -2
- package/README.md +11 -154
- package/dist/core/astBuilder.js +5 -3
- package/dist/core/config.d.ts +1 -3
- package/dist/core/jsonSchema.js +1 -1
- package/dist/core/jsonSchemaDraft04.d.ts +4 -12
- package/dist/core/jsonSchemaDraft07.d.ts +6 -14
- package/dist/core/openApiV2.d.ts +11 -33
- package/dist/core/openApiV3.d.ts +17 -51
- package/dist/core/type.d.ts +2 -2
- package/package.json +26 -26
- package/src/core/astBuilder.ts +17 -10
- package/src/core/config.ts +1 -3
- package/src/core/dtsGenerator.ts +5 -5
- package/src/core/jsonSchema.ts +5 -8
- package/src/core/jsonSchemaDraft04.ts +4 -13
- package/src/core/jsonSchemaDraft07.ts +6 -15
- package/src/core/openApiV2.ts +20 -48
- package/src/core/openApiV3.ts +36 -52
- package/src/core/type.ts +3 -3
- package/src/core/utils.ts +0 -1
- package/src/core/validateIdentifier.ts +4 -5
- package/src/jsonPointer.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,161 @@
|
|
|
1
1
|
# ChangeLog
|
|
2
2
|
|
|
3
|
+
## v3
|
|
4
|
+
|
|
5
|
+
### [v3.15.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.15.1) (2022-03-10)
|
|
6
|
+
|
|
7
|
+
- fixed:
|
|
8
|
+
- Fix handling of stdin option with config file for #534. Thank you @arnestaphorsius :+1:
|
|
9
|
+
|
|
10
|
+
### [v3.15.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.15.0) (2022-02-06)
|
|
11
|
+
|
|
12
|
+
- features:
|
|
13
|
+
- Support mobile wallet media types(`application/jwt` and `application/vnd.apple.pkpass`) for #530. Thank you @eostrom :+1:
|
|
14
|
+
|
|
15
|
+
### [v3.14.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.14.0) (2022-01-27)
|
|
16
|
+
|
|
17
|
+
- features:
|
|
18
|
+
- Support the nested `allOf` and `oneOf` schema for #513. Thank you for your report @Cry0nicS :+1:
|
|
19
|
+
|
|
20
|
+
### [v3.13.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.13.2) (2021-10-08)
|
|
21
|
+
|
|
22
|
+
- features:
|
|
23
|
+
- Fix the type generation malformed objects with number-like keys for #523. Thank you for your report @DamianOsipiuk :+1:
|
|
24
|
+
|
|
25
|
+
### [v3.13.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.13.1) (2021-09-29)
|
|
26
|
+
|
|
27
|
+
- features:
|
|
28
|
+
- Change the plug-in interface, the PluginContext::inputSchemas to IterableIterator for #521. Thank you @djrollins :+1:
|
|
29
|
+
|
|
30
|
+
### [v3.13.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.13.0) (2021-08-31)
|
|
31
|
+
|
|
32
|
+
- features:
|
|
33
|
+
- Support new `$schema` types for #507.
|
|
34
|
+
|
|
35
|
+
### [v3.12.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.12.1) (2021-05-19)
|
|
36
|
+
|
|
37
|
+
- fixed:
|
|
38
|
+
- Fix referenced parameters not resolved error by #471. Thank you @jschirrmacher :+1:
|
|
39
|
+
|
|
40
|
+
### [v3.12.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.12.0) (2021-05-13)
|
|
41
|
+
|
|
42
|
+
- features:
|
|
43
|
+
- Support input type `file` by #496. Thank you @Christian24 :+1:
|
|
44
|
+
- Improve the conversion results of parameters property on OpenAPI by #501.
|
|
45
|
+
|
|
46
|
+
### [v3.11.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.11.0) (2021-05-11)
|
|
47
|
+
|
|
48
|
+
- features:
|
|
49
|
+
- Support vendor media types (allow periods in application/*+json) by #497. Thank you @glen-84 :+1:
|
|
50
|
+
- fixed:
|
|
51
|
+
- Remove to support the `readOnly` property, because of wrong interpretation by #498. Thank you @hallsbyra :+1:
|
|
52
|
+
|
|
53
|
+
### [v3.10.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.10.0) (2021-04-26)
|
|
54
|
+
|
|
55
|
+
- features:
|
|
56
|
+
- Support freeform objects w/ index signature instead of `unknown` keyword by #488. Thank you @medfreeman :+1:
|
|
57
|
+
- Support the `content` property in `Parameters` by #472. Thank you for report @npdev453 :+1:
|
|
58
|
+
|
|
59
|
+
### [v3.9.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.9.2) (2021-04-19)
|
|
60
|
+
|
|
61
|
+
- fixed:
|
|
62
|
+
- Fix nested `oneOf` & `anyOf` keywords by #486. Thank you @medfreeman :+1:
|
|
63
|
+
|
|
64
|
+
### [v3.9.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.9.1) (2021-04-16)
|
|
65
|
+
|
|
66
|
+
- fixed:
|
|
67
|
+
- Update `generate` function to use recommended immutable approach for typescript transforms by #483. Thank you again @medfreeman :+1:
|
|
68
|
+
|
|
69
|
+
### [v3.9.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.9.0) (2021-04-13)
|
|
70
|
+
|
|
71
|
+
- features:
|
|
72
|
+
- support for additionalItems property by #481. Thank you again @medfreeman :+1:
|
|
73
|
+
|
|
74
|
+
### [v3.8.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.8.0) (2021-04-08)
|
|
75
|
+
|
|
76
|
+
- features:
|
|
77
|
+
- full support for minItems & maxItems properties by #476. Thank you @medfreeman :+1:
|
|
78
|
+
|
|
79
|
+
### [v3.7.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.7.1) (2021-02-18)
|
|
80
|
+
|
|
81
|
+
- fixed:
|
|
82
|
+
- add truthy check for value in `mergeSchema` by #474. Thank you @ricokahler :+1:
|
|
83
|
+
|
|
84
|
+
### [v3.7.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.7.0) (2021-01-05)
|
|
85
|
+
|
|
86
|
+
- features:
|
|
87
|
+
- Add the `void` type support by #468. Thank you for your propose @henhal by #445 :+1:
|
|
88
|
+
|
|
89
|
+
### [v3.6.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.6.0) (2020-12-25)
|
|
90
|
+
|
|
91
|
+
- features:
|
|
92
|
+
- Improve the type result of oneOf/anyOf property by #467. Thank you for your report @crizo23 by #452 :+1:
|
|
93
|
+
- Improve the internal eslint configuration by #466. Thank you @Goldziher :+1:
|
|
94
|
+
|
|
95
|
+
### [v3.5.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.5.0) (2020-12-21)
|
|
96
|
+
|
|
97
|
+
- features:
|
|
98
|
+
- Add to export `ts` object for to use the same version TypeScript in all plugins by #465.
|
|
99
|
+
|
|
100
|
+
### [v3.4.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.4.1) (2020-12-16)
|
|
101
|
+
|
|
102
|
+
- fixed:
|
|
103
|
+
- Fix using package without esModuleInterop setting on tsconfig by #460. Thank you @wszydlak :+1:
|
|
104
|
+
- Update TypeScript v4 by #462. Thank you @wszydlak :+1:
|
|
105
|
+
- Add to support the null type enum value by #464. Thank you for your report @Goldziher :+1:
|
|
106
|
+
|
|
107
|
+
### [v3.4.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.4.0) (2020-12-15)
|
|
108
|
+
|
|
109
|
+
- features:
|
|
110
|
+
- Add support for multipart media type by #455. Thank you @wszydlak :+1:
|
|
111
|
+
- Add support for passing config object with NodeJS API usage by #456. Thank you @wszydlak :+1:
|
|
112
|
+
|
|
113
|
+
### [v3.3.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.3.1) (2020-10-05)
|
|
114
|
+
|
|
115
|
+
- fixed:
|
|
116
|
+
- Elements get type "any" instead of the correct one by #448. Thank you for your report @nachtigall-83 :+1:
|
|
117
|
+
|
|
118
|
+
### [v3.3.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.3.0) (2020-07-29)
|
|
119
|
+
|
|
120
|
+
- features:
|
|
121
|
+
- Support the `patternProperties` by #436. Thank you @nfroidure :+1:
|
|
122
|
+
- fixed:
|
|
123
|
+
- Definition generated improperly when multiple instances of a resource are inherited by #279. Thank you @btg5679 :+1:
|
|
124
|
+
- Apply the `prettier` config on `.eslintrc.json`.
|
|
125
|
+
|
|
126
|
+
### [v3.2.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.2.0) (2020-07-20)
|
|
127
|
+
|
|
128
|
+
- features:
|
|
129
|
+
- Add support for application/octet-stream media type by #431. Thank you @MisterChateau :+1:
|
|
130
|
+
|
|
131
|
+
### [v3.1.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.1.1) (2020-06-23)
|
|
132
|
+
|
|
133
|
+
- fixed:
|
|
134
|
+
- Cannot load config file of relative path by #428. Thank you @DamianOsipiuk :+1:
|
|
135
|
+
|
|
136
|
+
### [v3.1.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.1.0) (2020-06-22)
|
|
137
|
+
|
|
138
|
+
- features:
|
|
139
|
+
- Add support for nullable anyOf in OpenApi v3 by #426. Thank you @joost-kersjes-webpower :+1:
|
|
140
|
+
|
|
141
|
+
### [v3.0.3](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.0.3) (2020-06-15)
|
|
142
|
+
|
|
143
|
+
- fixed:
|
|
144
|
+
- Fix the command option example by #422. Thank you @maapteh :+1:
|
|
145
|
+
- Omit load config error on not config option by #425. Thank you @Christian24 :+1:
|
|
146
|
+
|
|
147
|
+
### [v3.0.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.0.2) (2020-06-11)
|
|
148
|
+
|
|
149
|
+
- fixed:
|
|
150
|
+
- Remove old example by #421. Thank you @maapteh :+1:
|
|
151
|
+
|
|
152
|
+
### [v3.0.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.0.1) (2020-06-09)
|
|
153
|
+
|
|
154
|
+
- features:
|
|
155
|
+
- Support the plug-in for pre-process and post-process.
|
|
156
|
+
- Change command line options and Support config file.
|
|
157
|
+
- Use the TypeScript AST for intermediate format.
|
|
158
|
+
|
|
3
159
|
## v2
|
|
4
160
|
|
|
5
161
|
### [v2.7.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v2.7.0) (2020-06-05)
|
|
@@ -82,7 +238,7 @@
|
|
|
82
238
|
|
|
83
239
|
- features
|
|
84
240
|
- Add to support the `nullable` property on OpenAPI by #319. Thank you @sakari :+1:
|
|
85
|
-
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#data-types
|
|
241
|
+
<https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#data-types>
|
|
86
242
|
|
|
87
243
|
### [v2.0.4](https://github.com/horiuchi/dtsgenerator/releases/tag/v2.0.4) (2019-01-07)
|
|
88
244
|
|
|
@@ -100,7 +256,6 @@
|
|
|
100
256
|
- features
|
|
101
257
|
- Add to support emit the Request/Response object schema of OpenAPI by #304.
|
|
102
258
|
|
|
103
|
-
|
|
104
259
|
## v1
|
|
105
260
|
|
|
106
261
|
### [v1.2.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v1.2.0) (2018-09-12)
|
package/README.md
CHANGED
|
@@ -143,6 +143,17 @@ Output debug message by [debug](https://www.npmjs.com/package/debug) library.
|
|
|
143
143
|
|
|
144
144
|
## ChangeLog
|
|
145
145
|
|
|
146
|
+
### [v3.19.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.19.2) (2024-06-11)
|
|
147
|
+
|
|
148
|
+
- fixed:
|
|
149
|
+
- Support a negative number by #566. Thank you @maximebiloe :+1:
|
|
150
|
+
|
|
151
|
+
### [v3.19.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.19.1) (2023-08-25)
|
|
152
|
+
|
|
153
|
+
- features:
|
|
154
|
+
- Update plugins for new TypeScript AST.
|
|
155
|
+
- Changed supported Node.js version to 16 or later. Also, we have confirmed that it works with Node.js v20.
|
|
156
|
+
|
|
146
157
|
### [v3.18.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.18.0) (2023-03-02)
|
|
147
158
|
|
|
148
159
|
- features:
|
|
@@ -163,160 +174,6 @@ Output debug message by [debug](https://www.npmjs.com/package/debug) library.
|
|
|
163
174
|
- features:
|
|
164
175
|
- Support 'image/*' media types for #539. Thank you @Geloosa :+1:
|
|
165
176
|
|
|
166
|
-
### [v3.15.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.15.1) (2022-03-10)
|
|
167
|
-
|
|
168
|
-
- fixed:
|
|
169
|
-
- Fix handling of stdin option with config file for #534. Thank you @arnestaphorsius :+1:
|
|
170
|
-
|
|
171
|
-
### [v3.15.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.15.0) (2022-02-06)
|
|
172
|
-
|
|
173
|
-
- features:
|
|
174
|
-
- Support mobile wallet media types(`application/jwt` and `application/vnd.apple.pkpass`) for #530. Thank you @eostrom :+1:
|
|
175
|
-
|
|
176
|
-
### [v3.14.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.14.0) (2022-01-27)
|
|
177
|
-
|
|
178
|
-
- features:
|
|
179
|
-
- Support the nested `allOf` and `oneOf` schema for #513. Thank you for your report @Cry0nicS :+1:
|
|
180
|
-
|
|
181
|
-
### [v3.13.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.13.2) (2021-10-08)
|
|
182
|
-
|
|
183
|
-
- features:
|
|
184
|
-
- Fix the type generation malformed objects with number-like keys for #523. Thank you for your report @DamianOsipiuk :+1:
|
|
185
|
-
|
|
186
|
-
### [v3.13.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.13.1) (2021-09-29)
|
|
187
|
-
|
|
188
|
-
- features:
|
|
189
|
-
- Change the plug-in interface, the PluginContext::inputSchemas to IterableIterator for #521. Thank you @djrollins :+1:
|
|
190
|
-
|
|
191
|
-
### [v3.13.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.13.0) (2021-08-31)
|
|
192
|
-
|
|
193
|
-
- features:
|
|
194
|
-
- Support new `$schema` types for #507.
|
|
195
|
-
|
|
196
|
-
### [v3.12.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.12.1) (2021-05-19)
|
|
197
|
-
|
|
198
|
-
- fixed:
|
|
199
|
-
- Fix referenced parameters not resolved error by #471. Thank you @jschirrmacher :+1:
|
|
200
|
-
|
|
201
|
-
### [v3.12.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.12.0) (2021-05-13)
|
|
202
|
-
|
|
203
|
-
- features:
|
|
204
|
-
- Support input type `file` by #496. Thank you @Christian24 :+1:
|
|
205
|
-
- Improve the conversion results of parameters property on OpenAPI by #501.
|
|
206
|
-
|
|
207
|
-
### [v3.11.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.11.0) (2021-05-11)
|
|
208
|
-
|
|
209
|
-
- features:
|
|
210
|
-
- Support vendor media types (allow periods in application/*+json) by #497. Thank you @glen-84 :+1:
|
|
211
|
-
- fixed:
|
|
212
|
-
- Remove to support the `readOnly` property, because of wrong interpretation by #498. Thank you @hallsbyra :+1:
|
|
213
|
-
|
|
214
|
-
### [v3.10.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.10.0) (2021-04-26)
|
|
215
|
-
|
|
216
|
-
- features:
|
|
217
|
-
- Support freeform objects w/ index signature instead of `unknown` keyword by #488. Thank you @medfreeman :+1:
|
|
218
|
-
- Support the `content` property in `Parameters` by #472. Thank you for report @npdev453 :+1:
|
|
219
|
-
|
|
220
|
-
### [v3.9.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.9.2) (2021-04-19)
|
|
221
|
-
|
|
222
|
-
- fixed:
|
|
223
|
-
- Fix nested `oneOf` & `anyOf` keywords by #486. Thank you @medfreeman :+1:
|
|
224
|
-
|
|
225
|
-
### [v3.9.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.9.1) (2021-04-16)
|
|
226
|
-
|
|
227
|
-
- fixed:
|
|
228
|
-
- Update `generate` function to use recommended immutable approach for typescript transforms by #483. Thank you again @medfreeman :+1:
|
|
229
|
-
|
|
230
|
-
### [v3.9.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.9.0) (2021-04-13)
|
|
231
|
-
|
|
232
|
-
- features:
|
|
233
|
-
- support for additionalItems property by #481. Thank you again @medfreeman :+1:
|
|
234
|
-
|
|
235
|
-
### [v3.8.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.8.0) (2021-04-08)
|
|
236
|
-
|
|
237
|
-
- features:
|
|
238
|
-
- full support for minItems & maxItems properties by #476. Thank you @medfreeman :+1:
|
|
239
|
-
|
|
240
|
-
### [v3.7.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.7.1) (2021-02-18)
|
|
241
|
-
|
|
242
|
-
- fixed:
|
|
243
|
-
- add truthy check for value in `mergeSchema` by #474. Thank you @ricokahler :+1:
|
|
244
|
-
|
|
245
|
-
### [v3.7.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.7.0) (2021-01-05)
|
|
246
|
-
|
|
247
|
-
- features:
|
|
248
|
-
- Add the `void` type support by #468. Thank you for your propose @henhal by #445 :+1:
|
|
249
|
-
|
|
250
|
-
### [v3.6.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.6.0) (2020-12-25)
|
|
251
|
-
|
|
252
|
-
- features:
|
|
253
|
-
- Improve the type result of oneOf/anyOf property by #467. Thank you for your report @crizo23 by #452 :+1:
|
|
254
|
-
- Improve the internal eslint configuration by #466. Thank you @Goldziher :+1:
|
|
255
|
-
|
|
256
|
-
### [v3.5.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.5.0) (2020-12-21)
|
|
257
|
-
|
|
258
|
-
- features:
|
|
259
|
-
- Add to export `ts` object for to use the same version TypeScript in all plugins by #465.
|
|
260
|
-
|
|
261
|
-
### [v3.4.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.4.1) (2020-12-16)
|
|
262
|
-
|
|
263
|
-
- fixed:
|
|
264
|
-
- Fix using package without esModuleInterop setting on tsconfig by #460. Thank you @wszydlak :+1:
|
|
265
|
-
- Update TypeScript v4 by #462. Thank you @wszydlak :+1:
|
|
266
|
-
- Add to support the null type enum value by #464. Thank you for your report @Goldziher :+1:
|
|
267
|
-
|
|
268
|
-
### [v3.4.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.4.0) (2020-12-15)
|
|
269
|
-
|
|
270
|
-
- features:
|
|
271
|
-
- Add support for multipart media type by #455. Thank you @wszydlak :+1:
|
|
272
|
-
- Add support for passing config object with NodeJS API usage by #456. Thank you @wszydlak :+1:
|
|
273
|
-
|
|
274
|
-
### [v3.3.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.3.1) (2020-10-05)
|
|
275
|
-
|
|
276
|
-
- fixed:
|
|
277
|
-
- Elements get type "any" instead of the correct one by #448. Thank you for your report @nachtigall-83 :+1:
|
|
278
|
-
|
|
279
|
-
### [v3.3.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.3.0) (2020-07-29)
|
|
280
|
-
|
|
281
|
-
- features:
|
|
282
|
-
- Support the `patternProperties` by #436. Thank you @nfroidure :+1:
|
|
283
|
-
- fixed:
|
|
284
|
-
- Definition generated improperly when multiple instances of a resource are inherited by #279. Thank you @btg5679 :+1:
|
|
285
|
-
- Apply the `prettier` config on `.eslintrc.json`.
|
|
286
|
-
|
|
287
|
-
### [v3.2.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.2.0) (2020-07-20)
|
|
288
|
-
|
|
289
|
-
- features:
|
|
290
|
-
- Add support for application/octet-stream media type by #431. Thank you @MisterChateau :+1:
|
|
291
|
-
|
|
292
|
-
### [v3.1.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.1.1) (2020-06-23)
|
|
293
|
-
|
|
294
|
-
- fixed:
|
|
295
|
-
- Cannot load config file of relative path by #428. Thank you @DamianOsipiuk :+1:
|
|
296
|
-
|
|
297
|
-
### [v3.1.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.1.0) (2020-06-22)
|
|
298
|
-
|
|
299
|
-
- features:
|
|
300
|
-
- Add support for nullable anyOf in OpenApi v3 by #426. Thank you @joost-kersjes-webpower :+1:
|
|
301
|
-
|
|
302
|
-
### [v3.0.3](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.0.3) (2020-06-15)
|
|
303
|
-
|
|
304
|
-
- fixed:
|
|
305
|
-
- Fix the command option example by #422. Thank you @maapteh :+1:
|
|
306
|
-
- Omit load config error on not config option by #425. Thank you @Christian24 :+1:
|
|
307
|
-
|
|
308
|
-
### [v3.0.2](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.0.2) (2020-06-11)
|
|
309
|
-
|
|
310
|
-
- fixed:
|
|
311
|
-
- Remove old example by #421. Thank you @maapteh :+1:
|
|
312
|
-
|
|
313
|
-
### [v3.0.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.0.1) (2020-06-09)
|
|
314
|
-
|
|
315
|
-
- features:
|
|
316
|
-
- Support the plug-in for pre-process and post-process.
|
|
317
|
-
- Change command line options and Support config file.
|
|
318
|
-
- Use the TypeScript AST for intermediate format.
|
|
319
|
-
|
|
320
177
|
### older versions history
|
|
321
178
|
|
|
322
179
|
[ChangeLogs](https://github.com/horiuchi/dtsgenerator/blob/master/CHANGELOG.md)
|
package/dist/core/astBuilder.js
CHANGED
|
@@ -53,6 +53,9 @@ function buildStringLiteralTypeNode(s) {
|
|
|
53
53
|
}
|
|
54
54
|
exports.buildStringLiteralTypeNode = buildStringLiteralTypeNode;
|
|
55
55
|
function buildNumericLiteralTypeNode(n) {
|
|
56
|
+
if (!isNaN(parseFloat(n)) && parseFloat(n) < 0) {
|
|
57
|
+
return ts.factory.createLiteralTypeNode(ts.factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, ts.factory.createNumericLiteral(Math.abs(parseFloat(n)))));
|
|
58
|
+
}
|
|
56
59
|
return ts.factory.createLiteralTypeNode(ts.factory.createNumericLiteral(n));
|
|
57
60
|
}
|
|
58
61
|
exports.buildNumericLiteralTypeNode = buildNumericLiteralTypeNode;
|
|
@@ -87,7 +90,7 @@ function buildTypeAliasNode(id, type, root) {
|
|
|
87
90
|
exports.buildTypeAliasNode = buildTypeAliasNode;
|
|
88
91
|
function buildPropertySignature(_schema, propertyName, valueType, required, isPattern) {
|
|
89
92
|
const modifiers = undefined;
|
|
90
|
-
const questionToken = required
|
|
93
|
+
const questionToken = !(required === null || required === void 0 ? void 0 : required.includes(propertyName))
|
|
91
94
|
? ts.factory.createToken(ts.SyntaxKind.QuestionToken)
|
|
92
95
|
: undefined;
|
|
93
96
|
if (isPattern) {
|
|
@@ -147,8 +150,7 @@ function buildTupleTypeNode(types, minItems, maxItems, additionalItems) {
|
|
|
147
150
|
for (let i = 0; i < itemCount; i++) {
|
|
148
151
|
let node = typesIsArray(types)
|
|
149
152
|
? i < types.length
|
|
150
|
-
?
|
|
151
|
-
types[i]
|
|
153
|
+
? types[i]
|
|
152
154
|
: additionalItems !== undefined
|
|
153
155
|
? additionalItems === false
|
|
154
156
|
? buildNeverKeyword()
|
package/dist/core/config.d.ts
CHANGED
|
@@ -5,9 +5,7 @@ export interface Config {
|
|
|
5
5
|
outputFile?: string;
|
|
6
6
|
target: ScriptTarget;
|
|
7
7
|
outputAST: boolean;
|
|
8
|
-
plugins:
|
|
9
|
-
[pluginName: string]: boolean | Record<string, unknown>;
|
|
10
|
-
};
|
|
8
|
+
plugins: Record<string, boolean | Record<string, unknown>>;
|
|
11
9
|
}
|
|
12
10
|
interface InputConfig {
|
|
13
11
|
files: string[];
|
package/dist/core/jsonSchema.js
CHANGED
|
@@ -395,7 +395,7 @@ function selectSchemaType(content) {
|
|
|
395
395
|
throw new Error(`expect parameter of type object, received ${typeof content}`);
|
|
396
396
|
}
|
|
397
397
|
if ('$schema' in content) {
|
|
398
|
-
const schema = (_a = content
|
|
398
|
+
const schema = (_a = content.$schema) !== null && _a !== void 0 ? _a : '';
|
|
399
399
|
if (/^https?:\/\/json-schema.org\/schema#?$/.test(schema)) {
|
|
400
400
|
return { type: 'Latest' };
|
|
401
401
|
}
|
|
@@ -25,18 +25,10 @@ export declare namespace JsonSchemaDraft04 {
|
|
|
25
25
|
minProperties?: Schema.Definitions.PositiveIntegerDefault0;
|
|
26
26
|
required?: Schema.Definitions.StringArray;
|
|
27
27
|
additionalProperties?: boolean | Schema;
|
|
28
|
-
definitions?:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
[name: string]: Schema;
|
|
33
|
-
};
|
|
34
|
-
patternProperties?: {
|
|
35
|
-
[name: string]: Schema;
|
|
36
|
-
};
|
|
37
|
-
dependencies?: {
|
|
38
|
-
[name: string]: Schema | Schema.Definitions.StringArray;
|
|
39
|
-
};
|
|
28
|
+
definitions?: Record<string, Schema>;
|
|
29
|
+
properties?: Record<string, Schema>;
|
|
30
|
+
patternProperties?: Record<string, Schema>;
|
|
31
|
+
dependencies?: Record<string, Schema | Schema.Definitions.StringArray>;
|
|
40
32
|
enum?: any[];
|
|
41
33
|
type?: Schema.Definitions.SimpleTypes | Schema.Definitions.SimpleTypes[];
|
|
42
34
|
format?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare namespace JsonSchemaDraft07 {
|
|
2
|
-
|
|
2
|
+
interface SchemaObject {
|
|
3
3
|
$id?: string;
|
|
4
4
|
$schema?: string;
|
|
5
5
|
$ref?: string;
|
|
@@ -28,18 +28,10 @@ export declare namespace JsonSchemaDraft07 {
|
|
|
28
28
|
minProperties?: Schema.Definitions.NonNegativeIntegerDefault0;
|
|
29
29
|
required?: Schema.Definitions.StringArray;
|
|
30
30
|
additionalProperties?: Schema;
|
|
31
|
-
definitions?:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[name: string]: Schema;
|
|
36
|
-
};
|
|
37
|
-
patternProperties?: {
|
|
38
|
-
[name: string]: Schema;
|
|
39
|
-
};
|
|
40
|
-
dependencies?: {
|
|
41
|
-
[name: string]: Schema | Schema.Definitions.StringArray;
|
|
42
|
-
};
|
|
31
|
+
definitions?: Record<string, Schema>;
|
|
32
|
+
properties?: Record<string, Schema>;
|
|
33
|
+
patternProperties?: Record<string, Schema>;
|
|
34
|
+
dependencies?: Record<string, Schema | Schema.Definitions.StringArray>;
|
|
43
35
|
propertyNames?: Schema;
|
|
44
36
|
const?: any;
|
|
45
37
|
enum?: any[];
|
|
@@ -54,7 +46,7 @@ export declare namespace JsonSchemaDraft07 {
|
|
|
54
46
|
anyOf?: Schema.Definitions.SchemaArray;
|
|
55
47
|
oneOf?: Schema.Definitions.SchemaArray;
|
|
56
48
|
not?: Schema;
|
|
57
|
-
}
|
|
49
|
+
}
|
|
58
50
|
type Schema = SchemaObject | boolean;
|
|
59
51
|
namespace Schema {
|
|
60
52
|
namespace Definitions {
|
package/dist/core/openApiV2.d.ts
CHANGED
|
@@ -44,13 +44,9 @@ export declare namespace OpenApisV2 {
|
|
|
44
44
|
email?: string;
|
|
45
45
|
}
|
|
46
46
|
type Default = JsonSchemaDraft04.Schema.Properties.Default;
|
|
47
|
-
|
|
48
|
-
[name: string]: Schema;
|
|
49
|
-
}
|
|
47
|
+
type Definitions = Record<string, Schema>;
|
|
50
48
|
type Enum = JsonSchemaDraft04.Schema.Properties.Enum;
|
|
51
|
-
|
|
52
|
-
[name: string]: any;
|
|
53
|
-
}
|
|
49
|
+
type Examples = Record<string, any>;
|
|
54
50
|
type ExclusiveMaximum = JsonSchemaDraft04.Schema.Properties.ExclusiveMaximum;
|
|
55
51
|
type ExclusiveMinimum = JsonSchemaDraft04.Schema.Properties.ExclusiveMinimum;
|
|
56
52
|
interface ExternalDocs {
|
|
@@ -135,9 +131,7 @@ export declare namespace OpenApisV2 {
|
|
|
135
131
|
enum?: Enum;
|
|
136
132
|
multipleOf?: MultipleOf;
|
|
137
133
|
}
|
|
138
|
-
|
|
139
|
-
[name: string]: Header;
|
|
140
|
-
}
|
|
134
|
+
type Headers = Record<string, Header>;
|
|
141
135
|
interface Info {
|
|
142
136
|
title: string;
|
|
143
137
|
version: string;
|
|
@@ -192,9 +186,7 @@ export declare namespace OpenApisV2 {
|
|
|
192
186
|
tokenUrl: string;
|
|
193
187
|
description?: string;
|
|
194
188
|
}
|
|
195
|
-
|
|
196
|
-
[name: string]: string;
|
|
197
|
-
}
|
|
189
|
+
type Oauth2Scopes = Record<string, string>;
|
|
198
190
|
interface Operation {
|
|
199
191
|
tags?: string[];
|
|
200
192
|
summary?: string;
|
|
@@ -210,9 +202,7 @@ export declare namespace OpenApisV2 {
|
|
|
210
202
|
security?: Security;
|
|
211
203
|
}
|
|
212
204
|
type Parameter = BodyParameter | NonBodyParameter;
|
|
213
|
-
|
|
214
|
-
[name: string]: Parameter;
|
|
215
|
-
}
|
|
205
|
+
type ParameterDefinitions = Record<string, Parameter>;
|
|
216
206
|
type ParametersList = (Parameter | JsonReference)[];
|
|
217
207
|
interface PathItem {
|
|
218
208
|
$ref?: string;
|
|
@@ -248,9 +238,7 @@ export declare namespace OpenApisV2 {
|
|
|
248
238
|
enum?: Enum;
|
|
249
239
|
multipleOf?: MultipleOf;
|
|
250
240
|
}
|
|
251
|
-
|
|
252
|
-
[pattern: string]: PathItem;
|
|
253
|
-
}
|
|
241
|
+
type Paths = Record<string, PathItem>;
|
|
254
242
|
type Pattern = JsonSchemaDraft04.Schema.Properties.Pattern;
|
|
255
243
|
interface PrimitivesItems {
|
|
256
244
|
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
@@ -301,13 +289,9 @@ export declare namespace OpenApisV2 {
|
|
|
301
289
|
headers?: Headers;
|
|
302
290
|
examples?: Examples;
|
|
303
291
|
}
|
|
304
|
-
|
|
305
|
-
[name: string]: Response;
|
|
306
|
-
}
|
|
292
|
+
type ResponseDefinitions = Record<string, Response>;
|
|
307
293
|
type ResponseValue = Response | JsonReference;
|
|
308
|
-
|
|
309
|
-
[pattern: string]: ResponseValue;
|
|
310
|
-
}
|
|
294
|
+
type Responses = Record<string, ResponseValue>;
|
|
311
295
|
interface Schema {
|
|
312
296
|
$ref?: string;
|
|
313
297
|
format?: string;
|
|
@@ -339,9 +323,7 @@ export declare namespace OpenApisV2 {
|
|
|
339
323
|
Schema,
|
|
340
324
|
...Schema[]
|
|
341
325
|
];
|
|
342
|
-
properties?:
|
|
343
|
-
[name: string]: Schema;
|
|
344
|
-
};
|
|
326
|
+
properties?: Record<string, Schema>;
|
|
345
327
|
discriminator?: string;
|
|
346
328
|
readOnly?: boolean;
|
|
347
329
|
xml?: Xml;
|
|
@@ -350,12 +332,8 @@ export declare namespace OpenApisV2 {
|
|
|
350
332
|
}
|
|
351
333
|
type SchemesList = ('http' | 'https' | 'ws' | 'wss')[];
|
|
352
334
|
type Security = SecurityRequirement[];
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
interface SecurityRequirement {
|
|
357
|
-
[name: string]: string[];
|
|
358
|
-
}
|
|
335
|
+
type SecurityDefinitions = Record<string, BasicAuthenticationSecurity | ApiKeySecurity | Oauth2ImplicitSecurity | Oauth2PasswordSecurity | Oauth2ApplicationSecurity | Oauth2AccessCodeSecurity>;
|
|
336
|
+
type SecurityRequirement = Record<string, string[]>;
|
|
359
337
|
interface Tag {
|
|
360
338
|
name: string;
|
|
361
339
|
description?: string;
|