@pdtf/schemas 3.0.3-1 → 3.0.3-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.
@@ -1453,110 +1453,97 @@
1453
1453
  "otherItems": {
1454
1454
  "itemName": {},
1455
1455
  "isIncludedOrExcluded": {},
1456
- "comments": {},
1457
1456
  "price": {}
1458
1457
  }
1459
1458
  },
1460
1459
  "kitchen": {
1461
1460
  "hob": {
1462
1461
  "isIncludedExcludedOrNone": {},
1462
+ "comments": {},
1463
1463
  "fittedOrFreestanding": {
1464
- "isFittedOrFreestanding": {},
1465
- "comments": {}
1464
+ "fittedOrFreestanding": {}
1466
1465
  },
1467
- "price": {},
1468
- "comments": {}
1466
+ "price": {}
1469
1467
  },
1470
1468
  "extractorHood": {
1471
1469
  "isIncludedExcludedOrNone": {},
1470
+ "comments": {},
1472
1471
  "fittedOrFreestanding": {
1473
- "isFittedOrFreestanding": {},
1474
- "comments": {}
1472
+ "fittedOrFreestanding": {}
1475
1473
  },
1476
- "price": {},
1477
- "comments": {}
1474
+ "price": {}
1478
1475
  },
1479
1476
  "ovenGrill": {
1480
1477
  "isIncludedExcludedOrNone": {},
1478
+ "comments": {},
1481
1479
  "fittedOrFreestanding": {
1482
- "isFittedOrFreestanding": {},
1483
- "comments": {}
1480
+ "fittedOrFreestanding": {}
1484
1481
  },
1485
- "price": {},
1486
- "comments": {}
1482
+ "price": {}
1487
1483
  },
1488
1484
  "cooker": {
1489
1485
  "isIncludedExcludedOrNone": {},
1486
+ "comments": {},
1490
1487
  "fittedOrFreestanding": {
1491
- "isFittedOrFreestanding": {},
1492
- "comments": {}
1488
+ "fittedOrFreestanding": {}
1493
1489
  },
1494
- "price": {},
1495
- "comments": {}
1490
+ "price": {}
1496
1491
  },
1497
1492
  "microwave": {
1498
1493
  "isIncludedExcludedOrNone": {},
1494
+ "comments": {},
1499
1495
  "fittedOrFreestanding": {
1500
- "isFittedOrFreestanding": {},
1501
- "comments": {}
1496
+ "fittedOrFreestanding": {}
1502
1497
  },
1503
- "price": {},
1504
- "comments": {}
1498
+ "price": {}
1505
1499
  },
1506
1500
  "refrigeratorFridgeFreezer": {
1507
1501
  "isIncludedExcludedOrNone": {},
1502
+ "comments": {},
1508
1503
  "fittedOrFreestanding": {
1509
- "isFittedOrFreestanding": {},
1510
- "comments": {}
1504
+ "fittedOrFreestanding": {}
1511
1505
  },
1512
- "price": {},
1513
- "comments": {}
1506
+ "price": {}
1514
1507
  },
1515
1508
  "freezer": {
1516
1509
  "isIncludedExcludedOrNone": {},
1510
+ "comments": {},
1517
1511
  "fittedOrFreestanding": {
1518
- "isFittedOrFreestanding": {},
1519
- "comments": {}
1512
+ "fittedOrFreestanding": {}
1520
1513
  },
1521
- "price": {},
1522
- "comments": {}
1514
+ "price": {}
1523
1515
  },
1524
1516
  "dishwasher": {
1525
1517
  "isIncludedExcludedOrNone": {},
1518
+ "comments": {},
1526
1519
  "fittedOrFreestanding": {
1527
- "isFittedOrFreestanding": {},
1528
- "comments": {}
1520
+ "fittedOrFreestanding": {}
1529
1521
  },
1530
- "price": {},
1531
- "comments": {}
1522
+ "price": {}
1532
1523
  },
1533
1524
  "tumbleDryer": {
1534
1525
  "isIncludedExcludedOrNone": {},
1526
+ "comments": {},
1535
1527
  "fittedOrFreestanding": {
1536
- "isFittedOrFreestanding": {},
1537
- "comments": {}
1528
+ "fittedOrFreestanding": {}
1538
1529
  },
1539
- "price": {},
1540
- "comments": {}
1530
+ "price": {}
1541
1531
  },
1542
1532
  "washingMachine": {
1543
1533
  "isIncludedExcludedOrNone": {},
1534
+ "comments": {},
1544
1535
  "fittedOrFreestanding": {
1545
- "isFittedOrFreestanding": {},
1546
- "comments": {}
1536
+ "fittedOrFreestanding": {}
1547
1537
  },
1548
- "price": {},
1549
- "comments": {}
1538
+ "price": {}
1550
1539
  },
1551
1540
  "otherItems": {
1552
1541
  "itemName": {},
1553
1542
  "isIncludedOrExcluded": {},
1554
1543
  "fittedOrFreestanding": {
1555
- "isFittedOrFreestanding": {},
1556
- "comments": {}
1544
+ "fittedOrFreestanding": {}
1557
1545
  },
1558
- "price": {},
1559
- "comments": {}
1546
+ "price": {}
1560
1547
  }
1561
1548
  },
1562
1549
  "bathroom": {
@@ -1650,7 +1637,6 @@
1650
1637
  "otherRooms": {
1651
1638
  "itemName": {},
1652
1639
  "isIncludedOrExcluded": {},
1653
- "comments": {},
1654
1640
  "price": {}
1655
1641
  }
1656
1642
  },
