shinkansen-transmission 2.1.15 → 2.2.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.
Files changed (82) hide show
  1. package/.husky/pre-commit +4 -0
  2. package/babel.config.js +1 -1
  3. package/index.js +6 -1
  4. package/lib/index.js +1 -1
  5. package/lib/transmission/common/index.js +1 -1
  6. package/lib/transmission/from-document-to-hash/index.js +1 -1
  7. package/lib/transmission/from-hash-to-document/index.js +1 -1
  8. package/lib/transmission/index.js +1 -1
  9. package/lib/transmission/to-zashiki/index.js +1 -1
  10. package/lib/transmission/to-zashiki/transform-root-schema.js +1 -1
  11. package/lib/transmission/to-zashiki/transform-schema.js +1 -1
  12. package/package.json +23 -30
  13. package/src/transmission/from-document-to-hash/index.js +75 -29
  14. package/src/transmission/from-hash-to-document/index.js +13 -10
  15. package/src/transmission/to-zashiki/transform-root-schema.js +143 -136
  16. package/src/transmission/to-zashiki/transform-schema.js +3256 -1952
  17. package/.github/dependabot.yml +0 -9
  18. package/test/transmission/common/index.spec.js +0 -1348
  19. package/test/transmission/from-document-to-hash/index.spec.js +0 -1866
  20. package/test/transmission/from-hash-to-document/index.spec.js +0 -1523
  21. package/test/transmission/to-zashiki/transform-root-schema/transforming-array-type-schemas.spec.js +0 -1784
  22. package/test/transmission/to-zashiki/transform-root-schema/transforming-boolean-type-schemas.spec.js +0 -334
  23. package/test/transmission/to-zashiki/transform-root-schema/transforming-null-type-schemas.spec.js +0 -253
  24. package/test/transmission/to-zashiki/transform-root-schema/transforming-number-type-schemas.spec.js +0 -565
  25. package/test/transmission/to-zashiki/transform-root-schema/transforming-object-type-schemas.spec.js +0 -1715
  26. package/test/transmission/to-zashiki/transform-root-schema/transforming-string-type-schemas.spec.js +0 -496
  27. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-array-type-schemas.spec.js +0 -31633
  28. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-boolean-type-schemas.spec.js +0 -359
  29. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-null-type-schemas.spec.js +0 -359
  30. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-number-type-schemas.spec.js +0 -446
  31. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-object-type-schemas.spec.js +0 -8348
  32. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-string-type-schemas.spec.js +0 -446
  33. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-array-type-schemas.spec.js +0 -30373
  34. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-boolean-type-schemas.spec.js +0 -334
  35. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-null-type-schemas.spec.js +0 -253
  36. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-number-type-schemas.spec.js +0 -421
  37. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-object-type-schemas.spec.js +0 -7826
  38. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-string-type-schemas.spec.js +0 -421
  39. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-array-type-schemas.spec.js +0 -31111
  40. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-boolean-type-schemas.spec.js +0 -347
  41. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-null-type-schemas.spec.js +0 -344
  42. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-number-type-schemas.spec.js +0 -434
  43. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-object-type-schemas.spec.js +0 -8222
  44. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-string-type-schemas.spec.js +0 -434
  45. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-array-type-schemas.spec.js +0 -29494
  46. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-boolean-type-schemas.spec.js +0 -312
  47. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-null-type-schemas.spec.js +0 -309
  48. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-number-type-schemas.spec.js +0 -399
  49. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-object-type-schemas.spec.js +0 -7584
  50. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-string-type-schemas.spec.js +0 -398
  51. package/test/transmission/to-zashiki/transform-root-schema.spec.js +0 -22
  52. package/test/transmission/to-zashiki/transform-schema/transforming-array-type-schemas.spec.js +0 -1806
  53. package/test/transmission/to-zashiki/transform-schema/transforming-boolean-type-schemas.spec.js +0 -340
  54. package/test/transmission/to-zashiki/transform-schema/transforming-null-type-schemas.spec.js +0 -259
  55. package/test/transmission/to-zashiki/transform-schema/transforming-number-type-schemas.spec.js +0 -571
  56. package/test/transmission/to-zashiki/transform-schema/transforming-object-type-schemas.spec.js +0 -1737
  57. package/test/transmission/to-zashiki/transform-schema/transforming-string-type-schemas.spec.js +0 -502
  58. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-array-type-schemas.spec.js +0 -32173
  59. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-boolean-type-schemas.spec.js +0 -377
  60. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-null-type-schemas.spec.js +0 -377
  61. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-number-type-schemas.spec.js +0 -464
  62. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-object-type-schemas.spec.js +0 -8525
  63. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-string-type-schemas.spec.js +0 -464
  64. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-array-type-schemas.spec.js +0 -30910
  65. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-boolean-type-schemas.spec.js +0 -352
  66. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-null-type-schemas.spec.js +0 -271
  67. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-number-type-schemas.spec.js +0 -439
  68. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-object-type-schemas.spec.js +0 -8003
  69. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-string-type-schemas.spec.js +0 -439
  70. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-array-type-schemas.spec.js +0 -31654
  71. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-boolean-type-schemas.spec.js +0 -365
  72. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-null-type-schemas.spec.js +0 -362
  73. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-number-type-schemas.spec.js +0 -452
  74. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-object-type-schemas.spec.js +0 -8399
  75. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-string-type-schemas.spec.js +0 -452
  76. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-array-type-schemas.spec.js +0 -29671
  77. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-boolean-type-schemas.spec.js +0 -320
  78. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-null-type-schemas.spec.js +0 -317
  79. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-number-type-schemas.spec.js +0 -407
  80. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-object-type-schemas.spec.js +0 -7645
  81. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-string-type-schemas.spec.js +0 -406
  82. package/test/transmission/to-zashiki/transform-schema.spec.js +0 -777
