@kubb/plugin-oas 3.10.10 → 3.10.12
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/dist/{OperationGenerator-BFmQs4BO.d.cts → OperationGenerator-CF1rxGSV.d.ts} +2 -273
- package/dist/{OperationGenerator-BFmQs4BO.d.ts → OperationGenerator-DxdJDBEc.d.cts} +2 -273
- package/dist/{Schema-Cmvkb9CW.d.ts → Schema-AjebpeVY.d.ts} +1 -1
- package/dist/{Schema-BunfYze0.d.cts → Schema-M6983FL1.d.cts} +1 -1
- package/dist/SchemaMapper-B21ZmWag.d.cts +275 -0
- package/dist/SchemaMapper-B21ZmWag.d.ts +275 -0
- package/dist/chunk-6S7YFY6F.js +33 -0
- package/dist/chunk-6S7YFY6F.js.map +1 -0
- package/dist/chunk-76E35IZ2.js +56 -0
- package/dist/chunk-76E35IZ2.js.map +1 -0
- package/dist/chunk-DTD4ZUDA.cjs +36 -0
- package/dist/chunk-DTD4ZUDA.cjs.map +1 -0
- package/dist/{chunk-QDPL3I3X.js → chunk-HLZZQQYR.js} +33 -91
- package/dist/chunk-HLZZQQYR.js.map +1 -0
- package/dist/chunk-QF3E6S2N.js +29 -0
- package/dist/chunk-QF3E6S2N.js.map +1 -0
- package/dist/chunk-RSHQODEK.cjs +35 -0
- package/dist/chunk-RSHQODEK.cjs.map +1 -0
- package/dist/{chunk-Y6YAXTK5.cjs → chunk-S3UPJP7I.cjs} +5 -5
- package/dist/chunk-S3UPJP7I.cjs.map +1 -0
- package/dist/{chunk-6HG3X5MB.js → chunk-S7ZYTJXL.js} +3 -3
- package/dist/chunk-S7ZYTJXL.js.map +1 -0
- package/dist/{chunk-7U6BHIOO.cjs → chunk-WAB2O4DX.cjs} +116 -176
- package/dist/chunk-WAB2O4DX.cjs.map +1 -0
- package/dist/chunk-YWMMI3MO.cjs +59 -0
- package/dist/chunk-YWMMI3MO.cjs.map +1 -0
- package/dist/components.cjs +0 -1
- package/dist/components.d.cts +4 -3
- package/dist/components.d.ts +4 -3
- package/dist/components.js +0 -1
- package/dist/generators.cjs +3 -5
- package/dist/generators.d.cts +2 -1
- package/dist/generators.d.ts +2 -1
- package/dist/generators.js +2 -4
- package/dist/hooks.cjs +3 -2
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +3 -2
- package/dist/hooks.d.ts +3 -2
- package/dist/hooks.js +2 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +733 -0
- package/dist/mocks.cjs.map +1 -0
- package/dist/mocks.d.cts +15 -0
- package/dist/mocks.d.ts +15 -0
- package/dist/mocks.js +731 -0
- package/dist/mocks.js.map +1 -0
- package/dist/utils.cjs +61 -18
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +51 -1
- package/dist/utils.js.map +1 -1
- package/package.json +16 -8
- package/src/SchemaGenerator.ts +27 -39
- package/src/generator.tsx +1 -1
- package/src/generators/jsonGenerator.ts +2 -1
- package/src/mocks/index.ts +1 -0
- package/src/mocks/schemas.ts +728 -0
- package/src/utils/parseFromConfig.ts +1 -1
- package/dist/chunk-6HG3X5MB.js.map +0 -1
- package/dist/chunk-7U6BHIOO.cjs.map +0 -1
- package/dist/chunk-DEDONPUL.cjs +0 -114
- package/dist/chunk-DEDONPUL.cjs.map +0 -1
- package/dist/chunk-PADR76WZ.cjs +0 -4
- package/dist/chunk-PADR76WZ.cjs.map +0 -1
- package/dist/chunk-QDPL3I3X.js.map +0 -1
- package/dist/chunk-QPFZUPQA.js +0 -100
- package/dist/chunk-QPFZUPQA.js.map +0 -1
- package/dist/chunk-R47XMJ32.js +0 -3
- package/dist/chunk-R47XMJ32.js.map +0 -1
- package/dist/chunk-Y6YAXTK5.cjs.map +0 -1
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
import { type Schema, schemaKeywords } from '../SchemaMapper'
|
|
2
|
+
|
|
3
|
+
const basic: Array<{ name: string; schema: Schema }> = [
|
|
4
|
+
{
|
|
5
|
+
name: 'any',
|
|
6
|
+
schema: {
|
|
7
|
+
keyword: schemaKeywords.any,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'unknown',
|
|
12
|
+
schema: {
|
|
13
|
+
keyword: schemaKeywords.unknown,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'string',
|
|
18
|
+
schema: {
|
|
19
|
+
keyword: schemaKeywords.string,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'number',
|
|
24
|
+
schema: {
|
|
25
|
+
keyword: schemaKeywords.number,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'integer',
|
|
30
|
+
schema: {
|
|
31
|
+
keyword: schemaKeywords.integer,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'boolean',
|
|
36
|
+
schema: {
|
|
37
|
+
keyword: schemaKeywords.boolean,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'primitiveDate',
|
|
42
|
+
schema: {
|
|
43
|
+
keyword: schemaKeywords.date,
|
|
44
|
+
args: {
|
|
45
|
+
type: 'date',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'date',
|
|
51
|
+
schema: {
|
|
52
|
+
keyword: schemaKeywords.date,
|
|
53
|
+
args: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'time',
|
|
60
|
+
schema: {
|
|
61
|
+
keyword: schemaKeywords.time,
|
|
62
|
+
args: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'stringOffset',
|
|
69
|
+
schema: {
|
|
70
|
+
keyword: schemaKeywords.datetime,
|
|
71
|
+
args: {
|
|
72
|
+
offset: true,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'stringLocal',
|
|
78
|
+
schema: {
|
|
79
|
+
keyword: schemaKeywords.datetime,
|
|
80
|
+
args: {
|
|
81
|
+
local: true,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'datetime',
|
|
87
|
+
schema: {
|
|
88
|
+
keyword: schemaKeywords.datetime,
|
|
89
|
+
args: {
|
|
90
|
+
offset: false,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'nullable',
|
|
96
|
+
schema: {
|
|
97
|
+
keyword: schemaKeywords.nullable,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'undefined',
|
|
102
|
+
schema: {
|
|
103
|
+
keyword: schemaKeywords.undefined,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'min',
|
|
108
|
+
schema: {
|
|
109
|
+
keyword: schemaKeywords.min,
|
|
110
|
+
args: 2,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'max',
|
|
115
|
+
schema: {
|
|
116
|
+
keyword: schemaKeywords.max,
|
|
117
|
+
args: 2,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'matchesReg',
|
|
122
|
+
schema: {
|
|
123
|
+
keyword: schemaKeywords.matches,
|
|
124
|
+
args: '/node_modules/', // pure regexp
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'matches',
|
|
129
|
+
schema: {
|
|
130
|
+
keyword: schemaKeywords.matches,
|
|
131
|
+
args: '^[A-Z]{2}$',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'ref',
|
|
136
|
+
schema: {
|
|
137
|
+
keyword: schemaKeywords.ref,
|
|
138
|
+
args: {
|
|
139
|
+
$ref: '$ref',
|
|
140
|
+
name: 'Pet',
|
|
141
|
+
path: './pet.ts',
|
|
142
|
+
isImportable: true,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'enum',
|
|
148
|
+
schema: {
|
|
149
|
+
keyword: schemaKeywords.enum,
|
|
150
|
+
args: {
|
|
151
|
+
name: 'enum',
|
|
152
|
+
typeName: 'Enum',
|
|
153
|
+
asConst: false,
|
|
154
|
+
items: [
|
|
155
|
+
{ name: 'A', value: 'A', format: schemaKeywords.string },
|
|
156
|
+
{ name: 'B', value: 'B', format: schemaKeywords.string },
|
|
157
|
+
{ name: 'C', value: 'C', format: schemaKeywords.string },
|
|
158
|
+
{ name: 2, value: 2, format: schemaKeywords.number },
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'enumLiteralBoolean',
|
|
165
|
+
schema: {
|
|
166
|
+
keyword: schemaKeywords.enum,
|
|
167
|
+
args: {
|
|
168
|
+
asConst: true,
|
|
169
|
+
items: [
|
|
170
|
+
{
|
|
171
|
+
format: 'boolean',
|
|
172
|
+
name: 'true',
|
|
173
|
+
value: true,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
format: 'boolean',
|
|
177
|
+
name: 'false',
|
|
178
|
+
value: false,
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
name: 'PetEnumLiteral',
|
|
182
|
+
typeName: 'PetEnumLiteral',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'tuple',
|
|
188
|
+
schema: {
|
|
189
|
+
keyword: schemaKeywords.tuple,
|
|
190
|
+
args: {
|
|
191
|
+
items: [],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'tupleMulti',
|
|
197
|
+
schema: {
|
|
198
|
+
keyword: schemaKeywords.tuple,
|
|
199
|
+
args: {
|
|
200
|
+
items: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: 'array',
|
|
206
|
+
schema: {
|
|
207
|
+
keyword: schemaKeywords.array,
|
|
208
|
+
args: {
|
|
209
|
+
items: [
|
|
210
|
+
{
|
|
211
|
+
keyword: schemaKeywords.union,
|
|
212
|
+
args: [{ keyword: schemaKeywords.number }, { keyword: schemaKeywords.string }],
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'arrayEmpty',
|
|
220
|
+
schema: {
|
|
221
|
+
keyword: schemaKeywords.array,
|
|
222
|
+
args: {
|
|
223
|
+
items: [],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'arrayRef',
|
|
229
|
+
schema: {
|
|
230
|
+
keyword: schemaKeywords.array,
|
|
231
|
+
args: {
|
|
232
|
+
items: [
|
|
233
|
+
{
|
|
234
|
+
keyword: schemaKeywords.ref,
|
|
235
|
+
|
|
236
|
+
args: { name: 'Pet', $ref: '#component/schema/Pet', path: './pet.ts', isImportable: true },
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'arrayAdvanced',
|
|
244
|
+
schema: {
|
|
245
|
+
keyword: schemaKeywords.array,
|
|
246
|
+
args: {
|
|
247
|
+
items: [{ keyword: schemaKeywords.min, args: 1 }, { keyword: schemaKeywords.max, args: 10 }, { keyword: schemaKeywords.number }],
|
|
248
|
+
min: 3,
|
|
249
|
+
max: 10,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: 'arrayRegex',
|
|
255
|
+
schema: {
|
|
256
|
+
keyword: schemaKeywords.array,
|
|
257
|
+
args: {
|
|
258
|
+
items: [{ keyword: schemaKeywords.matches, args: '^[a-zA-Z0-9]{1,13}$' }],
|
|
259
|
+
min: 3,
|
|
260
|
+
max: 10,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: 'union',
|
|
266
|
+
schema: {
|
|
267
|
+
keyword: schemaKeywords.union,
|
|
268
|
+
args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'unionOne',
|
|
273
|
+
schema: {
|
|
274
|
+
keyword: schemaKeywords.union,
|
|
275
|
+
args: [{ keyword: schemaKeywords.string }],
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: 'catchall',
|
|
280
|
+
schema: {
|
|
281
|
+
keyword: schemaKeywords.object,
|
|
282
|
+
args: {
|
|
283
|
+
properties: {},
|
|
284
|
+
additionalProperties: [
|
|
285
|
+
{
|
|
286
|
+
keyword: schemaKeywords.ref,
|
|
287
|
+
args: { name: 'Pet', $ref: '#component/schema/Pet', path: './Pet.ts', isImportable: true },
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'and',
|
|
295
|
+
schema: {
|
|
296
|
+
keyword: schemaKeywords.and,
|
|
297
|
+
args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: 'object',
|
|
302
|
+
schema: {
|
|
303
|
+
keyword: schemaKeywords.object,
|
|
304
|
+
args: {
|
|
305
|
+
properties: {
|
|
306
|
+
firstName: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.min, args: 2 }],
|
|
307
|
+
address: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.nullable }, { keyword: schemaKeywords.describe, args: '"Your address"' }],
|
|
308
|
+
},
|
|
309
|
+
additionalProperties: [],
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: 'objectOptional',
|
|
315
|
+
schema: {
|
|
316
|
+
keyword: schemaKeywords.object,
|
|
317
|
+
args: {
|
|
318
|
+
properties: {
|
|
319
|
+
firstName: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.optional }, { keyword: schemaKeywords.min, args: 2 }],
|
|
320
|
+
address: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.nullable }, { keyword: schemaKeywords.describe, args: '"Your address"' }],
|
|
321
|
+
},
|
|
322
|
+
additionalProperties: [],
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: 'objectArray',
|
|
328
|
+
schema: {
|
|
329
|
+
keyword: schemaKeywords.object,
|
|
330
|
+
args: {
|
|
331
|
+
properties: {
|
|
332
|
+
ids: [
|
|
333
|
+
{
|
|
334
|
+
keyword: schemaKeywords.array,
|
|
335
|
+
args: {
|
|
336
|
+
items: [{ keyword: schemaKeywords.matches, args: '^[a-zA-Z0-9]{1,13}$' }],
|
|
337
|
+
min: 3,
|
|
338
|
+
max: 10,
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
],
|
|
342
|
+
},
|
|
343
|
+
additionalProperties: [],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
name: 'objectDates',
|
|
349
|
+
schema: {
|
|
350
|
+
keyword: schemaKeywords.object,
|
|
351
|
+
args: {
|
|
352
|
+
properties: {
|
|
353
|
+
dateTime: [{ keyword: schemaKeywords.datetime, args: { offset: true } }],
|
|
354
|
+
date: [{ keyword: schemaKeywords.date, args: { type: 'string' } }],
|
|
355
|
+
time: [{ keyword: schemaKeywords.time, args: { type: 'string' } }],
|
|
356
|
+
nativeDate: [{ keyword: schemaKeywords.date, args: { type: 'date' } }],
|
|
357
|
+
},
|
|
358
|
+
additionalProperties: [],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: 'objectAnd',
|
|
364
|
+
schema: {
|
|
365
|
+
keyword: schemaKeywords.object,
|
|
366
|
+
args: {
|
|
367
|
+
properties: {
|
|
368
|
+
firstName: [
|
|
369
|
+
{ keyword: schemaKeywords.deprecated },
|
|
370
|
+
{ keyword: schemaKeywords.default, args: 'test' },
|
|
371
|
+
{
|
|
372
|
+
keyword: schemaKeywords.min,
|
|
373
|
+
args: 2,
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
keyword: schemaKeywords.string,
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
age: [
|
|
380
|
+
{ keyword: schemaKeywords.example, args: '2' },
|
|
381
|
+
{ keyword: schemaKeywords.default, args: 2 },
|
|
382
|
+
{
|
|
383
|
+
keyword: schemaKeywords.min,
|
|
384
|
+
args: 3,
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
keyword: schemaKeywords.number,
|
|
388
|
+
},
|
|
389
|
+
],
|
|
390
|
+
address: [
|
|
391
|
+
{
|
|
392
|
+
keyword: schemaKeywords.and,
|
|
393
|
+
args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],
|
|
394
|
+
},
|
|
395
|
+
{ keyword: schemaKeywords.nullable },
|
|
396
|
+
{ keyword: schemaKeywords.describe, args: 'Your address' },
|
|
397
|
+
],
|
|
398
|
+
},
|
|
399
|
+
additionalProperties: [],
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
name: 'objectEnum',
|
|
405
|
+
schema: {
|
|
406
|
+
keyword: schemaKeywords.object,
|
|
407
|
+
args: {
|
|
408
|
+
properties: {
|
|
409
|
+
version: [
|
|
410
|
+
{
|
|
411
|
+
keyword: schemaKeywords.schema,
|
|
412
|
+
args: {
|
|
413
|
+
format: 'string',
|
|
414
|
+
type: 'string',
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
keyword: schemaKeywords.enum,
|
|
419
|
+
args: {
|
|
420
|
+
name: 'enum',
|
|
421
|
+
typeName: 'Enum',
|
|
422
|
+
asConst: false,
|
|
423
|
+
items: [
|
|
424
|
+
{ name: 'A', value: 'A', format: schemaKeywords.string },
|
|
425
|
+
{ name: 'B', value: 'B', format: schemaKeywords.string },
|
|
426
|
+
{ name: 'C', value: 'C', format: schemaKeywords.string },
|
|
427
|
+
{ name: 2, value: 2, format: schemaKeywords.number },
|
|
428
|
+
],
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
keyword: schemaKeywords.min,
|
|
433
|
+
args: 4,
|
|
434
|
+
},
|
|
435
|
+
{ keyword: schemaKeywords.describe, args: 'Your address' },
|
|
436
|
+
],
|
|
437
|
+
},
|
|
438
|
+
additionalProperties: [],
|
|
439
|
+
},
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: 'objectArrayObject',
|
|
444
|
+
schema: {
|
|
445
|
+
keyword: schemaKeywords.object,
|
|
446
|
+
args: {
|
|
447
|
+
properties: {
|
|
448
|
+
ids: [
|
|
449
|
+
{
|
|
450
|
+
keyword: schemaKeywords.array,
|
|
451
|
+
args: {
|
|
452
|
+
items: [
|
|
453
|
+
{
|
|
454
|
+
keyword: schemaKeywords.object,
|
|
455
|
+
args: {
|
|
456
|
+
properties: {
|
|
457
|
+
enum: [
|
|
458
|
+
{
|
|
459
|
+
keyword: schemaKeywords.schema,
|
|
460
|
+
args: {
|
|
461
|
+
format: 'string',
|
|
462
|
+
type: 'string',
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
keyword: schemaKeywords.enum,
|
|
467
|
+
args: {
|
|
468
|
+
name: 'enum',
|
|
469
|
+
typeName: 'Enum',
|
|
470
|
+
asConst: false,
|
|
471
|
+
items: [
|
|
472
|
+
{ name: 'A', value: 'A', format: schemaKeywords.string },
|
|
473
|
+
{ name: 'B', value: 'B', format: schemaKeywords.string },
|
|
474
|
+
{ name: 'C', value: 'C', format: schemaKeywords.string },
|
|
475
|
+
{ name: 2, value: 2, format: schemaKeywords.number },
|
|
476
|
+
],
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
],
|
|
480
|
+
},
|
|
481
|
+
additionalProperties: [],
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
min: 3,
|
|
486
|
+
max: 10,
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
],
|
|
490
|
+
},
|
|
491
|
+
additionalProperties: [],
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
name: 'objectEmpty',
|
|
497
|
+
schema: {
|
|
498
|
+
keyword: schemaKeywords.object,
|
|
499
|
+
args: {
|
|
500
|
+
properties: {},
|
|
501
|
+
additionalProperties: [],
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'default',
|
|
507
|
+
schema: {
|
|
508
|
+
keyword: schemaKeywords.default,
|
|
509
|
+
},
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: 'default',
|
|
513
|
+
schema: {
|
|
514
|
+
keyword: schemaKeywords.default,
|
|
515
|
+
args: 'default',
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
name: 'blob',
|
|
520
|
+
schema: {
|
|
521
|
+
keyword: schemaKeywords.blob,
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: 'nullableAdditionalProperties',
|
|
526
|
+
schema: {
|
|
527
|
+
keyword: schemaKeywords.object,
|
|
528
|
+
args: {
|
|
529
|
+
properties: {},
|
|
530
|
+
additionalProperties: [
|
|
531
|
+
{
|
|
532
|
+
keyword: schemaKeywords.string,
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
args: {
|
|
536
|
+
format: undefined,
|
|
537
|
+
type: schemaKeywords.string,
|
|
538
|
+
},
|
|
539
|
+
keyword: schemaKeywords.schema,
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
keyword: schemaKeywords.nullable,
|
|
543
|
+
},
|
|
544
|
+
],
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
]
|
|
549
|
+
|
|
550
|
+
const full: Array<{ name: string; schema: Schema[] }> = [
|
|
551
|
+
{
|
|
552
|
+
name: 'Upload',
|
|
553
|
+
schema: [
|
|
554
|
+
{
|
|
555
|
+
keyword: schemaKeywords.blob,
|
|
556
|
+
},
|
|
557
|
+
],
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: 'PageSizeNumber',
|
|
561
|
+
schema: [
|
|
562
|
+
{
|
|
563
|
+
keyword: schemaKeywords.number,
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
keyword: schemaKeywords.default,
|
|
567
|
+
args: 10,
|
|
568
|
+
},
|
|
569
|
+
],
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: 'PageSizeInteger',
|
|
573
|
+
schema: [
|
|
574
|
+
{
|
|
575
|
+
keyword: schemaKeywords.integer,
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
keyword: schemaKeywords.default,
|
|
579
|
+
args: 10,
|
|
580
|
+
},
|
|
581
|
+
],
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
name: 'Object',
|
|
585
|
+
schema: [
|
|
586
|
+
{ keyword: schemaKeywords.nullable },
|
|
587
|
+
{ keyword: schemaKeywords.describe, args: 'Your address' },
|
|
588
|
+
{
|
|
589
|
+
keyword: schemaKeywords.object,
|
|
590
|
+
args: {
|
|
591
|
+
properties: {
|
|
592
|
+
firstName: [
|
|
593
|
+
{ keyword: schemaKeywords.deprecated },
|
|
594
|
+
{ keyword: schemaKeywords.default, args: 'test' },
|
|
595
|
+
{
|
|
596
|
+
keyword: schemaKeywords.min,
|
|
597
|
+
args: 2,
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
keyword: schemaKeywords.string,
|
|
601
|
+
},
|
|
602
|
+
],
|
|
603
|
+
age: [
|
|
604
|
+
{ keyword: schemaKeywords.example, args: '2' },
|
|
605
|
+
{ keyword: schemaKeywords.default, args: 2 },
|
|
606
|
+
{
|
|
607
|
+
keyword: schemaKeywords.min,
|
|
608
|
+
args: 2,
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
keyword: schemaKeywords.number,
|
|
612
|
+
},
|
|
613
|
+
],
|
|
614
|
+
address: [
|
|
615
|
+
{
|
|
616
|
+
keyword: schemaKeywords.and,
|
|
617
|
+
args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],
|
|
618
|
+
},
|
|
619
|
+
{ keyword: schemaKeywords.nullable },
|
|
620
|
+
{ keyword: schemaKeywords.describe, args: 'Your address' },
|
|
621
|
+
],
|
|
622
|
+
},
|
|
623
|
+
additionalProperties: [],
|
|
624
|
+
},
|
|
625
|
+
},
|
|
626
|
+
],
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: 'Order',
|
|
630
|
+
schema: [
|
|
631
|
+
{
|
|
632
|
+
keyword: schemaKeywords.schema,
|
|
633
|
+
args: {
|
|
634
|
+
type: 'object',
|
|
635
|
+
},
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
keyword: schemaKeywords.object,
|
|
639
|
+
args: {
|
|
640
|
+
properties: {
|
|
641
|
+
status: [
|
|
642
|
+
{
|
|
643
|
+
keyword: schemaKeywords.enum,
|
|
644
|
+
args: {
|
|
645
|
+
name: 'orderStatus',
|
|
646
|
+
asConst: false,
|
|
647
|
+
typeName: 'OrderStatus',
|
|
648
|
+
items: [
|
|
649
|
+
{ name: 'Placed', value: 'placed', format: 'string' },
|
|
650
|
+
{ name: 'Approved', value: 'approved', format: 'string' },
|
|
651
|
+
],
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
],
|
|
655
|
+
},
|
|
656
|
+
additionalProperties: [],
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
],
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
name: 'nullableAdditionalProperties',
|
|
663
|
+
schema: [
|
|
664
|
+
{
|
|
665
|
+
keyword: schemaKeywords.object,
|
|
666
|
+
args: {
|
|
667
|
+
properties: {},
|
|
668
|
+
additionalProperties: [
|
|
669
|
+
{
|
|
670
|
+
keyword: schemaKeywords.string,
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
args: {
|
|
674
|
+
format: undefined,
|
|
675
|
+
type: schemaKeywords.string,
|
|
676
|
+
},
|
|
677
|
+
keyword: schemaKeywords.schema,
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
keyword: schemaKeywords.number,
|
|
681
|
+
},
|
|
682
|
+
],
|
|
683
|
+
},
|
|
684
|
+
},
|
|
685
|
+
],
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
name: 'Record',
|
|
689
|
+
schema: [
|
|
690
|
+
{
|
|
691
|
+
keyword: schemaKeywords.object,
|
|
692
|
+
args: {
|
|
693
|
+
properties: {},
|
|
694
|
+
additionalProperties: [
|
|
695
|
+
{
|
|
696
|
+
keyword: schemaKeywords.integer,
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
keyword: schemaKeywords.schema,
|
|
700
|
+
args: {
|
|
701
|
+
type: 'integer',
|
|
702
|
+
format: 'int32',
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
keyword: schemaKeywords.optional,
|
|
707
|
+
},
|
|
708
|
+
],
|
|
709
|
+
},
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
keyword: schemaKeywords.schema,
|
|
713
|
+
args: {
|
|
714
|
+
type: 'integer',
|
|
715
|
+
format: 'int32',
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
keyword: schemaKeywords.optional,
|
|
720
|
+
},
|
|
721
|
+
],
|
|
722
|
+
},
|
|
723
|
+
]
|
|
724
|
+
|
|
725
|
+
export const schemas = {
|
|
726
|
+
basic,
|
|
727
|
+
full,
|
|
728
|
+
}
|