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