@sdk-it/spec 0.22.0 → 0.23.0

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.
Files changed (91) hide show
  1. package/dist/index.d.ts +7 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +19 -2629
  4. package/dist/index.js.map +4 -4
  5. package/dist/lib/find-polymorphic-varients.d.ts +1 -1
  6. package/dist/lib/find-polymorphic-varients.d.ts.map +1 -1
  7. package/dist/lib/find-polymorphic-varients.js +291 -0
  8. package/dist/lib/find-polymorphic-varients.js.map +7 -0
  9. package/dist/lib/find-polymorphic-varients.test.js +615 -0
  10. package/dist/lib/find-polymorphic-varients.test.js.map +7 -0
  11. package/dist/lib/find-unique-schema-name.js +16 -0
  12. package/dist/lib/find-unique-schema-name.js.map +7 -0
  13. package/dist/lib/for-each-operation.d.ts +3 -0
  14. package/dist/lib/for-each-operation.d.ts.map +1 -0
  15. package/dist/lib/for-each-operation.js +30 -0
  16. package/dist/lib/for-each-operation.js.map +7 -0
  17. package/dist/lib/format-name.js +86 -0
  18. package/dist/lib/format-name.js.map +7 -0
  19. package/dist/lib/get-ref-usage.d.ts +1 -1
  20. package/dist/lib/get-ref-usage.d.ts.map +1 -1
  21. package/dist/lib/get-ref-usage.js +52 -0
  22. package/dist/lib/get-ref-usage.js.map +7 -0
  23. package/dist/lib/is-primitive-schema.js +12 -0
  24. package/dist/lib/is-primitive-schema.js.map +7 -0
  25. package/dist/lib/is.d.ts +14 -0
  26. package/dist/lib/is.d.ts.map +1 -0
  27. package/dist/lib/is.js +71 -0
  28. package/dist/lib/is.js.map +7 -0
  29. package/dist/lib/loaders/load-spec.js +25 -0
  30. package/dist/lib/loaders/load-spec.js.map +7 -0
  31. package/dist/lib/loaders/local-loader.js +20 -0
  32. package/dist/lib/loaders/local-loader.js.map +7 -0
  33. package/dist/lib/loaders/postman/postman-converter.js +483 -0
  34. package/dist/lib/loaders/postman/postman-converter.js.map +7 -0
  35. package/dist/lib/loaders/postman/spec-types.js +1 -0
  36. package/dist/lib/loaders/postman/spec-types.js.map +7 -0
  37. package/dist/lib/loaders/remote-loader.js +29 -0
  38. package/dist/lib/loaders/remote-loader.js.map +7 -0
  39. package/dist/lib/metadata.js +51 -0
  40. package/dist/lib/metadata.js.map +7 -0
  41. package/dist/lib/operation.d.ts +4 -75
  42. package/dist/lib/operation.d.ts.map +1 -1
  43. package/dist/lib/operation.js +402 -0
  44. package/dist/lib/operation.js.map +7 -0
  45. package/dist/lib/operation.test.js +261 -0
  46. package/dist/lib/operation.test.js.map +7 -0
  47. package/dist/lib/options.d.ts +30 -0
  48. package/dist/lib/options.d.ts.map +1 -0
  49. package/dist/lib/options.js +54 -0
  50. package/dist/lib/options.js.map +7 -0
  51. package/dist/lib/overview-docs.d.ts +4 -0
  52. package/dist/lib/overview-docs.d.ts.map +1 -0
  53. package/dist/lib/overview-docs.js +276 -0
  54. package/dist/lib/overview-docs.js.map +7 -0
  55. package/dist/lib/pagination/pagination-result.js +235 -0
  56. package/dist/lib/pagination/pagination-result.js.map +7 -0
  57. package/dist/lib/pagination/pagination-result.test.js +548 -0
  58. package/dist/lib/pagination/pagination-result.test.js.map +7 -0
  59. package/dist/lib/pagination/pagination.d.ts +1 -1
  60. package/dist/lib/pagination/pagination.d.ts.map +1 -1
  61. package/dist/lib/pagination/pagination.js +222 -0
  62. package/dist/lib/pagination/pagination.js.map +7 -0
  63. package/dist/lib/pagination/pagination.test.js +378 -0
  64. package/dist/lib/pagination/pagination.test.js.map +7 -0
  65. package/dist/lib/reserved-keywords.d.ts +6 -0
  66. package/dist/lib/reserved-keywords.d.ts.map +1 -0
  67. package/dist/lib/reserved-keywords.js +71 -0
  68. package/dist/lib/reserved-keywords.js.map +7 -0
  69. package/dist/lib/security.d.ts +6 -4
  70. package/dist/lib/security.d.ts.map +1 -1
  71. package/dist/lib/security.js +75 -0
  72. package/dist/lib/security.js.map +7 -0
  73. package/dist/lib/sidebar.d.ts +5 -3
  74. package/dist/lib/sidebar.d.ts.map +1 -1
  75. package/dist/lib/sidebar.js +79 -0
  76. package/dist/lib/sidebar.js.map +7 -0
  77. package/dist/lib/tag.d.ts +19 -0
  78. package/dist/lib/tag.d.ts.map +1 -0
  79. package/dist/lib/tag.js +132 -0
  80. package/dist/lib/tag.js.map +7 -0
  81. package/dist/lib/tune.d.ts +1 -1
  82. package/dist/lib/tune.d.ts.map +1 -1
  83. package/dist/lib/tune.js +291 -0
  84. package/dist/lib/tune.js.map +7 -0
  85. package/dist/lib/tune.test.js +60 -0
  86. package/dist/lib/tune.test.js.map +7 -0
  87. package/dist/lib/types.d.ts +37 -0
  88. package/dist/lib/types.d.ts.map +1 -0
  89. package/dist/lib/types.js +1 -0
  90. package/dist/lib/types.js.map +7 -0
  91. package/package.json +4 -3
