@sdk-it/spec 0.31.0 → 0.31.1
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/package.json +4 -3
- package/dist/lib/find-polymorphic-varients.test.d.ts +0 -2
- package/dist/lib/find-polymorphic-varients.test.d.ts.map +0 -1
- package/dist/lib/find-polymorphic-varients.test.js +0 -615
- package/dist/lib/find-polymorphic-varients.test.js.map +0 -7
- package/dist/lib/ir.test.d.ts +0 -2
- package/dist/lib/ir.test.d.ts.map +0 -1
- package/dist/lib/ir.test.js +0 -261
- package/dist/lib/ir.test.js.map +0 -7
- package/dist/lib/metadata.test.d.ts +0 -2
- package/dist/lib/metadata.test.d.ts.map +0 -1
- package/dist/lib/metadata.test.js +0 -359
- package/dist/lib/metadata.test.js.map +0 -7
- package/dist/lib/pagination/pagination-result.test.d.ts +0 -2
- package/dist/lib/pagination/pagination-result.test.d.ts.map +0 -1
- package/dist/lib/pagination/pagination-result.test.js +0 -548
- package/dist/lib/pagination/pagination-result.test.js.map +0 -7
- package/dist/lib/pagination/pagination.test.d.ts +0 -2
- package/dist/lib/pagination/pagination.test.d.ts.map +0 -1
- package/dist/lib/pagination/pagination.test.js +0 -379
- package/dist/lib/pagination/pagination.test.js.map +0 -7
- package/dist/lib/tune.test.d.ts +0 -2
- package/dist/lib/tune.test.d.ts.map +0 -1
- package/dist/lib/tune.test.js +0 -60
- package/dist/lib/tune.test.js.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-it/spec",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,10 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
-
"!**/*.tsbuildinfo"
|
|
26
|
+
"!**/*.tsbuildinfo",
|
|
27
|
+
"!**/*.test.*"
|
|
27
28
|
],
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@sdk-it/core": "0.31.
|
|
30
|
+
"@sdk-it/core": "0.31.1",
|
|
30
31
|
"openapi3-ts": "4.5.0",
|
|
31
32
|
"pluralize": "^8.0.0",
|
|
32
33
|
"stringcase": "^4.3.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-polymorphic-varients.test.d.ts","sourceRoot":"","sources":["../../src/lib/find-polymorphic-varients.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,615 +0,0 @@
|
|
|
1
|
-
import { merge } from "lodash-es";
|
|
2
|
-
import assert from "node:assert";
|
|
3
|
-
import { describe, it } from "node:test";
|
|
4
|
-
import {
|
|
5
|
-
findPolymorphicVarients,
|
|
6
|
-
findVarients
|
|
7
|
-
} from "./find-polymorphic-varients.ts";
|
|
8
|
-
import { toIR } from "./ir.ts";
|
|
9
|
-
function createSpec(openapi) {
|
|
10
|
-
return toIR(
|
|
11
|
-
{
|
|
12
|
-
spec: merge(
|
|
13
|
-
{
|
|
14
|
-
openapi: "3.1.0",
|
|
15
|
-
info: {
|
|
16
|
-
title: "Test API",
|
|
17
|
-
version: "1.0.0"
|
|
18
|
-
},
|
|
19
|
-
components: {
|
|
20
|
-
schemas: {},
|
|
21
|
-
securitySchemes: {}
|
|
22
|
-
},
|
|
23
|
-
paths: {}
|
|
24
|
-
},
|
|
25
|
-
openapi
|
|
26
|
-
)
|
|
27
|
-
},
|
|
28
|
-
true
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
describe("findVarients", () => {
|
|
32
|
-
describe("strings", () => {
|
|
33
|
-
it("names string type as text", () => {
|
|
34
|
-
const spec = createSpec();
|
|
35
|
-
const result = findVarients(spec, [{ type: "string" }]);
|
|
36
|
-
assert.deepStrictEqual(result, [
|
|
37
|
-
{
|
|
38
|
-
name: "text",
|
|
39
|
-
position: 0,
|
|
40
|
-
type: "string"
|
|
41
|
-
}
|
|
42
|
-
]);
|
|
43
|
-
});
|
|
44
|
-
it("names string based on format", () => {
|
|
45
|
-
const spec = createSpec();
|
|
46
|
-
const result = findVarients(spec, [
|
|
47
|
-
{
|
|
48
|
-
type: "string",
|
|
49
|
-
format: "date-time"
|
|
50
|
-
},
|
|
51
|
-
{ type: "string" }
|
|
52
|
-
]);
|
|
53
|
-
assert.deepStrictEqual(result, [
|
|
54
|
-
{
|
|
55
|
-
name: "dateTime",
|
|
56
|
-
position: 0,
|
|
57
|
-
priority: 90,
|
|
58
|
-
type: "string"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "text",
|
|
62
|
-
position: 1,
|
|
63
|
-
type: "string"
|
|
64
|
-
}
|
|
65
|
-
]);
|
|
66
|
-
});
|
|
67
|
-
it("names string based on const value", () => {
|
|
68
|
-
const spec = createSpec();
|
|
69
|
-
const result = findVarients(spec, [
|
|
70
|
-
{ type: "string", const: "active" },
|
|
71
|
-
{ type: "string", const: "" }
|
|
72
|
-
]);
|
|
73
|
-
assert.deepStrictEqual(result, [
|
|
74
|
-
{
|
|
75
|
-
name: "active",
|
|
76
|
-
position: 0,
|
|
77
|
-
priority: 100,
|
|
78
|
-
type: "string"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "empty",
|
|
82
|
-
position: 1,
|
|
83
|
-
priority: 99,
|
|
84
|
-
type: "string"
|
|
85
|
-
}
|
|
86
|
-
]);
|
|
87
|
-
});
|
|
88
|
-
it.skip("names string based on enum values", () => {
|
|
89
|
-
const spec = createSpec();
|
|
90
|
-
const result = findVarients(spec, [
|
|
91
|
-
{ type: "string", enum: ["pending", "completed", ""] }
|
|
92
|
-
]);
|
|
93
|
-
assert.deepStrictEqual(result, [
|
|
94
|
-
{
|
|
95
|
-
name: "pending",
|
|
96
|
-
position: 0,
|
|
97
|
-
priority: 80,
|
|
98
|
-
type: "string"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "completed",
|
|
102
|
-
position: 0,
|
|
103
|
-
priority: 79,
|
|
104
|
-
type: "string"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: "empty",
|
|
108
|
-
position: 0,
|
|
109
|
-
priority: 78,
|
|
110
|
-
type: "string"
|
|
111
|
-
}
|
|
112
|
-
]);
|
|
113
|
-
});
|
|
114
|
-
it.skip("prioritizes const first", () => {
|
|
115
|
-
const spec = createSpec();
|
|
116
|
-
const result = findVarients(spec, [
|
|
117
|
-
{ type: "string", format: "email" },
|
|
118
|
-
{ type: "string", const: "fixed" },
|
|
119
|
-
{ type: "string", enum: ["option1", "option2"] },
|
|
120
|
-
{ type: "string" }
|
|
121
|
-
]);
|
|
122
|
-
assert.deepStrictEqual(result, [
|
|
123
|
-
{
|
|
124
|
-
name: "fixed",
|
|
125
|
-
position: 1,
|
|
126
|
-
priority: 99,
|
|
127
|
-
type: "string"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: "email",
|
|
131
|
-
position: 0,
|
|
132
|
-
priority: 90,
|
|
133
|
-
type: "string"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "option1",
|
|
137
|
-
position: 2,
|
|
138
|
-
priority: 78,
|
|
139
|
-
type: "string"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: "option2",
|
|
143
|
-
position: 2,
|
|
144
|
-
priority: 77,
|
|
145
|
-
type: "string"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "text",
|
|
149
|
-
position: 3,
|
|
150
|
-
type: "string"
|
|
151
|
-
}
|
|
152
|
-
]);
|
|
153
|
-
});
|
|
154
|
-
it("handles format priority over enum", () => {
|
|
155
|
-
const spec = createSpec();
|
|
156
|
-
const result = findVarients(spec, [
|
|
157
|
-
{ type: "string", format: "email", enum: ["user@example.com"] }
|
|
158
|
-
]);
|
|
159
|
-
assert.deepStrictEqual(result, [
|
|
160
|
-
{
|
|
161
|
-
name: "email",
|
|
162
|
-
position: 0,
|
|
163
|
-
priority: 90,
|
|
164
|
-
type: "string"
|
|
165
|
-
}
|
|
166
|
-
]);
|
|
167
|
-
});
|
|
168
|
-
it("handles const priority over enum", () => {
|
|
169
|
-
const spec = createSpec();
|
|
170
|
-
const result = findVarients(spec, [
|
|
171
|
-
{ type: "string", const: "fixed", enum: ["option1", "option2"] }
|
|
172
|
-
]);
|
|
173
|
-
assert.deepStrictEqual(result, [
|
|
174
|
-
{
|
|
175
|
-
name: "fixed",
|
|
176
|
-
position: 0,
|
|
177
|
-
priority: 100,
|
|
178
|
-
type: "string"
|
|
179
|
-
}
|
|
180
|
-
]);
|
|
181
|
-
});
|
|
182
|
-
it("handles complex format names with camelCase conversion", () => {
|
|
183
|
-
const spec = createSpec();
|
|
184
|
-
const result = findVarients(spec, [
|
|
185
|
-
{ type: "string", format: "date-time" },
|
|
186
|
-
{ type: "string", format: "iso-8601" },
|
|
187
|
-
{ type: "string", format: "binary" }
|
|
188
|
-
]);
|
|
189
|
-
assert.deepStrictEqual(result, [
|
|
190
|
-
{
|
|
191
|
-
name: "dateTime",
|
|
192
|
-
position: 0,
|
|
193
|
-
priority: 90,
|
|
194
|
-
type: "string"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: "iso8601",
|
|
198
|
-
position: 1,
|
|
199
|
-
priority: 89,
|
|
200
|
-
type: "string"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: "binary",
|
|
204
|
-
position: 2,
|
|
205
|
-
priority: 88,
|
|
206
|
-
type: "string"
|
|
207
|
-
}
|
|
208
|
-
]);
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
describe("numbers", () => {
|
|
212
|
-
it("names number type as number", () => {
|
|
213
|
-
const spec = createSpec();
|
|
214
|
-
const result = findVarients(spec, [{ type: "number" }]);
|
|
215
|
-
assert.deepStrictEqual(result, [
|
|
216
|
-
{
|
|
217
|
-
name: "number",
|
|
218
|
-
position: 0,
|
|
219
|
-
type: "number"
|
|
220
|
-
}
|
|
221
|
-
]);
|
|
222
|
-
});
|
|
223
|
-
it("names integer type as integer", () => {
|
|
224
|
-
const spec = createSpec();
|
|
225
|
-
const result = findVarients(spec, [{ type: "integer" }]);
|
|
226
|
-
assert.deepStrictEqual(result, [
|
|
227
|
-
{
|
|
228
|
-
name: "number",
|
|
229
|
-
position: 0,
|
|
230
|
-
type: "number"
|
|
231
|
-
}
|
|
232
|
-
]);
|
|
233
|
-
});
|
|
234
|
-
it("names number based on format", () => {
|
|
235
|
-
const spec = createSpec();
|
|
236
|
-
const result = findVarients(spec, [
|
|
237
|
-
{
|
|
238
|
-
type: "number",
|
|
239
|
-
format: "float"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
type: "number",
|
|
243
|
-
format: "double"
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
type: "integer",
|
|
247
|
-
format: "int64"
|
|
248
|
-
},
|
|
249
|
-
{ type: "number" }
|
|
250
|
-
]);
|
|
251
|
-
assert.deepStrictEqual(result, [
|
|
252
|
-
{
|
|
253
|
-
name: "float",
|
|
254
|
-
position: 0,
|
|
255
|
-
priority: 90,
|
|
256
|
-
type: "number"
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
name: "double",
|
|
260
|
-
position: 1,
|
|
261
|
-
priority: 89,
|
|
262
|
-
type: "number"
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
name: "integer",
|
|
266
|
-
position: 2,
|
|
267
|
-
priority: 87,
|
|
268
|
-
type: "number"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: "number",
|
|
272
|
-
position: 3,
|
|
273
|
-
type: "number"
|
|
274
|
-
}
|
|
275
|
-
]);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
describe("mixed types", () => {
|
|
279
|
-
it("handles mixed string and number types", () => {
|
|
280
|
-
const spec = createSpec();
|
|
281
|
-
const result = findVarients(spec, [
|
|
282
|
-
{ type: "number" },
|
|
283
|
-
{ type: "string" }
|
|
284
|
-
]);
|
|
285
|
-
assert.deepStrictEqual(result, [
|
|
286
|
-
{
|
|
287
|
-
name: "text",
|
|
288
|
-
position: 1,
|
|
289
|
-
type: "string"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
name: "number",
|
|
293
|
-
position: 0,
|
|
294
|
-
type: "number"
|
|
295
|
-
}
|
|
296
|
-
]);
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
describe("findPolymorphicVarients", () => {
|
|
301
|
-
describe("strings", () => {
|
|
302
|
-
it("returns single variant per position for multiple strings", () => {
|
|
303
|
-
const spec = createSpec();
|
|
304
|
-
const result = findPolymorphicVarients(spec, [
|
|
305
|
-
{ type: "string", format: "date-time" },
|
|
306
|
-
{ type: "string" },
|
|
307
|
-
{ type: "string", const: "active" }
|
|
308
|
-
]);
|
|
309
|
-
assert.deepStrictEqual(result, [
|
|
310
|
-
{
|
|
311
|
-
name: "active",
|
|
312
|
-
position: 2,
|
|
313
|
-
priority: 98,
|
|
314
|
-
type: "string"
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
name: "dateTime",
|
|
318
|
-
position: 0,
|
|
319
|
-
priority: 90,
|
|
320
|
-
type: "string"
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
name: "text",
|
|
324
|
-
position: 1,
|
|
325
|
-
type: "string"
|
|
326
|
-
}
|
|
327
|
-
]);
|
|
328
|
-
});
|
|
329
|
-
it.skip("returns first variant when multiple enums at same position", () => {
|
|
330
|
-
const spec = createSpec();
|
|
331
|
-
const result = findPolymorphicVarients(spec, [
|
|
332
|
-
{ type: "string", enum: ["first", "second", "third"] }
|
|
333
|
-
]);
|
|
334
|
-
assert.deepStrictEqual(result, [
|
|
335
|
-
{
|
|
336
|
-
name: "first",
|
|
337
|
-
position: 0,
|
|
338
|
-
priority: 80,
|
|
339
|
-
type: "string"
|
|
340
|
-
}
|
|
341
|
-
]);
|
|
342
|
-
});
|
|
343
|
-
it.skip("selects first variant from multiple at same position", () => {
|
|
344
|
-
const spec = createSpec();
|
|
345
|
-
const result = findPolymorphicVarients(spec, [
|
|
346
|
-
{ type: "string", enum: ["option1", "option2"] },
|
|
347
|
-
{ type: "string", format: "email" }
|
|
348
|
-
]);
|
|
349
|
-
assert.deepStrictEqual(result, [
|
|
350
|
-
{
|
|
351
|
-
name: "email",
|
|
352
|
-
position: 1,
|
|
353
|
-
priority: 88,
|
|
354
|
-
type: "string"
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
name: "option1",
|
|
358
|
-
position: 0,
|
|
359
|
-
priority: 80,
|
|
360
|
-
type: "string"
|
|
361
|
-
}
|
|
362
|
-
]);
|
|
363
|
-
});
|
|
364
|
-
it.skip("handles mixed types selecting one per position", () => {
|
|
365
|
-
const spec = createSpec();
|
|
366
|
-
const result = findPolymorphicVarients(spec, [
|
|
367
|
-
{ type: "string", enum: ["a", "b"] },
|
|
368
|
-
{ type: "number" },
|
|
369
|
-
{ type: "string", const: "fixed" }
|
|
370
|
-
]);
|
|
371
|
-
assert.deepStrictEqual(result, [
|
|
372
|
-
{
|
|
373
|
-
name: "fixed",
|
|
374
|
-
position: 2,
|
|
375
|
-
priority: 98,
|
|
376
|
-
type: "string"
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
name: "a",
|
|
380
|
-
position: 0,
|
|
381
|
-
priority: 80,
|
|
382
|
-
type: "string"
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
name: "number",
|
|
386
|
-
position: 1,
|
|
387
|
-
type: "number"
|
|
388
|
-
}
|
|
389
|
-
]);
|
|
390
|
-
});
|
|
391
|
-
it("handles plain strings mixed with formatted strings", () => {
|
|
392
|
-
const spec = createSpec();
|
|
393
|
-
const result = findPolymorphicVarients(spec, [
|
|
394
|
-
{ type: "string" },
|
|
395
|
-
{ type: "string", format: "password" }
|
|
396
|
-
]);
|
|
397
|
-
assert.deepStrictEqual(result, [
|
|
398
|
-
{
|
|
399
|
-
name: "password",
|
|
400
|
-
position: 1,
|
|
401
|
-
priority: 89,
|
|
402
|
-
type: "string"
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
name: "text",
|
|
406
|
-
position: 0,
|
|
407
|
-
type: "string"
|
|
408
|
-
}
|
|
409
|
-
]);
|
|
410
|
-
});
|
|
411
|
-
it("ignore duplicates", () => {
|
|
412
|
-
const spec = createSpec();
|
|
413
|
-
const result = findPolymorphicVarients(spec, [
|
|
414
|
-
{ type: "string" },
|
|
415
|
-
{ type: "string", format: "password" },
|
|
416
|
-
{ type: "string" }
|
|
417
|
-
]);
|
|
418
|
-
assert.deepStrictEqual(result, [
|
|
419
|
-
{
|
|
420
|
-
name: "password",
|
|
421
|
-
position: 1,
|
|
422
|
-
priority: 89,
|
|
423
|
-
type: "string"
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
name: "text",
|
|
427
|
-
position: 0,
|
|
428
|
-
type: "string"
|
|
429
|
-
}
|
|
430
|
-
]);
|
|
431
|
-
});
|
|
432
|
-
});
|
|
433
|
-
describe("numbers", () => {
|
|
434
|
-
it("returns single variant per position for multiple numbers", () => {
|
|
435
|
-
const spec = createSpec();
|
|
436
|
-
const result = findPolymorphicVarients(spec, [
|
|
437
|
-
{ type: "number", format: "float" },
|
|
438
|
-
{ type: "integer" },
|
|
439
|
-
{ type: "number", format: "double" }
|
|
440
|
-
]);
|
|
441
|
-
assert.deepStrictEqual(result, [
|
|
442
|
-
{
|
|
443
|
-
name: "float",
|
|
444
|
-
position: 0,
|
|
445
|
-
priority: 90,
|
|
446
|
-
type: "number"
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
name: "double",
|
|
450
|
-
position: 2,
|
|
451
|
-
priority: 89,
|
|
452
|
-
type: "number"
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
name: "number",
|
|
456
|
-
position: 1,
|
|
457
|
-
type: "number"
|
|
458
|
-
}
|
|
459
|
-
]);
|
|
460
|
-
});
|
|
461
|
-
it("returns first variant when multiple number formats at same position", () => {
|
|
462
|
-
const spec = createSpec();
|
|
463
|
-
const result = findPolymorphicVarients(spec, [
|
|
464
|
-
{ type: "number", format: "float" },
|
|
465
|
-
{ type: "number", format: "double" }
|
|
466
|
-
]);
|
|
467
|
-
assert.deepStrictEqual(result, [
|
|
468
|
-
{
|
|
469
|
-
name: "float",
|
|
470
|
-
position: 0,
|
|
471
|
-
priority: 90,
|
|
472
|
-
type: "number"
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
name: "double",
|
|
476
|
-
position: 1,
|
|
477
|
-
priority: 89,
|
|
478
|
-
type: "number"
|
|
479
|
-
}
|
|
480
|
-
]);
|
|
481
|
-
});
|
|
482
|
-
it("handles mixed number and integer types", () => {
|
|
483
|
-
const spec = createSpec();
|
|
484
|
-
const result = findPolymorphicVarients(spec, [
|
|
485
|
-
{ type: "integer", format: "int64" },
|
|
486
|
-
{ type: "number" },
|
|
487
|
-
{ type: "integer" }
|
|
488
|
-
]);
|
|
489
|
-
assert.deepStrictEqual(result, [
|
|
490
|
-
{
|
|
491
|
-
name: "integer",
|
|
492
|
-
position: 0,
|
|
493
|
-
priority: 89,
|
|
494
|
-
type: "number"
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
name: "number",
|
|
498
|
-
position: 1,
|
|
499
|
-
type: "number"
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
name: "number",
|
|
503
|
-
position: 2,
|
|
504
|
-
type: "number"
|
|
505
|
-
}
|
|
506
|
-
]);
|
|
507
|
-
});
|
|
508
|
-
it("handles plain numbers mixed with formatted numbers", () => {
|
|
509
|
-
const spec = createSpec();
|
|
510
|
-
const result = findPolymorphicVarients(spec, [
|
|
511
|
-
{ type: "number" },
|
|
512
|
-
{ type: "number", format: "float" },
|
|
513
|
-
{ type: "number" }
|
|
514
|
-
]);
|
|
515
|
-
assert.deepStrictEqual(result, [
|
|
516
|
-
{
|
|
517
|
-
name: "float",
|
|
518
|
-
position: 1,
|
|
519
|
-
priority: 89,
|
|
520
|
-
type: "number"
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
name: "number",
|
|
524
|
-
position: 0,
|
|
525
|
-
type: "number"
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
name: "number",
|
|
529
|
-
position: 2,
|
|
530
|
-
type: "number"
|
|
531
|
-
}
|
|
532
|
-
]);
|
|
533
|
-
});
|
|
534
|
-
});
|
|
535
|
-
describe("arrays", () => {
|
|
536
|
-
it.only("complex", () => {
|
|
537
|
-
const spec = createSpec({
|
|
538
|
-
components: {
|
|
539
|
-
schemas: {
|
|
540
|
-
RouteConfig: {
|
|
541
|
-
anyOf: [
|
|
542
|
-
{
|
|
543
|
-
type: "array",
|
|
544
|
-
items: {
|
|
545
|
-
anyOf: [
|
|
546
|
-
{
|
|
547
|
-
type: "string",
|
|
548
|
-
enum: ["image", "video", "audio"]
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
type: "string",
|
|
552
|
-
enum: [
|
|
553
|
-
"application/andrew-inset",
|
|
554
|
-
"application/applixware"
|
|
555
|
-
]
|
|
556
|
-
}
|
|
557
|
-
]
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
type: "object",
|
|
562
|
-
additionalProperties: {
|
|
563
|
-
type: "object",
|
|
564
|
-
properties: {
|
|
565
|
-
maxFileSize: {
|
|
566
|
-
type: "string",
|
|
567
|
-
description: "The maximum file size allowed for a given file type.",
|
|
568
|
-
example: "4MB"
|
|
569
|
-
},
|
|
570
|
-
maxFileCount: {
|
|
571
|
-
type: "number",
|
|
572
|
-
description: "Maximum allowed files for a given file type.",
|
|
573
|
-
example: 1
|
|
574
|
-
},
|
|
575
|
-
contentDisposition: {
|
|
576
|
-
type: "string",
|
|
577
|
-
enum: ["inline", "attachment"],
|
|
578
|
-
default: "inline"
|
|
579
|
-
},
|
|
580
|
-
acl: {
|
|
581
|
-
type: "string",
|
|
582
|
-
enum: ["public-read", "private"]
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
const varients = findVarients(
|
|
593
|
-
spec,
|
|
594
|
-
spec.components.schemas.RouteConfig.anyOf ?? []
|
|
595
|
-
);
|
|
596
|
-
assert.deepStrictEqual(varients, [
|
|
597
|
-
{
|
|
598
|
-
name: "textList",
|
|
599
|
-
type: "array",
|
|
600
|
-
subtype: "string",
|
|
601
|
-
position: 0
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
static: true,
|
|
605
|
-
subtype: "string",
|
|
606
|
-
source: "public-read",
|
|
607
|
-
name: "public-read",
|
|
608
|
-
type: "object",
|
|
609
|
-
position: 1
|
|
610
|
-
}
|
|
611
|
-
]);
|
|
612
|
-
});
|
|
613
|
-
});
|
|
614
|
-
});
|
|
615
|
-
//# sourceMappingURL=find-polymorphic-varients.test.js.map
|