@pdtf/schemas 3.0.1-3 → 3.0.1-5

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.
@@ -1447,110 +1447,97 @@
1447
1447
  "otherItems": {
1448
1448
  "itemName": {},
1449
1449
  "isIncludedOrExcluded": {},
1450
- "comments": {},
1451
1450
  "price": {}
1452
1451
  }
1453
1452
  },
1454
1453
  "kitchen": {
1455
1454
  "hob": {
1456
1455
  "isIncludedExcludedOrNone": {},
1456
+ "comments": {},
1457
1457
  "fittedOrFreestanding": {
1458
- "isFittedOrFreestanding": {},
1459
- "comments": {}
1458
+ "fittedOrFreestanding": {}
1460
1459
  },
1461
- "price": {},
1462
- "comments": {}
1460
+ "price": {}
1463
1461
  },
1464
1462
  "extractorHood": {
1465
1463
  "isIncludedExcludedOrNone": {},
1464
+ "comments": {},
1466
1465
  "fittedOrFreestanding": {
1467
- "isFittedOrFreestanding": {},
1468
- "comments": {}
1466
+ "fittedOrFreestanding": {}
1469
1467
  },
1470
- "price": {},
1471
- "comments": {}
1468
+ "price": {}
1472
1469
  },
1473
1470
  "ovenGrill": {
1474
1471
  "isIncludedExcludedOrNone": {},
1472
+ "comments": {},
1475
1473
  "fittedOrFreestanding": {
1476
- "isFittedOrFreestanding": {},
1477
- "comments": {}
1474
+ "fittedOrFreestanding": {}
1478
1475
  },
1479
- "price": {},
1480
- "comments": {}
1476
+ "price": {}
1481
1477
  },
1482
1478
  "cooker": {
1483
1479
  "isIncludedExcludedOrNone": {},
1480
+ "comments": {},
1484
1481
  "fittedOrFreestanding": {
1485
- "isFittedOrFreestanding": {},
1486
- "comments": {}
1482
+ "fittedOrFreestanding": {}
1487
1483
  },
1488
- "price": {},
1489
- "comments": {}
1484
+ "price": {}
1490
1485
  },
1491
1486
  "microwave": {
1492
1487
  "isIncludedExcludedOrNone": {},
1488
+ "comments": {},
1493
1489
  "fittedOrFreestanding": {
1494
- "isFittedOrFreestanding": {},
1495
- "comments": {}
1490
+ "fittedOrFreestanding": {}
1496
1491
  },
1497
- "price": {},
1498
- "comments": {}
1492
+ "price": {}
1499
1493
  },
1500
1494
  "refrigeratorFridgeFreezer": {
1501
1495
  "isIncludedExcludedOrNone": {},
1496
+ "comments": {},
1502
1497
  "fittedOrFreestanding": {
1503
- "isFittedOrFreestanding": {},
1504
- "comments": {}
1498
+ "fittedOrFreestanding": {}
1505
1499
  },
1506
- "price": {},
1507
- "comments": {}
1500
+ "price": {}
1508
1501
  },
1509
1502
  "freezer": {
1510
1503
  "isIncludedExcludedOrNone": {},
1504
+ "comments": {},
1511
1505
  "fittedOrFreestanding": {
1512
- "isFittedOrFreestanding": {},
1513
- "comments": {}
1506
+ "fittedOrFreestanding": {}
1514
1507
  },
1515
- "price": {},
1516
- "comments": {}
1508
+ "price": {}
1517
1509
  },
1518
1510
  "dishwasher": {
1519
1511
  "isIncludedExcludedOrNone": {},
1512
+ "comments": {},
1520
1513
  "fittedOrFreestanding": {
1521
- "isFittedOrFreestanding": {},
1522
- "comments": {}
1514
+ "fittedOrFreestanding": {}
1523
1515
  },
1524
- "price": {},
1525
- "comments": {}
1516
+ "price": {}
1526
1517
  },
1527
1518
  "tumbleDryer": {
1528
1519
  "isIncludedExcludedOrNone": {},
1520
+ "comments": {},
1529
1521
  "fittedOrFreestanding": {
1530
- "isFittedOrFreestanding": {},
1531
- "comments": {}
1522
+ "fittedOrFreestanding": {}
1532
1523
  },
1533
- "price": {},
1534
- "comments": {}
1524
+ "price": {}
1535
1525
  },
1536
1526
  "washingMachine": {
1537
1527
  "isIncludedExcludedOrNone": {},
1528
+ "comments": {},
1538
1529
  "fittedOrFreestanding": {
1539
- "isFittedOrFreestanding": {},
1540
- "comments": {}
1530
+ "fittedOrFreestanding": {}
1541
1531
  },
1542
- "price": {},
1543
- "comments": {}
1532
+ "price": {}
1544
1533
  },
1545
1534
  "otherItems": {
1546
1535
  "itemName": {},
1547
1536
  "isIncludedOrExcluded": {},
1548
1537
  "fittedOrFreestanding": {
1549
- "isFittedOrFreestanding": {},
1550
- "comments": {}
1538
+ "fittedOrFreestanding": {}
1551
1539
  },
1552
- "price": {},
1553
- "comments": {}
1540
+ "price": {}
1554
1541
  }
1555
1542
  },
1556
1543
  "bathroom": {
@@ -1644,7 +1631,6 @@
1644
1631
  "otherRooms": {
1645
1632
  "itemName": {},
1646
1633
  "isIncludedOrExcluded": {},
1647
- "comments": {},
1648
1634
  "price": {}
1649
1635
  }
1650
1636
  },