@@ -1694,7 +1680,6 @@
1694
1680
  "otherRooms": {
1695
1681
  "itemName": {},
1696
1682
  "isIncludedOrExcluded": {},
1697
- "comments": {},
1698
1683
  "price": {}
1699
1684
  }
1700
1685
  },
@@ -1737,7 +1722,6 @@
1737
1722
  "otherRooms": {
1738
1723
  "itemName": {},
1739
1724
  "isIncludedOrExcluded": {},
1740
- "comments": {},
1741
1725
  "price": {}
1742
1726
  }
1743
1727
  }
@@ -1781,7 +1765,6 @@
1781
1765
  "otherRooms": {
1782
1766
  "itemName": {},
1783
1767
  "isIncludedOrExcluded": {},
1784
- "comments": {},
1785
1768
  "price": {}
1786
1769
  }
1787
1770
  },
@@ -1824,7 +1807,6 @@
1824
1807
  "otherRooms": {
1825
1808
  "itemName": {},
1826
1809
  "isIncludedOrExcluded": {},
1827
- "comments": {},
1828
1810
  "price": {}
1829
1811
  }
1830
1812
  },
@@ -1892,7 +1874,6 @@
1892
1874
  "otherItems": {
1893
1875
  "itemName": {},
1894
1876
  "isIncludedOrExcluded": {},
1895
- "comments": {},
1896
1877
  "price": {}
1897
1878
  }
1898
1879
  },
@@ -1939,7 +1920,6 @@
1939
1920
  "otherItems": {
1940
1921
  "itemName": {},
1941
1922
  "isIncludedOrExcluded": {},
1942
- "comments": {},
1943
1923
  "price": {}
1944
1924
  }
1945
1925
  },
@@ -3332,7 +3312,7 @@
3332
3312
  "yesNo": {},
3333
3313
  "details": {}
3334
3314
  },
3335
- "lheLocalAuthorityReceivedANoticeOfDisposal": {
3315
+ "theLocalAuthorityReceivedANoticeOfDisposal": {
3336
3316
  "yesNo": {},
3337
3317
  "details": {}
3338
3318
  },
@@ -57,43 +57,60 @@ const extractOverlay = (sourceSchema, ref) => {
57
57
  if (path === "/") path = "";
58
58
  if (element[refName]) {
59
59
  jp.set(returnSchema, `${path}/${refName}`, element[refName]);
60
- overlayIncludeProperties.forEach((property) => {
61
- if (element[property]) {
62
- jp.set(returnSchema, `${path}/${property}`, element[property]);
63
- }
64
- });
65
-
66
- const { discriminator } = element;
67
- if (discriminator) {
68
- const { propertyName } = discriminator;
69
- element.oneOf.forEach((item, index) => {
70
- const discriminatorProperty = item.properties[propertyName];
71
- // copy const discriminator as-is
72
- if (discriminatorProperty.const) {
60
+
61
+ if (element.discriminator) {
62
+ jp.set(returnSchema, `${path}/discriminator`, element.discriminator);
63
+ const { propertyName } = element.discriminator;
64
+ element.oneOf.forEach((oneOf, index) => {
65
+ const discriminatorProperty = oneOf.properties[propertyName];
66
+ // must be an enum
67
+ const discriminatorEnumPath = `${path}/oneOf/${index}/properties/${propertyName}/enum`;
68
+ // if a refEnum use that
69
+ const refEnum = `${ref}Enum`;
70
+ if (discriminatorProperty[refEnum]) {
73
71
  jp.set(
74
72
  returnSchema,
75
- `${path}/oneOf/${index}/properties/${propertyName}/const`,
76
- discriminatorProperty.const
73
+ discriminatorEnumPath,
74
+ discriminatorProperty[refEnum]
77
75
  );
78
76
  } else {
79
- // must be an enum
80
- const discriminatorEnumPath = `${path}/oneOf/${index}/properties/${propertyName}/enum`;
81
- // if a refEnum use that
82
- const refEnum = `${ref}Enum`;
83
- if (discriminatorProperty[refEnum]) {
84
- jp.set(
85
- returnSchema,
86
- discriminatorEnumPath,
87
- discriminatorProperty[refEnum]
88
- );
89
- } else {
90
- // use the base enum
91
- jp.set(
92
- returnSchema,
93
- discriminatorEnumPath,
94
- discriminatorProperty.enum
95
- );
96
- }
77
+ // use the base enum
78
+ jp.set(
79
+ returnSchema,
80
+ discriminatorEnumPath,
81
+ discriminatorProperty.enum
82
+ );
83
+ }
84
+ });
85
+ }
86
+
87
+ // also handle discriminator properties nested in items
88
+ if (element.items?.discriminator) {
89
+ jp.set(
90
+ returnSchema,
91
+ `${path}/items/discriminator`,
92
+ element.items.discriminator
93
+ );
94
+ const { propertyName } = element.items.discriminator;
95
+ element.items.oneOf.forEach((oneOf, index) => {
96
+ const discriminatorProperty = oneOf.properties[propertyName];
97
+ // must be an enum
98
+ const discriminatorEnumPath = `${path}/items/oneOf/${index}/properties/${propertyName}/enum`;
99
+ // if a refEnum use that
100
+ const refEnum = `${ref}Enum`;
101
+ if (discriminatorProperty[refEnum]) {
102
+ jp.set(
103
+ returnSchema,
104
+ discriminatorEnumPath,
105
+ discriminatorProperty[refEnum]
106
+ );
107
+ } else {
108
+ // use the base enum
109
+ jp.set(
110
+ returnSchema,
111
+ discriminatorEnumPath,
112
+ discriminatorProperty.enum
113
+ );
97
114
  }
98
115
  });
99
116
  }