@@ -0,0 +1,615 @@
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 { augmentSpec } from "./operation.ts";
9
+ function createSpec(openapi) {
10
+ return augmentSpec(
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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/lib/find-polymorphic-varients.test.ts"],
4
+ "sourcesContent": ["import { merge } from 'lodash-es';\nimport assert from 'node:assert';\nimport { describe, it } from 'node:test';\nimport type { OpenAPIObject, SchemaObject } from 'openapi3-ts/oas31';\n\nimport {\n type Varient,\n findPolymorphicVarients,\n findVarients,\n} from './find-polymorphic-varients.ts';\nimport { augmentSpec } from './operation.ts';\nimport type { OurOpenAPIObject } from './types.ts';\n\nfunction createSpec(openapi?: Partial<OpenAPIObject>): OurOpenAPIObject {\n return augmentSpec(\n {\n spec: merge(\n {\n openapi: '3.1.0',\n info: {\n title: 'Test API',\n version: '1.0.0',\n },\n components: {\n schemas: {},\n securitySchemes: {},\n },\n paths: {},\n },\n openapi,\n ),\n },\n true,\n );\n}\ndescribe('findVarients', () => {\n describe('strings', () => {\n it('names string type as text', () => {\n const spec = createSpec();\n const result = findVarients(spec, [{ type: 'string' }]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'text',\n position: 0,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n it('names string based on format', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n {\n type: 'string',\n format: 'date-time',\n },\n { type: 'string' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'dateTime',\n position: 0,\n priority: 90,\n type: 'string',\n },\n {\n name: 'text',\n position: 1,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it('names string based on const value', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n { type: 'string', const: 'active' },\n { type: 'string', const: '' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'active',\n position: 0,\n priority: 100,\n type: 'string',\n },\n {\n name: 'empty',\n position: 1,\n priority: 99,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it.skip('names string based on enum values', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n { type: 'string', enum: ['pending', 'completed', ''] },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'pending',\n position: 0,\n priority: 80,\n type: 'string',\n },\n {\n name: 'completed',\n position: 0,\n priority: 79,\n type: 'string',\n },\n {\n name: 'empty',\n position: 0,\n priority: 78,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it.skip('prioritizes const first', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n { type: 'string', format: 'email' },\n { type: 'string', const: 'fixed' },\n { type: 'string', enum: ['option1', 'option2'] },\n { type: 'string' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'fixed',\n position: 1,\n priority: 99,\n type: 'string',\n },\n {\n name: 'email',\n position: 0,\n priority: 90,\n type: 'string',\n },\n {\n name: 'option1',\n position: 2,\n priority: 78,\n type: 'string',\n },\n {\n name: 'option2',\n position: 2,\n priority: 77,\n type: 'string',\n },\n {\n name: 'text',\n position: 3,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it('handles format priority over enum', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n { type: 'string', format: 'email', enum: ['user@example.com'] },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'email',\n position: 0,\n priority: 90,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it('handles const priority over enum', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n { type: 'string', const: 'fixed', enum: ['option1', 'option2'] },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'fixed',\n position: 0,\n priority: 100,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it('handles complex format names with camelCase conversion', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n { type: 'string', format: 'date-time' },\n { type: 'string', format: 'iso-8601' },\n { type: 'string', format: 'binary' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'dateTime',\n position: 0,\n priority: 90,\n type: 'string',\n },\n {\n name: 'iso8601',\n position: 1,\n priority: 89,\n type: 'string',\n },\n {\n name: 'binary',\n position: 2,\n priority: 88,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n });\n\n describe('numbers', () => {\n it('names number type as number', () => {\n const spec = createSpec();\n const result = findVarients(spec, [{ type: 'number' }]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'number',\n position: 0,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n\n it('names integer type as integer', () => {\n const spec = createSpec();\n const result = findVarients(spec, [{ type: 'integer' }]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'number',\n position: 0,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n\n it('names number based on format', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n {\n type: 'number',\n format: 'float',\n },\n {\n type: 'number',\n format: 'double',\n },\n {\n type: 'integer',\n format: 'int64',\n },\n { type: 'number' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'float',\n position: 0,\n priority: 90,\n type: 'number',\n },\n {\n name: 'double',\n position: 1,\n priority: 89,\n type: 'number',\n },\n {\n name: 'integer',\n position: 2,\n priority: 87,\n type: 'number',\n },\n {\n name: 'number',\n position: 3,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n });\n\n describe('mixed types', () => {\n it('handles mixed string and number types', () => {\n const spec = createSpec();\n const result = findVarients(spec, [\n { type: 'number' },\n { type: 'string' },\n ]);\n assert.deepStrictEqual(result, [\n {\n name: 'text',\n position: 1,\n type: 'string',\n },\n {\n name: 'number',\n position: 0,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n });\n});\n\ndescribe('findPolymorphicVarients', () => {\n describe('strings', () => {\n it('returns single variant per position for multiple strings', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'string', format: 'date-time' },\n { type: 'string' },\n { type: 'string', const: 'active' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'active',\n position: 2,\n priority: 98,\n type: 'string',\n },\n {\n name: 'dateTime',\n position: 0,\n priority: 90,\n type: 'string',\n },\n {\n name: 'text',\n position: 1,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it.skip('returns first variant when multiple enums at same position', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'string', enum: ['first', 'second', 'third'] },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'first',\n position: 0,\n priority: 80,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it.skip('selects first variant from multiple at same position', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'string', enum: ['option1', 'option2'] },\n { type: 'string', format: 'email' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'email',\n position: 1,\n priority: 88,\n type: 'string',\n },\n {\n name: 'option1',\n position: 0,\n priority: 80,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n\n it.skip('handles mixed types selecting one per position', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'string', enum: ['a', 'b'] },\n { type: 'number' },\n { type: 'string', const: 'fixed' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'fixed',\n position: 2,\n priority: 98,\n type: 'string',\n },\n {\n name: 'a',\n position: 0,\n priority: 80,\n type: 'string',\n },\n {\n name: 'number',\n position: 1,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n\n it('handles plain strings mixed with formatted strings', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'string' },\n { type: 'string', format: 'password' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'password',\n position: 1,\n priority: 89,\n type: 'string',\n },\n {\n name: 'text',\n position: 0,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n it('ignore duplicates', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'string' },\n { type: 'string', format: 'password' },\n { type: 'string' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'password',\n position: 1,\n priority: 89,\n type: 'string',\n },\n {\n name: 'text',\n position: 0,\n type: 'string',\n },\n ] satisfies Varient[]);\n });\n });\n\n describe('numbers', () => {\n it('returns single variant per position for multiple numbers', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'number', format: 'float' },\n { type: 'integer' },\n { type: 'number', format: 'double' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'float',\n position: 0,\n priority: 90,\n type: 'number',\n },\n {\n name: 'double',\n position: 2,\n priority: 89,\n type: 'number',\n },\n {\n name: 'number',\n position: 1,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n\n it('returns first variant when multiple number formats at same position', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'number', format: 'float' },\n { type: 'number', format: 'double' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'float',\n position: 0,\n priority: 90,\n type: 'number',\n },\n {\n name: 'double',\n position: 1,\n priority: 89,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n\n it('handles mixed number and integer types', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'integer', format: 'int64' },\n { type: 'number' },\n { type: 'integer' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'integer',\n position: 0,\n priority: 89,\n type: 'number',\n },\n {\n name: 'number',\n position: 1,\n type: 'number',\n },\n {\n name: 'number',\n position: 2,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n\n it('handles plain numbers mixed with formatted numbers', () => {\n const spec = createSpec();\n const result = findPolymorphicVarients(spec, [\n { type: 'number' },\n { type: 'number', format: 'float' },\n { type: 'number' },\n ]);\n\n assert.deepStrictEqual(result, [\n {\n name: 'float',\n position: 1,\n priority: 89,\n type: 'number',\n },\n {\n name: 'number',\n position: 0,\n type: 'number',\n },\n {\n name: 'number',\n position: 2,\n type: 'number',\n },\n ] satisfies Varient[]);\n });\n });\n\n describe('arrays', () => {\n it.only('complex', () => {\n const spec = createSpec({\n components: {\n schemas: {\n RouteConfig: {\n anyOf: [\n {\n type: 'array',\n items: {\n anyOf: [\n {\n type: 'string',\n enum: ['image', 'video', 'audio'],\n },\n {\n type: 'string',\n enum: [\n 'application/andrew-inset',\n 'application/applixware',\n ],\n },\n ],\n },\n },\n {\n type: 'object',\n additionalProperties: {\n type: 'object',\n properties: {\n maxFileSize: {\n type: 'string',\n description:\n 'The maximum file size allowed for a given file type.',\n example: '4MB',\n },\n maxFileCount: {\n type: 'number',\n description:\n 'Maximum allowed files for a given file type.',\n example: 1,\n },\n contentDisposition: {\n type: 'string',\n enum: ['inline', 'attachment'],\n default: 'inline',\n },\n acl: {\n type: 'string',\n enum: ['public-read', 'private'],\n },\n },\n },\n },\n ],\n },\n },\n },\n });\n const varients = findVarients(\n spec,\n (spec.components.schemas.RouteConfig as SchemaObject).anyOf ?? [],\n );\n\n assert.deepStrictEqual(varients, [\n {\n name: 'textList',\n type: 'array',\n subtype: 'string',\n position: 0,\n },\n {\n static: true,\n subtype: 'string',\n source: 'public-read',\n name: 'public-read',\n type: 'object',\n position: 1,\n },\n ]);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,YAAY;AACnB,SAAS,UAAU,UAAU;AAG7B;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAG5B,SAAS,WAAW,SAAoD;AACtE,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,QACJ;AAAA,UACE,SAAS;AAAA,UACT,MAAM;AAAA,YACJ,OAAO;AAAA,YACP,SAAS;AAAA,UACX;AAAA,UACA,YAAY;AAAA,YACV,SAAS,CAAC;AAAA,YACV,iBAAiB,CAAC;AAAA,UACpB;AAAA,UACA,OAAO,CAAC;AAAA,QACV;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;AACA,SAAS,gBAAgB,MAAM;AAC7B,WAAS,WAAW,MAAM;AACxB,OAAG,6BAA6B,MAAM;AACpC,YAAM,OAAO,WAAW;AACxB,YA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AU;AAAA,QAC/B;AAAA,UACE,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,UACT,UAAU;AAAA,QACZ;AAAA,QACA;AAAA,UACE,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,MAAM;AAAA,UACN,MAAM;AAAA,UACN,UAAU;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,16 @@
1
+ import { joinSkipDigits, pascalcase } from "@sdk-it/core";
2
+ const reservedNames = /* @__PURE__ */ new Set(["Function", "Error"]);
3
+ function findUniqueSchemaName(spec, initialName, potentialSuffixList, fallback) {
4
+ spec.components ??= {};
5
+ spec.components.schemas ??= {};
6
+ let name = pascalcase(initialName);
7
+ while (spec.components.schemas[name] || reservedNames.has(name)) {
8
+ const suffix = potentialSuffixList.shift();
9
+ name = pascalcase(joinSkipDigits([name, suffix || ""], " "));
10
+ }
11
+ return initialName === name ? fallback ?? name : name;
12
+ }
13
+ export {
14
+ findUniqueSchemaName
15
+ };
16
+ //# sourceMappingURL=find-unique-schema-name.js.map