@@ -1,1784 +0,0 @@
1
- import debug from 'debug'
2
-
3
- import { expect } from 'chai'
4
-
5
- import transform from 'shinkansen-transmission/transmission/to-zashiki/transform-root-schema'
6
-
7
- describe('shinkansen-transmission/transmission/to-zashiki/transform-root-schema', () => {
8
- before(() => {
9
- const {
10
- env: {
11
- DEBUG
12
- }
13
- } = process
14
-
15
- if (DEBUG) debug.enable(DEBUG)
16
- })
17
-
18
- /*
19
- * Array
20
- */
21
- describe('Transforming `array` type schemas', () => {
22
- it('transforms', () => {
23
- const schema = { type: 'array' }
24
-
25
- expect(transform(schema))
26
- .to.eql({
27
- meta: {
28
- type: 'array',
29
- uri: '#/',
30
- schema
31
- },
32
- elements: {
33
- fields: []
34
- }
35
- })
36
- })
37
-
38
- it('transforms with `enum`', () => {
39
- const schema = {
40
- type: 'array',
41
- enum: [
42
- [],
43
- [],
44
- []
45
- ],
46
- minItems: 1,
47
- maxItems: 9,
48
- uniqueItems: true,
49
- minContains: 1,
50
- maxContains: 9
51
- }
52
-
53
- expect(transform(schema))
54
- .to.eql({
55
- meta: {
56
- type: 'array',
57
- uri: '#/',
58
- schema,
59
- minItems: 1,
60
- maxItems: 9,
61
- hasUniqueItems: true,
62
- minContains: 1,
63
- maxContains: 9,
64
- items: [
65
- [],
66
- [],
67
- []
68
- ],
69
- selectedItems: []
70
- },
71
- elements: {
72
- enum: {
73
- id: '#/',
74
- minItems: 1,
75
- maxItems: 9,
76
- hasUniqueItems: true,
77
- minContains: 1,
78
- maxContains: 9,
79
- items: [
80
- [],
81
- [],
82
- []
83
- ],
84
- selectedItems: []
85
- }
86
- }
87
- })
88
- })
89
-
90
- it('transforms with `anyOf`', () => {
91
- const schema = {
92
- type: 'array',
93
- anyOf: [
94
- { const: [] },
95
- { const: [] },
96
- { const: [] }
97
- ]
98
- }
99
-
100
- expect(transform(schema))
101
- .to.eql({
102
- meta: {
103
- type: 'array',
104
- uri: '#/',
105
- schema,
106
- items: [
107
- {
108
- meta: {
109
- type: 'array',
110
- item: 0,
111
- parentUri: '#/',
112
- uri: '#/0',
113
- rootSchema: schema,
114
- schema: {
115
- const: []
116
- }
117
- },
118
- elements: {
119
- fields: []
120
- }
121
- },
122
- {
123
- meta: {
124
- type: 'array',
125
- item: 1,
126
- parentUri: '#/',
127
- uri: '#/1',
128
- rootSchema: schema,
129
- schema: {
130
- const: []
131
- }
132
- },
133
- elements: {
134
- fields: []
135
- }
136
- },
137
- {
138
- meta: {
139
- type: 'array',
140
- item: 2,
141
- parentUri: '#/',
142
- uri: '#/2',
143
- rootSchema: schema,
144
- schema: {
145
- const: []
146
- }
147
- },
148
- elements: {
149
- fields: []
150
- }
151
- }
152
- ],
153
- selectedItems: []
154
- },
155
- elements: {
156
- anyOf: {
157
- id: '#/',
158
- items: [
159
- {
160
- meta: {
161
- type: 'array',
162
- item: 0,
163
- parentUri: '#/',
164
- uri: '#/0',
165
- rootSchema: schema,
166
- schema: {
167
- const: []
168
- }
169
- },
170
- elements: {
171
- fields: []
172
- }
173
- },
174
- {
175
- meta: {
176
- type: 'array',
177
- item: 1,
178
- parentUri: '#/',
179
- uri: '#/1',
180
- rootSchema: schema,
181
- schema: {
182
- const: []
183
- }
184
- },
185
- elements: {
186
- fields: []
187
- }
188
- },
189
- {
190
- meta: {
191
- type: 'array',
192
- item: 2,
193
- parentUri: '#/',
194
- uri: '#/2',
195
- rootSchema: schema,
196
- schema: {
197
- const: []
198
- }
199
- },
200
- elements: {
201
- fields: []
202
- }
203
- }
204
- ],
205
- selectedItems: []
206
- }
207
- }
208
- })
209
- })
210
-
211
- it('transforms with `oneOf`', () => {
212
- const schema = {
213
- type: 'array',
214
- oneOf: [
215
- {
216
- const: [],
217
- minItems: 1,
218
- maxItems: 9,
219
- uniqueItems: true,
220
- minContains: 1,
221
- maxContains: 9
222
- },
223
- {
224
- const: [],
225
- minItems: 1,
226
- maxItems: 9,
227
- uniqueItems: true,
228
- minContains: 1,
229
- maxContains: 9
230
- },
231
- {
232
- const: [],
233
- minItems: 1,
234
- maxItems: 9,
235
- uniqueItems: true,
236
- minContains: 1,
237
- maxContains: 9
238
- }
239
- ]
240
- }
241
-
242
- expect(transform(schema))
243
- .to.eql({
244
- meta: {
245
- type: 'array',
246
- uri: '#/',
247
- schema,
248
- items: [
249
- {
250
- meta: {
251
- type: 'array',
252
- item: 0,
253
- parentUri: '#/',
254
- uri: '#/0',
255
- rootSchema: schema,
256
- schema: {
257
- const: [],
258
- minItems: 1,
259
- maxItems: 9,
260
- uniqueItems: true,
261
- minContains: 1,
262
- maxContains: 9
263
- },
264
- minItems: 1,
265
- maxItems: 9,
266
- hasUniqueItems: true,
267
- minContains: 1,
268
- maxContains: 9
269
- },
270
- elements: {
271
- fields: []
272
- }
273
- },
274
- {
275
- meta: {
276
- type: 'array',
277
- item: 1,
278
- parentUri: '#/',
279
- uri: '#/1',
280
- rootSchema: schema,
281
- schema: {
282
- const: [],
283
- minItems: 1,
284
- maxItems: 9,
285
- uniqueItems: true,
286
- minContains: 1,
287
- maxContains: 9
288
- },
289
- minItems: 1,
290
- maxItems: 9,
291
- hasUniqueItems: true,
292
- minContains: 1,
293
- maxContains: 9
294
- },
295
- elements: {
296
- fields: []
297
- }
298
- },
299
- {
300
- meta: {
301
- type: 'array',
302
- item: 2,
303
- parentUri: '#/',
304
- uri: '#/2',
305
- rootSchema: schema,
306
- schema: {
307
- const: [],
308
- minItems: 1,
309
- maxItems: 9,
310
- uniqueItems: true,
311
- minContains: 1,
312
- maxContains: 9
313
- },
314
- minItems: 1,
315
- maxItems: 9,
316
- hasUniqueItems: true,
317
- minContains: 1,
318
- maxContains: 9
319
- },
320
- elements: {
321
- fields: []
322
- }
323
- }
324
- ],
325
- selectedItems: []
326
- },
327
- elements: {
328
- oneOf: {
329
- id: '#/',
330
- items: [
331
- {
332
- meta: {
333
- type: 'array',
334
- item: 0,
335
- parentUri: '#/',
336
- uri: '#/0',
337
- rootSchema: schema,
338
- schema: {
339
- const: [],
340
- minItems: 1,
341
- maxItems: 9,
342
- uniqueItems: true,
343
- minContains: 1,
344
- maxContains: 9
345
- },
346
- minItems: 1,
347
- maxItems: 9,
348
- hasUniqueItems: true,
349
- minContains: 1,
350
- maxContains: 9
351
- },
352
- elements: {
353
- fields: []
354
- }
355
- },
356
- {
357
- meta: {
358
- type: 'array',
359
- item: 1,
360
- parentUri: '#/',
361
- uri: '#/1',
362
- rootSchema: schema,
363
- schema: {
364
- const: [],
365
- minItems: 1,
366
- maxItems: 9,
367
- uniqueItems: true,
368
- minContains: 1,
369
- maxContains: 9
370
- },
371
- minItems: 1,
372
- maxItems: 9,
373
- hasUniqueItems: true,
374
- minContains: 1,
375
- maxContains: 9
376
- },
377
- elements: {
378
- fields: []
379
- }
380
- },
381
- {
382
- meta: {
383
- type: 'array',
384
- item: 2,
385
- parentUri: '#/',
386
- uri: '#/2',
387
- rootSchema: schema,
388
- schema: {
389
- const: [],
390
- minItems: 1,
391
- maxItems: 9,
392
- uniqueItems: true,
393
- minContains: 1,
394
- maxContains: 9
395
- },
396
- minItems: 1,
397
- maxItems: 9,
398
- hasUniqueItems: true,
399
- minContains: 1,
400
- maxContains: 9
401
- },
402
- elements: {
403
- fields: []
404
- }
405
- }
406
- ],
407
- selectedItems: []
408
- }
409
- }
410
- })
411
- })
412
-
413
- it('transforms with `allOf`', () => {
414
- const schema = {
415
- type: 'array',
416
- allOf: [
417
- { const: [] },
418
- { minItems: 1 },
419
- { maxItems: 9 },
420
- { uniqueItems: true },
421
- { minContains: 1 },
422
- { maxContains: 9 }
423
- ]
424
- }
425
-
426
- expect(transform(schema))
427
- .to.eql({
428
- meta: {
429
- type: 'array',
430
- uri: '#/',
431
- schema,
432
- minItems: 1,
433
- maxItems: 9,
434
- hasUniqueItems: true,
435
- minContains: 1,
436
- maxContains: 9
437
- },
438
- elements: {
439
- field: {
440
- id: '#/',
441
- minItems: 1,
442
- maxItems: 9,
443
- hasUniqueItems: true,
444
- minContains: 1,
445
- maxContains: 9
446
- }
447
- }
448
- })
449
- })
450
-
451
- it('transforms without `enum` or `anyOf` or `oneOf` or `allOf`', () => {
452
- const schema = {
453
- type: 'array',
454
- const: [],
455
- minItems: 1,
456
- maxItems: 9,
457
- uniqueItems: true,
458
- minContains: 1,
459
- maxContains: 9
460
- }
461
-
462
- expect(transform(schema))
463
- .to.eql({
464
- meta: {
465
- type: 'array',
466
- uri: '#/',
467
- schema,
468
- minItems: 1,
469
- maxItems: 9,
470
- hasUniqueItems: true,
471
- minContains: 1,
472
- maxContains: 9
473
- },
474
- elements: {
475
- fields: []
476
- }
477
- })
478
- })
479
-
480
- it('transforms `array` type schemas with `enum` (with an `array` type with `enum`)', () => {
481
- const schema = {
482
- type: 'array',
483
- enum: [
484
- {
485
- type: 'array',
486
- enum: [
487
- {},
488
- {},
489
- {}
490
- ]
491
- }
492
- ]
493
- }
494
-
495
- expect(transform(schema))
496
- .to.eql({
497
- meta: {
498
- type: 'array',
499
- uri: '#/',
500
- schema,
501
- items: [
502
- {
503
- type: 'array',
504
- enum: [
505
- {},
506
- {},
507
- {}
508
- ]
509
- }
510
- ],
511
- selectedItems: []
512
- },
513
- elements: {
514
- enum: {
515
- id: '#/',
516
- items: [
517
- {
518
- type: 'array',
519
- enum: [
520
- {},
521
- {},
522
- {}
523
- ]
524
- }
525
- ],
526
- selectedItems: []
527
- }
528
- }
529
- })
530
- })
531
-
532
- it('transforms `array` type schemas with `enum` (with an `array` type with `anyOf`)', () => {
533
- const schema = {
534
- type: 'array',
535
- enum: [
536
- {
537
- type: 'array',
538
- anyOf: [
539
- {
540
- type: 'array'
541
- }
542
- ]
543
- }
544
- ]
545
- }
546
-
547
- expect(transform(schema))
548
- .to.eql({
549
- meta: {
550
- type: 'array',
551
- uri: '#/',
552
- schema,
553
- items: [
554
- {
555
- type: 'array',
556
- anyOf: [
557
- {
558
- type: 'array'
559
- }
560
- ]
561
- }
562
- ],
563
- selectedItems: []
564
- },
565
- elements: {
566
- enum: {
567
- id: '#/',
568
- items: [
569
- {
570
- type: 'array',
571
- anyOf: [
572
- {
573
- type: 'array'
574
- }
575
- ]
576
- }
577
- ],
578
- selectedItems: []
579
- }
580
- }
581
- })
582
- })
583
-
584
- it('transforms `array` type schemas with `enum` (with an `array` type with `oneOf`)', () => {
585
- const schema = {
586
- type: 'array',
587
- enum: [
588
- {
589
- type: 'array',
590
- oneOf: [
591
- {
592
- type: 'array'
593
- }
594
- ]
595
- }
596
- ]
597
- }
598
-
599
- expect(transform(schema))
600
- .to.eql({
601
- meta: {
602
- type: 'array',
603
- uri: '#/',
604
- schema,
605
- items: [
606
- {
607
- type: 'array',
608
- oneOf: [
609
- {
610
- type: 'array'
611
- }
612
- ]
613
- }
614
- ],
615
- selectedItems: []
616
- },
617
- elements: {
618
- enum: {
619
- id: '#/',
620
- items: [
621
- {
622
- type: 'array',
623
- oneOf: [
624
- {
625
- type: 'array'
626
- }
627
- ]
628
- }
629
- ],
630
- selectedItems: []
631
- }
632
- }
633
- })
634
- })
635
-
636
- it('transforms `array` type schemas with `enum` (with an `array` type with `allOf`)', () => {
637
- const schema = {
638
- type: 'array',
639
- enum: [
640
- {
641
- type: 'array',
642
- allOf: [
643
- {
644
- type: 'array'
645
- }
646
- ]
647
- }
648
- ]
649
- }
650
-
651
- expect(transform(schema))
652
- .to.eql({
653
- meta: {
654
- type: 'array',
655
- uri: '#/',
656
- schema,
657
- items: [
658
- {
659
- type: 'array',
660
- allOf: [
661
- {
662
- type: 'array'
663
- }
664
- ]
665
- }
666
- ],
667
- selectedItems: []
668
- },
669
- elements: {
670
- enum: {
671
- id: '#/',
672
- items: [
673
- {
674
- type: 'array',
675
- allOf: [
676
- {
677
- type: 'array'
678
- }
679
- ]
680
- }
681
- ],
682
- selectedItems: []
683
- }
684
- }
685
- })
686
- })
687
-
688
- it('transforms `array` type schemas with `anyOf` (with an `array` type with `enum`)', () => {
689
- const schema = {
690
- type: 'array',
691
- anyOf: [
692
- {
693
- type: 'array',
694
- enum: [
695
- {},
696
- {},
697
- {}
698
- ]
699
- }
700
- ]
701
- }
702
-
703
- expect(transform(schema))
704
- .to.eql({
705
- meta: {
706
- type: 'array',
707
- uri: '#/',
708
- schema,
709
- items: [
710
- {
711
- meta: {
712
- type: 'array',
713
- item: 0,
714
- parentUri: '#/',
715
- uri: '#/0',
716
- rootSchema: schema,
717
- schema: {
718
- type: 'array',
719
- enum: [
720
- {},
721
- {},
722
- {}
723
- ]
724
- },
725
- items: [
726
- {},
727
- {},
728
- {}
729
- ],
730
- selectedItems: []
731
- },
732
- elements: {
733
- enum: {
734
- id: '#/0',
735
- items: [
736
- {},
737
- {},
738
- {}
739
- ],
740
- selectedItems: []
741
- }
742
- }
743
- }
744
- ],
745
- selectedItems: []
746
- },
747
- elements: {
748
- anyOf: {
749
- id: '#/',
750
- items: [
751
- {
752
- meta: {
753
- type: 'array',
754
- item: 0,
755
- parentUri: '#/',
756
- uri: '#/0',
757
- rootSchema: schema,
758
- schema: {
759
- type: 'array',
760
- enum: [
761
- {},
762
- {},
763
- {}
764
- ]
765
- },
766
- items: [
767
- {},
768
- {},
769
- {}
770
- ],
771
- selectedItems: []
772
- },
773
- elements: {
774
- enum: {
775
- id: '#/0',
776
- items: [
777
- {},
778
- {},
779
- {}
780
- ],
781
- selectedItems: []
782
- }
783
- }
784
- }
785
- ],
786
- selectedItems: []
787
- }
788
- }
789
- })
790
- })
791
-
792
- it('transforms `array` type schemas with `anyOf` (with an `array` type with `anyOf`)', () => {
793
- const schema = {
794
- type: 'array',
795
- anyOf: [
796
- {
797
- type: 'array',
798
- anyOf: [
799
- {
800
- type: 'array'
801
- }
802
- ]
803
- }
804
- ]
805
- }
806
-
807
- expect(transform(schema))
808
- .to.eql({
809
- meta: {
810
- type: 'array',
811
- uri: '#/',
812
- schema,
813
- items: [
814
- {
815
- meta: {
816
- type: 'array',
817
- item: 0,
818
- parentUri: '#/',
819
- uri: '#/0',
820
- rootSchema: schema,
821
- schema: {
822
- type: 'array',
823
- anyOf: [
824
- {
825
- type: 'array'
826
- }
827
- ]
828
- },
829
- items: [
830
- {
831
- meta: {
832
- type: 'array',
833
- item: 0,
834
- parentUri: '#/0',
835
- uri: '#/0/0',
836
- rootSchema: schema,
837
- schema: {
838
- type: 'array'
839
- }
840
- },
841
- elements: {
842
- fields: []
843
- }
844
- }
845
- ],
846
- selectedItems: []
847
- },
848
- elements: {
849
- anyOf: {
850
- id: '#/0',
851
- items: [
852
- {
853
- meta: {
854
- type: 'array',
855
- item: 0,
856
- parentUri: '#/0',
857
- uri: '#/0/0',
858
- rootSchema: schema,
859
- schema: {
860
- type: 'array'
861
- }
862
- },
863
- elements: {
864
- fields: []
865
- }
866
- }
867
- ],
868
- selectedItems: []
869
- }
870
- }
871
- }
872
- ],
873
- selectedItems: []
874
- },
875
- elements: {
876
- anyOf: {
877
- id: '#/',
878
- items: [
879
- {
880
- meta: {
881
- type: 'array',
882
- item: 0,
883
- parentUri: '#/',
884
- uri: '#/0',
885
- rootSchema: schema,
886
- schema: {
887
- type: 'array',
888
- anyOf: [
889
- {
890
- type: 'array'
891
- }
892
- ]
893
- },
894
- items: [
895
- {
896
- meta: {
897
- type: 'array',
898
- item: 0,
899
- parentUri: '#/0',
900
- uri: '#/0/0',
901
- rootSchema: schema,
902
- schema: {
903
- type: 'array'
904
- }
905
- },
906
- elements: {
907
- fields: []
908
- }
909
- }
910
- ],
911
- selectedItems: []
912
- },
913
- elements: {
914
- anyOf: {
915
- id: '#/0',
916
- items: [
917
- {
918
- meta: {
919
- type: 'array',
920
- item: 0,
921
- parentUri: '#/0',
922
- uri: '#/0/0',
923
- rootSchema: schema,
924
- schema: {
925
- type: 'array'
926
- }
927
- },
928
- elements: {
929
- fields: []
930
- }
931
- }
932
- ],
933
- selectedItems: []
934
- }
935
- }
936
- }
937
- ],
938
- selectedItems: []
939
- }
940
- }
941
- })
942
- })
943
-
944
- it('transforms `array` type schemas with `anyOf` (with an `array` type with `oneOf`)', () => {
945
- const schema = {
946
- type: 'array',
947
- anyOf: [
948
- {
949
- type: 'array',
950
- oneOf: [
951
- {
952
- type: 'array'
953
- }
954
- ]
955
- }
956
- ]
957
- }
958
-
959
- expect(transform(schema))
960
- .to.eql({
961
- meta: {
962
- type: 'array',
963
- uri: '#/',
964
- schema,
965
- items: [
966
- {
967
- meta: {
968
- type: 'array',
969
- item: 0,
970
- parentUri: '#/',
971
- uri: '#/0',
972
- rootSchema: schema,
973
- schema: {
974
- type: 'array',
975
- oneOf: [
976
- {
977
- type: 'array'
978
- }
979
- ]
980
- },
981
- items: [
982
- {
983
- meta: {
984
- type: 'array',
985
- item: 0,
986
- parentUri: '#/0',
987
- uri: '#/0/0',
988
- rootSchema: schema,
989
- schema: {
990
- type: 'array'
991
- }
992
- },
993
- elements: {
994
- fields: []
995
- }
996
- }
997
- ],
998
- selectedItems: []
999
- },
1000
- elements: {
1001
- oneOf: {
1002
- id: '#/0',
1003
- items: [
1004
- {
1005
- meta: {
1006
- type: 'array',
1007
- item: 0,
1008
- parentUri: '#/0',
1009
- uri: '#/0/0',
1010
- rootSchema: schema,
1011
- schema: {
1012
- type: 'array'
1013
- }
1014
- },
1015
- elements: {
1016
- fields: []
1017
- }
1018
- }
1019
- ],
1020
- selectedItems: []
1021
- }
1022
- }
1023
- }
1024
- ],
1025
- selectedItems: []
1026
- },
1027
- elements: {
1028
- anyOf: {
1029
- id: '#/',
1030
- items: [
1031
- {
1032
- meta: {
1033
- type: 'array',
1034
- item: 0,
1035
- parentUri: '#/',
1036
- uri: '#/0',
1037
- rootSchema: schema,
1038
- schema: {
1039
- type: 'array',
1040
- oneOf: [
1041
- {
1042
- type: 'array'
1043
- }
1044
- ]
1045
- },
1046
- items: [
1047
- {
1048
- meta: {
1049
- type: 'array',
1050
- item: 0,
1051
- parentUri: '#/0',
1052
- uri: '#/0/0',
1053
- rootSchema: schema,
1054
- schema: {
1055
- type: 'array'
1056
- }
1057
- },
1058
- elements: {
1059
- fields: []
1060
- }
1061
- }
1062
- ],
1063
- selectedItems: []
1064
- },
1065
- elements: {
1066
- oneOf: {
1067
- id: '#/0',
1068
- items: [
1069
- {
1070
- meta: {
1071
- type: 'array',
1072
- item: 0,
1073
- parentUri: '#/0',
1074
- uri: '#/0/0',
1075
- rootSchema: schema,
1076
- schema: {
1077
- type: 'array'
1078
- }
1079
- },
1080
- elements: {
1081
- fields: []
1082
- }
1083
- }
1084
- ],
1085
- selectedItems: []
1086
- }
1087
- }
1088
- }
1089
- ],
1090
- selectedItems: []
1091
- }
1092
- }
1093
- })
1094
- })
1095
-
1096
- it('transforms `array` type schemas with `anyOf` (with an `array` type with `allOf`)', () => {
1097
- const schema = {
1098
- type: 'array',
1099
- anyOf: [
1100
- {
1101
- type: 'array',
1102
- allOf: [
1103
- {
1104
- type: 'array'
1105
- }
1106
- ]
1107
- }
1108
- ]
1109
- }
1110
-
1111
- expect(transform(schema))
1112
- .to.eql({
1113
- meta: {
1114
- type: 'array',
1115
- uri: '#/',
1116
- schema,
1117
- items: [
1118
- {
1119
- meta: {
1120
- type: 'array',
1121
- item: 0,
1122
- parentUri: '#/',
1123
- uri: '#/0',
1124
- rootSchema: schema,
1125
- schema: {
1126
- type: 'array',
1127
- allOf: [
1128
- {
1129
- type: 'array'
1130
- }
1131
- ]
1132
- }
1133
- },
1134
- elements: {
1135
- field: {
1136
- id: '#/0'
1137
- }
1138
- }
1139
- }
1140
- ],
1141
- selectedItems: []
1142
- },
1143
- elements: {
1144
- anyOf: {
1145
- id: '#/',
1146
- items: [
1147
- {
1148
- meta: {
1149
- type: 'array',
1150
- item: 0,
1151
- parentUri: '#/',
1152
- uri: '#/0',
1153
- rootSchema: schema,
1154
- schema: {
1155
- type: 'array',
1156
- allOf: [
1157
- {
1158
- type: 'array'
1159
- }
1160
- ]
1161
- }
1162
- },
1163
- elements: {
1164
- field: {
1165
- id: '#/0'
1166
- }
1167
- }
1168
- }
1169
- ],
1170
- selectedItems: []
1171
- }
1172
- }
1173
- })
1174
- })
1175
-
1176
- it('transforms `array` type schemas with `oneOf` (with an `array` type with `enum`)', () => {
1177
- const schema = {
1178
- type: 'array',
1179
- oneOf: [
1180
- {
1181
- type: 'array',
1182
- enum: [
1183
- {},
1184
- {},
1185
- {}
1186
- ]
1187
- }
1188
- ]
1189
- }
1190
-
1191
- expect(transform(schema))
1192
- .to.eql({
1193
- meta: {
1194
- type: 'array',
1195
- uri: '#/',
1196
- schema,
1197
- items: [
1198
- {
1199
- meta: {
1200
- type: 'array',
1201
- item: 0,
1202
- parentUri: '#/',
1203
- uri: '#/0',
1204
- rootSchema: schema,
1205
- schema: {
1206
- type: 'array',
1207
- enum: [
1208
- {},
1209
- {},
1210
- {}
1211
- ]
1212
- },
1213
- items: [
1214
- {},
1215
- {},
1216
- {}
1217
- ],
1218
- selectedItems: []
1219
- },
1220
- elements: {
1221
- enum: {
1222
- id: '#/0',
1223
- items: [
1224
- {},
1225
- {},
1226
- {}
1227
- ],
1228
- selectedItems: []
1229
- }
1230
- }
1231
- }
1232
- ],
1233
- selectedItems: []
1234
- },
1235
- elements: {
1236
- oneOf: {
1237
- id: '#/',
1238
- items: [
1239
- {
1240
- meta: {
1241
- type: 'array',
1242
- item: 0,
1243
- parentUri: '#/',
1244
- uri: '#/0',
1245
- rootSchema: schema,
1246
- schema: {
1247
- type: 'array',
1248
- enum: [
1249
- {},
1250
- {},
1251
- {}
1252
- ]
1253
- },
1254
- items: [
1255
- {},
1256
- {},
1257
- {}
1258
- ],
1259
- selectedItems: []
1260
- },
1261
- elements: {
1262
- enum: {
1263
- id: '#/0',
1264
- items: [
1265
- {},
1266
- {},
1267
- {}
1268
- ],
1269
- selectedItems: []
1270
- }
1271
- }
1272
- }
1273
- ],
1274
- selectedItems: []
1275
- }
1276
- }
1277
- })
1278
- })
1279
-
1280
- it('transforms `array` type schemas with `oneOf` (with an `array` type with `anyOf`)', () => {
1281
- const schema = {
1282
- type: 'array',
1283
- oneOf: [
1284
- {
1285
- type: 'array',
1286
- anyOf: [
1287
- {
1288
- type: 'array'
1289
- }
1290
- ]
1291
- }
1292
- ]
1293
- }
1294
-
1295
- expect(transform(schema))
1296
- .to.eql({
1297
- meta: {
1298
- type: 'array',
1299
- uri: '#/',
1300
- schema,
1301
- items: [
1302
- {
1303
- meta: {
1304
- type: 'array',
1305
- item: 0,
1306
- parentUri: '#/',
1307
- uri: '#/0',
1308
- rootSchema: schema,
1309
- schema: {
1310
- type: 'array',
1311
- anyOf: [
1312
- {
1313
- type: 'array'
1314
- }
1315
- ]
1316
- },
1317
- items: [
1318
- {
1319
- meta: {
1320
- type: 'array',
1321
- item: 0,
1322
- parentUri: '#/0',
1323
- uri: '#/0/0',
1324
- rootSchema: schema,
1325
- schema: {
1326
- type: 'array'
1327
- }
1328
- },
1329
- elements: {
1330
- fields: []
1331
- }
1332
- }
1333
- ],
1334
- selectedItems: []
1335
- },
1336
- elements: {
1337
- anyOf: {
1338
- id: '#/0',
1339
- items: [
1340
- {
1341
- meta: {
1342
- type: 'array',
1343
- item: 0,
1344
- parentUri: '#/0',
1345
- uri: '#/0/0',
1346
- rootSchema: schema,
1347
- schema: {
1348
- type: 'array'
1349
- }
1350
- },
1351
- elements: {
1352
- fields: []
1353
- }
1354
- }
1355
- ],
1356
- selectedItems: []
1357
- }
1358
- }
1359
- }
1360
- ],
1361
- selectedItems: []
1362
- },
1363
- elements: {
1364
- oneOf: {
1365
- id: '#/',
1366
- items: [
1367
- {
1368
- meta: {
1369
- type: 'array',
1370
- item: 0,
1371
- parentUri: '#/',
1372
- uri: '#/0',
1373
- rootSchema: schema,
1374
- schema: {
1375
- type: 'array',
1376
- anyOf: [
1377
- {
1378
- type: 'array'
1379
- }
1380
- ]
1381
- },
1382
- items: [
1383
- {
1384
- meta: {
1385
- type: 'array',
1386
- item: 0,
1387
- parentUri: '#/0',
1388
- uri: '#/0/0',
1389
- rootSchema: schema,
1390
- schema: {
1391
- type: 'array'
1392
- }
1393
- },
1394
- elements: {
1395
- fields: []
1396
- }
1397
- }
1398
- ],
1399
- selectedItems: []
1400
- },
1401
- elements: {
1402
- anyOf: {
1403
- id: '#/0',
1404
- items: [
1405
- {
1406
- meta: {
1407
- type: 'array',
1408
- item: 0,
1409
- parentUri: '#/0',
1410
- uri: '#/0/0',
1411
- rootSchema: schema,
1412
- schema: {
1413
- type: 'array'
1414
- }
1415
- },
1416
- elements: {
1417
- fields: []
1418
- }
1419
- }
1420
- ],
1421
- selectedItems: []
1422
- }
1423
- }
1424
- }
1425
- ],
1426
- selectedItems: []
1427
- }
1428
- }
1429
- })
1430
- })
1431
-
1432
- it('transforms `array` type schemas with `oneOf` (with an `array` type with `oneOf`)', () => {
1433
- const schema = {
1434
- type: 'array',
1435
- oneOf: [
1436
- {
1437
- type: 'array',
1438
- oneOf: [
1439
- {
1440
- type: 'array'
1441
- }
1442
- ]
1443
- }
1444
- ]
1445
- }
1446
-
1447
- expect(transform(schema))
1448
- .to.eql({
1449
- meta: {
1450
- type: 'array',
1451
- uri: '#/',
1452
- schema,
1453
- items: [
1454
- {
1455
- meta: {
1456
- type: 'array',
1457
- item: 0,
1458
- parentUri: '#/',
1459
- uri: '#/0',
1460
- rootSchema: schema,
1461
- schema: {
1462
- type: 'array',
1463
- oneOf: [
1464
- {
1465
- type: 'array'
1466
- }
1467
- ]
1468
- },
1469
- items: [
1470
- {
1471
- meta: {
1472
- type: 'array',
1473
- item: 0,
1474
- parentUri: '#/0',
1475
- uri: '#/0/0',
1476
- rootSchema: schema,
1477
- schema: {
1478
- type: 'array'
1479
- }
1480
- },
1481
- elements: {
1482
- fields: []
1483
- }
1484
- }
1485
- ],
1486
- selectedItems: []
1487
- },
1488
- elements: {
1489
- oneOf: {
1490
- id: '#/0',
1491
- items: [
1492
- {
1493
- meta: {
1494
- type: 'array',
1495
- item: 0,
1496
- parentUri: '#/0',
1497
- uri: '#/0/0',
1498
- rootSchema: schema,
1499
- schema: {
1500
- type: 'array'
1501
- }
1502
- },
1503
- elements: {
1504
- fields: []
1505
- }
1506
- }
1507
- ],
1508
- selectedItems: []
1509
- }
1510
- }
1511
- }
1512
- ],
1513
- selectedItems: []
1514
- },
1515
- elements: {
1516
- oneOf: {
1517
- id: '#/',
1518
- items: [
1519
- {
1520
- meta: {
1521
- type: 'array',
1522
- item: 0,
1523
- parentUri: '#/',
1524
- uri: '#/0',
1525
- rootSchema: schema,
1526
- schema: {
1527
- type: 'array',
1528
- oneOf: [
1529
- {
1530
- type: 'array'
1531
- }
1532
- ]
1533
- },
1534
- items: [
1535
- {
1536
- meta: {
1537
- type: 'array',
1538
- item: 0,
1539
- parentUri: '#/0',
1540
- uri: '#/0/0',
1541
- rootSchema: schema,
1542
- schema: {
1543
- type: 'array'
1544
- }
1545
- },
1546
- elements: {
1547
- fields: []
1548
- }
1549
- }
1550
- ],
1551
- selectedItems: []
1552
- },
1553
- elements: {
1554
- oneOf: {
1555
- id: '#/0',
1556
- items: [
1557
- {
1558
- meta: {
1559
- type: 'array',
1560
- item: 0,
1561
- parentUri: '#/0',
1562
- uri: '#/0/0',
1563
- rootSchema: schema,
1564
- schema: {
1565
- type: 'array'
1566
- }
1567
- },
1568
- elements: {
1569
- fields: []
1570
- }
1571
- }
1572
- ],
1573
- selectedItems: []
1574
- }
1575
- }
1576
- }
1577
- ],
1578
- selectedItems: []
1579
- }
1580
- }
1581
- })
1582
- })
1583
-
1584
- it('transforms `array` type schemas with `oneOf` (with an `array` type with `allOf`)', () => {
1585
- const schema = {
1586
- type: 'array',
1587
- oneOf: [
1588
- {
1589
- type: 'array',
1590
- allOf: [
1591
- {
1592
- type: 'array'
1593
- }
1594
- ]
1595
- }
1596
- ]
1597
- }
1598
-
1599
- expect(transform(schema))
1600
- .to.eql({
1601
- meta: {
1602
- type: 'array',
1603
- uri: '#/',
1604
- schema,
1605
- items: [
1606
- {
1607
- meta: {
1608
- type: 'array',
1609
- item: 0,
1610
- parentUri: '#/',
1611
- uri: '#/0',
1612
- rootSchema: schema,
1613
- schema: {
1614
- type: 'array',
1615
- allOf: [
1616
- {
1617
- type: 'array'
1618
- }
1619
- ]
1620
- }
1621
- },
1622
- elements: {
1623
- field: {
1624
- id: '#/0'
1625
- }
1626
- }
1627
- }
1628
- ],
1629
- selectedItems: []
1630
- },
1631
- elements: {
1632
- oneOf: {
1633
- id: '#/',
1634
- items: [
1635
- {
1636
- meta: {
1637
- type: 'array',
1638
- item: 0,
1639
- parentUri: '#/',
1640
- uri: '#/0',
1641
- rootSchema: schema,
1642
- schema: {
1643
- type: 'array',
1644
- allOf: [
1645
- {
1646
- type: 'array'
1647
- }
1648
- ]
1649
- }
1650
- },
1651
- elements: {
1652
- field: {
1653
- id: '#/0'
1654
- }
1655
- }
1656
- }
1657
- ],
1658
- selectedItems: []
1659
- }
1660
- }
1661
- })
1662
- })
1663
-
1664
- it('transforms `array` type schemas with `allOf` (with an `array` type with `enum`)', () => {
1665
- const schema = {
1666
- type: 'array',
1667
- allOf: [
1668
- {
1669
- type: 'array',
1670
- enum: [
1671
- {},
1672
- {},
1673
- {}
1674
- ]
1675
- }
1676
- ]
1677
- }
1678
-
1679
- expect(transform(schema))
1680
- .to.eql({
1681
- meta: {
1682
- type: 'array',
1683
- uri: '#/',
1684
- schema
1685
- },
1686
- elements: {
1687
- field: {
1688
- id: '#/'
1689
- }
1690
- }
1691
- })
1692
- })
1693
-
1694
- it('transforms `array` type schemas with `allOf` (with an `array` type with `anyOf`)', () => {
1695
- const schema = {
1696
- type: 'array',
1697
- allOf: [
1698
- {
1699
- type: 'array',
1700
- anyOf: [
1701
- {
1702
- type: 'array'
1703
- }
1704
- ]
1705
- }
1706
- ]
1707
- }
1708
-
1709
- expect(transform(schema))
1710
- .to.eql({
1711
- meta: {
1712
- type: 'array',
1713
- uri: '#/',
1714
- schema
1715
- },
1716
- elements: {
1717
- field: {
1718
- id: '#/'
1719
- }
1720
- }
1721
- })
1722
- })
1723
-
1724
- it('transforms `array` type schemas with `allOf` (with an `array` type with `oneOf`)', () => {
1725
- const schema = {
1726
- type: 'array',
1727
- allOf: [
1728
- {
1729
- type: 'array',
1730
- oneOf: [
1731
- {
1732
- type: 'array'
1733
- }
1734
- ]
1735
- }
1736
- ]
1737
- }
1738
-
1739
- expect(transform(schema))
1740
- .to.eql({
1741
- meta: {
1742
- type: 'array',
1743
- uri: '#/',
1744
- schema
1745
- },
1746
- elements: {
1747
- field: {
1748
- id: '#/'
1749
- }
1750
- }
1751
- })
1752
- })
1753
-
1754
- it('transforms `array` type schemas with `allOf` (with an `array` type with `allOf`)', () => {
1755
- const schema = {
1756
- type: 'array',
1757
- allOf: [
1758
- {
1759
- type: 'array',
1760
- allOf: [
1761
- {
1762
- type: 'array'
1763
- }
1764
- ]
1765
- }
1766
- ]
1767
- }
1768
-
1769
- expect(transform(schema))
1770
- .to.eql({
1771
- meta: {
1772
- type: 'array',
1773
- uri: '#/',
1774
- schema
1775
- },
1776
- elements: {
1777
- field: {
1778
- id: '#/'
1779
- }
1780
- }
1781
- })
1782
- })
1783
- })
1784
- })