@@ -1688,7 +1674,6 @@
1688
1674
  "otherRooms": {
1689
1675
  "itemName": {},
1690
1676
  "isIncludedOrExcluded": {},
1691
- "comments": {},
1692
1677
  "price": {}
1693
1678
  }
1694
1679
  },
@@ -1731,7 +1716,6 @@
1731
1716
  "otherRooms": {
1732
1717
  "itemName": {},
1733
1718
  "isIncludedOrExcluded": {},
1734
- "comments": {},
1735
1719
  "price": {}
1736
1720
  }
1737
1721
  }
@@ -1775,7 +1759,6 @@
1775
1759
  "otherRooms": {
1776
1760
  "itemName": {},
1777
1761
  "isIncludedOrExcluded": {},
1778
- "comments": {},
1779
1762
  "price": {}
1780
1763
  }
1781
1764
  },
@@ -1818,7 +1801,6 @@
1818
1801
  "otherRooms": {
1819
1802
  "itemName": {},
1820
1803
  "isIncludedOrExcluded": {},
1821
- "comments": {},
1822
1804
  "price": {}
1823
1805
  }
1824
1806
  },
@@ -1886,7 +1868,6 @@
1886
1868
  "otherItems": {
1887
1869
  "itemName": {},
1888
1870
  "isIncludedOrExcluded": {},
1889
- "comments": {},
1890
1871
  "price": {}
1891
1872
  }
1892
1873
  },
@@ -1933,7 +1914,6 @@
1933
1914
  "otherItems": {
1934
1915
  "itemName": {},
1935
1916
  "isIncludedOrExcluded": {},
1936
- "comments": {},
1937
1917
  "price": {}
1938
1918
  }
1939
1919
  },
@@ -64,51 +64,60 @@ const extractOverlay = (sourceSchema, ref) => {
64
64
  if (path === "/") path = "";
65
65
  if (element[refName]) {
66
66
  jp.set(returnSchema, `${path}/${refName}`, element[refName]);
67
- overlayIncludeProperties.forEach((property) => {
68
- if (element[property]) {
69
- jp.set(returnSchema, `${path}/${property}`, element[property]);
70
- }
71
- // also handle properties nested in items
72
- if (element.items?.[property]) {
73
- jp.set(
74
- returnSchema,
75
- `${path}/items/${property}`,
76
- element.items[property]
77
- );
78
- }
79
- });
80
-
81
- const { discriminator } = element;
82
- if (discriminator) {
83
- const { propertyName } = discriminator;
84
- element.oneOf.forEach((item, index) => {
85
- const discriminatorProperty = item.properties[propertyName];
86
- // copy const discriminator as-is
87
- if (discriminatorProperty.const) {
67
+
68
+ if (element.discriminator) {
69
+ jp.set(returnSchema, `${path}/discriminator`, element.discriminator);
70
+ const { propertyName } = element.discriminator;
71
+ element.oneOf.forEach((oneOf, index) => {
72
+ const discriminatorProperty = oneOf.properties[propertyName];
73
+ // must be an enum
74
+ const discriminatorEnumPath = `${path}/oneOf/${index}/properties/${propertyName}/enum`;
75
+ // if a refEnum use that
76
+ const refEnum = `${ref}Enum`;
77
+ if (discriminatorProperty[refEnum]) {
88
78
  jp.set(
89
79
  returnSchema,
90
- `${path}/oneOf/${index}/properties/${propertyName}/const`,
91
- discriminatorProperty.const
80
+ discriminatorEnumPath,
81
+ discriminatorProperty[refEnum]
92
82
  );
93
83
  } else {
94
- // must be an enum
95
- const discriminatorEnumPath = `${path}/oneOf/${index}/properties/${propertyName}/enum`;
96
- // if a refEnum use that
97
- const refEnum = `${ref}Enum`;
98
- if (discriminatorProperty[refEnum]) {
99
- jp.set(
100
- returnSchema,
101
- discriminatorEnumPath,
102
- discriminatorProperty[refEnum]
103
- );
104
- } else {
105
- // use the base enum
106
- jp.set(
107
- returnSchema,
108
- discriminatorEnumPath,
109
- discriminatorProperty.enum
110
- );
111
- }
84
+ // use the base enum
85
+ jp.set(
86
+ returnSchema,
87
+ discriminatorEnumPath,
88
+ discriminatorProperty.enum
89
+ );
90
+ }
91
+ });
92
+ }
93
+
94
+ // also handle discriminator properties nested in items
95
+ if (element.items?.discriminator) {
96
+ jp.set(
97
+ returnSchema,
98
+ `${path}/items/discriminator`,
99
+ element.items.discriminator
100
+ );
101
+ const { propertyName } = element.items.discriminator;
102
+ element.items.oneOf.forEach((oneOf, index) => {
103
+ const discriminatorProperty = oneOf.properties[propertyName];
104
+ // must be an enum
105
+ const discriminatorEnumPath = `${path}/items/oneOf/${index}/properties/${propertyName}/enum`;
106
+ // if a refEnum use that
107
+ const refEnum = `${ref}Enum`;
108
+ if (discriminatorProperty[refEnum]) {
109
+ jp.set(
110
+ returnSchema,
111
+ discriminatorEnumPath,
112
+ discriminatorProperty[refEnum]
113
+ );
114
+ } else {
115
+ // use the base enum
116
+ jp.set(
117
+ returnSchema,
118
+ discriminatorEnumPath,
119
+ discriminatorProperty.enum
120
+ );
112
121
  }
113
122
  });
114
123
  }