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