@pdtf/schemas 3.5.1-6 → 3.5.1-8
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.
- package/index.js +16 -9
- package/package.json +1 -1
- package/src/schemas/v3/combined.json +38 -8
- package/src/schemas/v3/compactSkeleton.txt +3 -0
- package/src/schemas/v3/overlays/ta10.json +12 -0
- package/src/schemas/v3/overlays/ta6.json +7 -11
- package/src/schemas/v3/overlays/ta7.json +5 -6
- package/src/schemas/v3/pdtf-transaction.json +26 -0
- package/src/schemas/v3/skeleton.json +3 -0
- package/src/tests/v3/transactionSchema.test.js +22 -0
package/index.js
CHANGED
|
@@ -104,7 +104,7 @@ const transactionSchemas = {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
// Custom array merge function for oneOf arrays
|
|
107
|
-
const arrayMerge = (target, source) => {
|
|
107
|
+
const arrayMerge = (target, source, options) => {
|
|
108
108
|
// For string arrays (enum, required, etc.)
|
|
109
109
|
if (
|
|
110
110
|
target.length > 0 &&
|
|
@@ -114,16 +114,23 @@ const arrayMerge = (target, source) => {
|
|
|
114
114
|
source[0] &&
|
|
115
115
|
typeof source[0] === "string"
|
|
116
116
|
) {
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
|
|
117
|
+
// Detect if this is a required array by checking the parent key
|
|
118
|
+
// Required arrays are property names (camelCase, no spaces)
|
|
119
|
+
// Enum arrays are values (can contain spaces, capitals, etc.)
|
|
120
|
+
const isRequiredArray = target.every(
|
|
120
121
|
(item) =>
|
|
121
122
|
typeof item === "string" &&
|
|
122
123
|
item.length > 0 &&
|
|
123
|
-
|
|
124
|
-
!item.includes("
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
// Required field names are typically camelCase without spaces
|
|
125
|
+
!item.includes(" ") &&
|
|
126
|
+
// First character is usually lowercase for field names
|
|
127
|
+
(item[0] === item[0].toLowerCase() || item.startsWith("is") || item.startsWith("has"))
|
|
128
|
+
) && source.every(
|
|
129
|
+
(item) =>
|
|
130
|
+
typeof item === "string" &&
|
|
131
|
+
item.length > 0 &&
|
|
132
|
+
!item.includes(" ") &&
|
|
133
|
+
(item[0] === item[0].toLowerCase() || item.startsWith("is") || item.startsWith("has"))
|
|
127
134
|
);
|
|
128
135
|
|
|
129
136
|
if (isRequiredArray) {
|
|
@@ -137,7 +144,7 @@ const arrayMerge = (target, source) => {
|
|
|
137
144
|
return combined;
|
|
138
145
|
}
|
|
139
146
|
|
|
140
|
-
// For other string arrays (like enum),
|
|
147
|
+
// For other string arrays (like enum), replace with source
|
|
141
148
|
return source.length > 0 ? source : target;
|
|
142
149
|
}
|
|
143
150
|
|
package/package.json
CHANGED
|
@@ -1815,7 +1815,6 @@
|
|
|
1815
1815
|
"baspi4Ref": "A1.3.0.2",
|
|
1816
1816
|
"baspi5Ref": "A1.3.0.2",
|
|
1817
1817
|
"rdsRef": "Tenure/Tenure",
|
|
1818
|
-
"ta7Ref": "1.1",
|
|
1819
1818
|
"piqRef": "A1.2",
|
|
1820
1819
|
"title": "What type of ownership is the property?",
|
|
1821
1820
|
"description": "A Managed Freehold is any freehold where there are shared amenities, the maintenance of which you pay for through an estate rentcharge, service charge, informal or formal contribution. Choose Leasehold if your property is under a Shared Ownership arrangement.",
|
|
@@ -4228,6 +4227,7 @@
|
|
|
4228
4227
|
"leaseRestrictions"
|
|
4229
4228
|
],
|
|
4230
4229
|
"ta7Required": [
|
|
4230
|
+
"typeOfLeasehold",
|
|
4231
4231
|
"sharedOwnership",
|
|
4232
4232
|
"leaseTerm",
|
|
4233
4233
|
"contactDetails",
|
|
@@ -4244,6 +4244,17 @@
|
|
|
4244
4244
|
"confirmationOfAccuracy"
|
|
4245
4245
|
],
|
|
4246
4246
|
"properties": {
|
|
4247
|
+
"typeOfLeasehold": {
|
|
4248
|
+
"ta7Ref": "1.1",
|
|
4249
|
+
"title": "What type of leasehold property does the seller own?",
|
|
4250
|
+
"description": "'Flat'includes maisonette and apartment.",
|
|
4251
|
+
"type": "string",
|
|
4252
|
+
"enum": [
|
|
4253
|
+
"Flat",
|
|
4254
|
+
"Shared ownership",
|
|
4255
|
+
"Long leasehold house"
|
|
4256
|
+
]
|
|
4257
|
+
},
|
|
4247
4258
|
"sharedOwnership": {
|
|
4248
4259
|
"baspi4Ref": "A1.3.1",
|
|
4249
4260
|
"baspi5Ref": "A1.3.1",
|
|
@@ -9577,7 +9588,6 @@
|
|
|
9577
9588
|
"ntsl2Ref": "C2.1.1.2",
|
|
9578
9589
|
"baspi4Ref": "A1.7.1.2",
|
|
9579
9590
|
"baspi5Ref": "A1.7.1.2",
|
|
9580
|
-
"ta6Ref": "4.7a2",
|
|
9581
9591
|
"title": "Please provide details of the listing",
|
|
9582
9592
|
"type": "string",
|
|
9583
9593
|
"minLength": 1
|
|
@@ -9585,7 +9595,7 @@
|
|
|
9585
9595
|
"attachments": {
|
|
9586
9596
|
"baspi4Ref": "A1.7.1.3",
|
|
9587
9597
|
"baspi5Ref": "A1.7.1.3",
|
|
9588
|
-
"ta6Ref": "4.
|
|
9598
|
+
"ta6Ref": "4.7a2",
|
|
9589
9599
|
"title": "Attachments",
|
|
9590
9600
|
"type": "string",
|
|
9591
9601
|
"enum": ["Attached", "To follow"]
|
|
@@ -9597,7 +9607,7 @@
|
|
|
9597
9607
|
"ntsl2Required": ["details"],
|
|
9598
9608
|
"baspi4Required": ["details", "attachments"],
|
|
9599
9609
|
"baspi5Required": ["details", "attachments"],
|
|
9600
|
-
"ta6Required": ["
|
|
9610
|
+
"ta6Required": ["attachments"]
|
|
9601
9611
|
}
|
|
9602
9612
|
]
|
|
9603
9613
|
},
|
|
@@ -9662,7 +9672,6 @@
|
|
|
9662
9672
|
"ntsl2Ref": "C2.1.2.2",
|
|
9663
9673
|
"baspi4Ref": "A1.7.2.2",
|
|
9664
9674
|
"baspi5Ref": "A1.7.2.2",
|
|
9665
|
-
"ta6Ref": "4.7b2",
|
|
9666
9675
|
"title": "Please provide details of the listing",
|
|
9667
9676
|
"type": "string",
|
|
9668
9677
|
"minLength": 1
|
|
@@ -9670,7 +9679,7 @@
|
|
|
9670
9679
|
"attachments": {
|
|
9671
9680
|
"baspi4Ref": "A1.7.2.3",
|
|
9672
9681
|
"baspi5Ref": "A1.7.2.3",
|
|
9673
|
-
"ta6Ref": "4.
|
|
9682
|
+
"ta6Ref": "4.7b2",
|
|
9674
9683
|
"title": "Attachments",
|
|
9675
9684
|
"type": "string",
|
|
9676
9685
|
"enum": ["Attached", "To follow"]
|
|
@@ -9682,7 +9691,7 @@
|
|
|
9682
9691
|
"ntsl2Required": ["details"],
|
|
9683
9692
|
"baspi4Required": ["details", "attachments"],
|
|
9684
9693
|
"baspi5Required": ["details", "attachments"],
|
|
9685
|
-
"ta6Required": ["
|
|
9694
|
+
"ta6Required": ["attachments"]
|
|
9686
9695
|
}
|
|
9687
9696
|
]
|
|
9688
9697
|
},
|
|
@@ -15819,6 +15828,11 @@
|
|
|
15819
15828
|
"properties": {
|
|
15820
15829
|
"isIncludedOrExcluded": {
|
|
15821
15830
|
"enum": ["Included"]
|
|
15831
|
+
},
|
|
15832
|
+
"comments": {
|
|
15833
|
+
"ta10Ref": "4.8c",
|
|
15834
|
+
"title": "Comments",
|
|
15835
|
+
"type": "string"
|
|
15822
15836
|
}
|
|
15823
15837
|
}
|
|
15824
15838
|
},
|
|
@@ -15831,6 +15845,11 @@
|
|
|
15831
15845
|
"ta10Ref": "4.8b",
|
|
15832
15846
|
"title": "Price",
|
|
15833
15847
|
"type": "number"
|
|
15848
|
+
},
|
|
15849
|
+
"comments": {
|
|
15850
|
+
"ta10Ref": "4.8c",
|
|
15851
|
+
"title": "Comments",
|
|
15852
|
+
"type": "string"
|
|
15834
15853
|
}
|
|
15835
15854
|
}
|
|
15836
15855
|
}
|
|
@@ -16561,6 +16580,11 @@
|
|
|
16561
16580
|
"properties": {
|
|
16562
16581
|
"isIncludedOrExcluded": {
|
|
16563
16582
|
"enum": ["Included"]
|
|
16583
|
+
},
|
|
16584
|
+
"comments": {
|
|
16585
|
+
"ta10Ref": "5.19c",
|
|
16586
|
+
"title": "Comments",
|
|
16587
|
+
"type": "string"
|
|
16564
16588
|
}
|
|
16565
16589
|
}
|
|
16566
16590
|
},
|
|
@@ -16573,6 +16597,11 @@
|
|
|
16573
16597
|
"ta10Ref": "5.19b",
|
|
16574
16598
|
"title": "Price",
|
|
16575
16599
|
"type": "number"
|
|
16600
|
+
},
|
|
16601
|
+
"comments": {
|
|
16602
|
+
"ta10Ref": "5.19c",
|
|
16603
|
+
"title": "Comments",
|
|
16604
|
+
"type": "string"
|
|
16576
16605
|
}
|
|
16577
16606
|
}
|
|
16578
16607
|
}
|
|
@@ -18516,7 +18545,8 @@
|
|
|
18516
18545
|
"ntsEnum": ["Yes", "No"],
|
|
18517
18546
|
"nts2Enum": ["Yes", "No"],
|
|
18518
18547
|
"ntslEnum": ["Yes", "No"],
|
|
18519
|
-
"ntsl2Enum": ["Yes", "No"]
|
|
18548
|
+
"ntsl2Enum": ["Yes", "No"],
|
|
18549
|
+
"ta6Enum": ["Yes", "No"]
|
|
18520
18550
|
}
|
|
18521
18551
|
},
|
|
18522
18552
|
"baspi4Required": ["yesNo"],
|
|
@@ -423,6 +423,7 @@
|
|
|
423
423
|
response
|
|
424
424
|
capacity
|
|
425
425
|
leaseholdInformation
|
|
426
|
+
typeOfLeasehold
|
|
426
427
|
sharedOwnership
|
|
427
428
|
isSharedOwnership
|
|
428
429
|
sharedOwnershipPercentage
|
|
@@ -1374,6 +1375,7 @@
|
|
|
1374
1375
|
otherRooms[
|
|
1375
1376
|
itemName
|
|
1376
1377
|
isIncludedOrExcluded
|
|
1378
|
+
comments
|
|
1377
1379
|
price
|
|
1378
1380
|
]
|
|
1379
1381
|
curtainsAndCurtainRails
|
|
@@ -1444,6 +1446,7 @@
|
|
|
1444
1446
|
otherRooms[
|
|
1445
1447
|
itemName
|
|
1446
1448
|
isIncludedOrExcluded
|
|
1449
|
+
comments
|
|
1447
1450
|
price
|
|
1448
1451
|
]
|
|
1449
1452
|
lightFittings
|
|
@@ -2266,6 +2266,9 @@
|
|
|
2266
2266
|
"enum": [
|
|
2267
2267
|
"Included"
|
|
2268
2268
|
]
|
|
2269
|
+
},
|
|
2270
|
+
"comments": {
|
|
2271
|
+
"ta10Ref": "4.8c"
|
|
2269
2272
|
}
|
|
2270
2273
|
}
|
|
2271
2274
|
},
|
|
@@ -2278,6 +2281,9 @@
|
|
|
2278
2281
|
},
|
|
2279
2282
|
"price": {
|
|
2280
2283
|
"ta10Ref": "4.8b"
|
|
2284
|
+
},
|
|
2285
|
+
"comments": {
|
|
2286
|
+
"ta10Ref": "4.8c"
|
|
2281
2287
|
}
|
|
2282
2288
|
}
|
|
2283
2289
|
}
|
|
@@ -2967,6 +2973,9 @@
|
|
|
2967
2973
|
"enum": [
|
|
2968
2974
|
"Included"
|
|
2969
2975
|
]
|
|
2976
|
+
},
|
|
2977
|
+
"comments": {
|
|
2978
|
+
"ta10Ref": "5.19c"
|
|
2970
2979
|
}
|
|
2971
2980
|
}
|
|
2972
2981
|
},
|
|
@@ -2979,6 +2988,9 @@
|
|
|
2979
2988
|
},
|
|
2980
2989
|
"price": {
|
|
2981
2990
|
"ta10Ref": "5.19b"
|
|
2991
|
+
},
|
|
2992
|
+
"comments": {
|
|
2993
|
+
"ta10Ref": "5.19c"
|
|
2982
2994
|
}
|
|
2983
2995
|
}
|
|
2984
2996
|
}
|
|
@@ -135,15 +135,11 @@
|
|
|
135
135
|
"Yes"
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
|
-
"details": {
|
|
139
|
-
"ta6Ref": "4.7a2"
|
|
140
|
-
},
|
|
141
138
|
"attachments": {
|
|
142
|
-
"ta6Ref": "4.
|
|
139
|
+
"ta6Ref": "4.7a2"
|
|
143
140
|
}
|
|
144
141
|
},
|
|
145
142
|
"required": [
|
|
146
|
-
"details",
|
|
147
143
|
"attachments"
|
|
148
144
|
]
|
|
149
145
|
}
|
|
@@ -180,15 +176,11 @@
|
|
|
180
176
|
"Yes"
|
|
181
177
|
]
|
|
182
178
|
},
|
|
183
|
-
"details": {
|
|
184
|
-
"ta6Ref": "4.7b2"
|
|
185
|
-
},
|
|
186
179
|
"attachments": {
|
|
187
|
-
"ta6Ref": "4.
|
|
180
|
+
"ta6Ref": "4.7b2"
|
|
188
181
|
}
|
|
189
182
|
},
|
|
190
183
|
"required": [
|
|
191
|
-
"details",
|
|
192
184
|
"attachments"
|
|
193
185
|
]
|
|
194
186
|
}
|
|
@@ -1661,7 +1653,11 @@
|
|
|
1661
1653
|
],
|
|
1662
1654
|
"properties": {
|
|
1663
1655
|
"yesNo": {
|
|
1664
|
-
"ta6Ref": "4.6"
|
|
1656
|
+
"ta6Ref": "4.6",
|
|
1657
|
+
"enum": [
|
|
1658
|
+
"Yes",
|
|
1659
|
+
"No"
|
|
1660
|
+
]
|
|
1665
1661
|
}
|
|
1666
1662
|
}
|
|
1667
1663
|
}
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"leaseholdInformation": {
|
|
70
70
|
"required": [
|
|
71
|
+
"typeOfLeasehold",
|
|
71
72
|
"sharedOwnership",
|
|
72
73
|
"leaseTerm",
|
|
73
74
|
"contactDetails",
|
|
@@ -84,6 +85,9 @@
|
|
|
84
85
|
"confirmationOfAccuracy"
|
|
85
86
|
],
|
|
86
87
|
"properties": {
|
|
88
|
+
"typeOfLeasehold": {
|
|
89
|
+
"ta7Ref": "1.1"
|
|
90
|
+
},
|
|
87
91
|
"sharedOwnership": {
|
|
88
92
|
"required": [
|
|
89
93
|
"isSharedOwnership"
|
|
@@ -1398,12 +1402,7 @@
|
|
|
1398
1402
|
"ta7Ref": "1",
|
|
1399
1403
|
"required": [
|
|
1400
1404
|
"ownershipType"
|
|
1401
|
-
]
|
|
1402
|
-
"properties": {
|
|
1403
|
-
"ownershipType": {
|
|
1404
|
-
"ta7Ref": "1.1"
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1405
|
+
]
|
|
1407
1406
|
}
|
|
1408
1407
|
}
|
|
1409
1408
|
}
|
|
@@ -3516,6 +3516,16 @@
|
|
|
3516
3516
|
"title": "Leasehold information",
|
|
3517
3517
|
"type": "object",
|
|
3518
3518
|
"properties": {
|
|
3519
|
+
"typeOfLeasehold": {
|
|
3520
|
+
"title": "What type of leasehold property does the seller own?",
|
|
3521
|
+
"description": "'Flat'includes maisonette and apartment.",
|
|
3522
|
+
"type": "string",
|
|
3523
|
+
"enum": [
|
|
3524
|
+
"Flat",
|
|
3525
|
+
"Shared ownership",
|
|
3526
|
+
"Long leasehold house"
|
|
3527
|
+
]
|
|
3528
|
+
},
|
|
3519
3529
|
"sharedOwnership": {
|
|
3520
3530
|
"type": "object",
|
|
3521
3531
|
"properties": {
|
|
@@ -12992,6 +13002,10 @@
|
|
|
12992
13002
|
"enum": [
|
|
12993
13003
|
"Included"
|
|
12994
13004
|
]
|
|
13005
|
+
},
|
|
13006
|
+
"comments": {
|
|
13007
|
+
"title": "Comments",
|
|
13008
|
+
"type": "string"
|
|
12995
13009
|
}
|
|
12996
13010
|
}
|
|
12997
13011
|
},
|
|
@@ -13005,6 +13019,10 @@
|
|
|
13005
13019
|
"price": {
|
|
13006
13020
|
"title": "Price",
|
|
13007
13021
|
"type": "number"
|
|
13022
|
+
},
|
|
13023
|
+
"comments": {
|
|
13024
|
+
"title": "Comments",
|
|
13025
|
+
"type": "string"
|
|
13008
13026
|
}
|
|
13009
13027
|
}
|
|
13010
13028
|
}
|
|
@@ -13722,6 +13740,10 @@
|
|
|
13722
13740
|
"enum": [
|
|
13723
13741
|
"Included"
|
|
13724
13742
|
]
|
|
13743
|
+
},
|
|
13744
|
+
"comments": {
|
|
13745
|
+
"title": "Comments",
|
|
13746
|
+
"type": "string"
|
|
13725
13747
|
}
|
|
13726
13748
|
}
|
|
13727
13749
|
},
|
|
@@ -13735,6 +13757,10 @@
|
|
|
13735
13757
|
"price": {
|
|
13736
13758
|
"title": "Price",
|
|
13737
13759
|
"type": "number"
|
|
13760
|
+
},
|
|
13761
|
+
"comments": {
|
|
13762
|
+
"title": "Comments",
|
|
13763
|
+
"type": "string"
|
|
13738
13764
|
}
|
|
13739
13765
|
}
|
|
13740
13766
|
}
|
|
@@ -538,6 +538,7 @@
|
|
|
538
538
|
}
|
|
539
539
|
},
|
|
540
540
|
"leaseholdInformation": {
|
|
541
|
+
"typeOfLeasehold": "string",
|
|
541
542
|
"sharedOwnership": {
|
|
542
543
|
"isSharedOwnership": "variant",
|
|
543
544
|
"sharedOwnershipPercentage": "number",
|
|
@@ -1743,6 +1744,7 @@
|
|
|
1743
1744
|
{
|
|
1744
1745
|
"itemName": "string",
|
|
1745
1746
|
"isIncludedOrExcluded": "variant",
|
|
1747
|
+
"comments": "string",
|
|
1746
1748
|
"price": "number"
|
|
1747
1749
|
}
|
|
1748
1750
|
]
|
|
@@ -1833,6 +1835,7 @@
|
|
|
1833
1835
|
{
|
|
1834
1836
|
"itemName": "string",
|
|
1835
1837
|
"isIncludedOrExcluded": "variant",
|
|
1838
|
+
"comments": "string",
|
|
1836
1839
|
"price": "number"
|
|
1837
1840
|
}
|
|
1838
1841
|
]
|
|
@@ -591,3 +591,25 @@ test("waterAndDrainage state with mainsFoulDrainage No missing offMainsDrainageS
|
|
|
591
591
|
);
|
|
592
592
|
expect(relevantError).toBeDefined();
|
|
593
593
|
});
|
|
594
|
+
|
|
595
|
+
test("TA7 overlay organisesBuildingInsurance enum has exactly three items", () => {
|
|
596
|
+
const schema = getTransactionSchema(schemaId, ["ta7ed3"]);
|
|
597
|
+
|
|
598
|
+
// Navigate to the organisesBuildingInsurance property in the merged schema
|
|
599
|
+
const organisesBuildingInsurance =
|
|
600
|
+
schema.properties?.propertyPack?.properties?.ownership?.properties
|
|
601
|
+
?.ownershipsToBeTransferred?.items?.oneOf?.[2]?.properties
|
|
602
|
+
?.leaseholdInformation?.properties?.contactDetails?.properties
|
|
603
|
+
?.serviceContactAssignments?.properties?.organisesBuildingInsurance;
|
|
604
|
+
|
|
605
|
+
expect(organisesBuildingInsurance).toBeDefined();
|
|
606
|
+
expect(organisesBuildingInsurance.enum).toBeDefined();
|
|
607
|
+
|
|
608
|
+
// The TA7 overlay defines exactly 3 enum values, which should replace the base schema's 6 values
|
|
609
|
+
expect(organisesBuildingInsurance.enum).toHaveLength(3);
|
|
610
|
+
expect(organisesBuildingInsurance.enum).toEqual([
|
|
611
|
+
"the Lessees",
|
|
612
|
+
"Management Company",
|
|
613
|
+
"Landlord",
|
|
614
|
+
]);
|
|
615
|
+
});
|