@pdtf/schemas 0.5.8 → 0.5.11
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 +46 -1
- package/package.json +1 -1
- package/src/schemas/baspi-a-material-facts.json +102 -76
- package/src/schemas/baspi-b-legal-information.json +25 -11
- package/src/schemas/property-pack.json +57 -45
- package/src/schemas/title-deed.json +8 -2
- package/src/tests/examplePropertyPack.json +11 -7
- package/src/tests/propertyPackSchema.test.js +65 -1
package/index.js
CHANGED
|
@@ -39,7 +39,7 @@ const getSubschema = (path) => {
|
|
|
39
39
|
return schema;
|
|
40
40
|
}
|
|
41
41
|
return pathArray.reduce((propertyPackSchema, pathElement) => {
|
|
42
|
-
return propertyPackSchema
|
|
42
|
+
return propertyPackSchema.properties[pathElement];
|
|
43
43
|
}, propertyPackSchema);
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -47,11 +47,56 @@ const getSubschemaValidator = (path) => {
|
|
|
47
47
|
return ajv.getSchema(path) || ajv.compile(getSubschema(path));
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
const getTitleAtPath = (schema, path, rootPath = path) => {
|
|
51
|
+
if (path === "") path = "/";
|
|
52
|
+
let pathArray = path.split("/").slice(1);
|
|
53
|
+
if (pathArray.length === 1 && pathArray[0] === "") {
|
|
54
|
+
if (schema.title) return schema.title;
|
|
55
|
+
if (schema.title === "") return ""; // deliberately blank
|
|
56
|
+
// no 'title' property present, so we use the property name to create a readable descriptor
|
|
57
|
+
const propertyName = rootPath
|
|
58
|
+
.split("/")
|
|
59
|
+
.pop()
|
|
60
|
+
.replace(/([A-Z])/g, " $1")
|
|
61
|
+
.toLowerCase()
|
|
62
|
+
.trim();
|
|
63
|
+
return propertyName.charAt(0).toUpperCase() + propertyName.slice(1);
|
|
64
|
+
}
|
|
65
|
+
const propertyName = pathArray.shift();
|
|
66
|
+
const subPath = "/" + pathArray.join("/");
|
|
67
|
+
let subSchema = schema.properties
|
|
68
|
+
? schema.properties[propertyName]
|
|
69
|
+
: undefined;
|
|
70
|
+
if (subSchema) {
|
|
71
|
+
return getTitleAtPath(subSchema, subPath, rootPath);
|
|
72
|
+
}
|
|
73
|
+
if (schema.type === "array") {
|
|
74
|
+
subSchema = schema.items;
|
|
75
|
+
return getTitleAtPath(subSchema, subPath, rootPath);
|
|
76
|
+
}
|
|
77
|
+
const dependencies = schema.dependencies;
|
|
78
|
+
if (dependencies) {
|
|
79
|
+
// only single dependency discriminator, oneOf keyword is supported
|
|
80
|
+
const dependencyDiscriminator = Object.keys(dependencies)[0];
|
|
81
|
+
const oneOfs = dependencies[dependencyDiscriminator].oneOf;
|
|
82
|
+
const matchingOneOf = oneOfs.find(
|
|
83
|
+
(oneOf) => oneOf["properties"][propertyName]
|
|
84
|
+
);
|
|
85
|
+
if (matchingOneOf)
|
|
86
|
+
return getTitleAtPath(
|
|
87
|
+
matchingOneOf["properties"][propertyName],
|
|
88
|
+
subPath,
|
|
89
|
+
rootPath
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
50
94
|
module.exports = {
|
|
51
95
|
propertyPackSchema,
|
|
52
96
|
validator,
|
|
53
97
|
getSubschema,
|
|
54
98
|
getSubschemaValidator,
|
|
99
|
+
getTitleAtPath,
|
|
55
100
|
pdtfClaim,
|
|
56
101
|
verifiedClaim
|
|
57
102
|
};
|
package/package.json
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"address",
|
|
10
10
|
"delayFactors",
|
|
11
11
|
"ownership",
|
|
12
|
-
"
|
|
12
|
+
"parking",
|
|
13
13
|
"listingAndConservation",
|
|
14
|
-
"
|
|
14
|
+
"flammableExternalWallSystem",
|
|
15
15
|
"energyEfficiency",
|
|
16
16
|
"councilTax",
|
|
17
17
|
"disputesAndComplaints",
|
|
@@ -41,8 +41,15 @@
|
|
|
41
41
|
"baspiRef": "A1.2",
|
|
42
42
|
"RDSRef": "Metadata/PotentialDelays,Metadata/PotentialDelayDuration",
|
|
43
43
|
"title": "Delay Factors",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
44
|
+
"type": "object",
|
|
45
|
+
"required": ["hasDelayFactors"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"hasDelayFactors": {
|
|
48
|
+
"title": "Are you aware of any factors which might delay or complicate the sale?",
|
|
49
|
+
"description": "E.g. family split, pending application for grant of probate, absent seller or unregistered title? If yes, provide details and likely timescale for delay (if known)",
|
|
50
|
+
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
46
53
|
},
|
|
47
54
|
"ownership": {
|
|
48
55
|
"baspiRef": "A1.3",
|
|
@@ -95,8 +102,8 @@
|
|
|
95
102
|
"annualServiceCharge",
|
|
96
103
|
"largeAdditionalExpense",
|
|
97
104
|
"additionalFeesOnSale",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
105
|
+
"freeholderContactDetails",
|
|
106
|
+
"managingAgentContactDetails",
|
|
100
107
|
"managementCompanyDirectorRequirement"
|
|
101
108
|
],
|
|
102
109
|
"properties": {
|
|
@@ -165,7 +172,8 @@
|
|
|
165
172
|
}
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
|
-
}
|
|
175
|
+
},
|
|
176
|
+
"required": ["leaseholdDetails"]
|
|
169
177
|
},
|
|
170
178
|
{
|
|
171
179
|
"properties": {
|
|
@@ -180,8 +188,8 @@
|
|
|
180
188
|
"annualServiceCharge",
|
|
181
189
|
"largeAdditionalExpense",
|
|
182
190
|
"additionalFeesOnSale",
|
|
183
|
-
"
|
|
184
|
-
"
|
|
191
|
+
"freeholderContactDetails",
|
|
192
|
+
"managingAgentContactDetails",
|
|
185
193
|
"managementCompanyDirectorRequirement"
|
|
186
194
|
],
|
|
187
195
|
"properties": {
|
|
@@ -209,13 +217,13 @@
|
|
|
209
217
|
"freeholderContactDetails": {
|
|
210
218
|
"baspiRef": "A1.5.4",
|
|
211
219
|
"RDSRef": "TenureAgreements/Assignor",
|
|
212
|
-
"title": "The
|
|
220
|
+
"title": "The contact details of the freeholder or rentcharge owner",
|
|
213
221
|
"$ref": "#/$defs/contactDetails"
|
|
214
222
|
},
|
|
215
223
|
"managingAgentContactDetails": {
|
|
216
224
|
"baspiRef": "A1.5.5",
|
|
217
225
|
"RDSRef": "Participants/Role",
|
|
218
|
-
"title": "The
|
|
226
|
+
"title": "The contact details of the managing agent",
|
|
219
227
|
"$ref": "#/$defs/contactDetails"
|
|
220
228
|
},
|
|
221
229
|
"managementCompanyDirectorRequirement": {
|
|
@@ -226,76 +234,85 @@
|
|
|
226
234
|
}
|
|
227
235
|
}
|
|
228
236
|
}
|
|
229
|
-
}
|
|
237
|
+
},
|
|
238
|
+
"required": ["managedFreeholdOrCommonhold"]
|
|
230
239
|
}
|
|
231
240
|
]
|
|
232
241
|
}
|
|
233
242
|
}
|
|
234
243
|
},
|
|
235
|
-
"
|
|
244
|
+
"parking": {
|
|
236
245
|
"baspiRef": "A1.6",
|
|
237
246
|
"RDSRef": "Services/Parking",
|
|
238
247
|
"lawSocietyRef": "TA6/9.1",
|
|
239
|
-
"title": "Parking
|
|
248
|
+
"title": "Parking",
|
|
240
249
|
"type": "object",
|
|
241
|
-
"required": ["
|
|
250
|
+
"required": ["parkingArrangements", "electricVehicleChargingPoint"],
|
|
242
251
|
"properties": {
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"title": "
|
|
246
|
-
"
|
|
247
|
-
"
|
|
248
|
-
"
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
252
|
+
"parkingArrangements": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"title": "Parking arrangements",
|
|
255
|
+
"required": ["parkingArrangementsType"],
|
|
256
|
+
"properties": {
|
|
257
|
+
"parkingArrangementsType": {
|
|
258
|
+
"baspiRef": "A1.6.1",
|
|
259
|
+
"title": "What type of parking arrangements are there?",
|
|
260
|
+
"type": "string",
|
|
261
|
+
"enum": [
|
|
262
|
+
"Garage",
|
|
263
|
+
"Allocated parking space",
|
|
264
|
+
"Driveway",
|
|
265
|
+
"On street",
|
|
266
|
+
"Resident permit",
|
|
267
|
+
"Metered parking",
|
|
268
|
+
"Communal parking",
|
|
269
|
+
"None",
|
|
270
|
+
"Other"
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"dependencies": {
|
|
275
|
+
"parkingArrangementsType": {
|
|
276
|
+
"oneOf": [
|
|
277
|
+
{
|
|
278
|
+
"properties": {
|
|
279
|
+
"parkingArrangementsType": {
|
|
280
|
+
"enum": [
|
|
281
|
+
"Garage",
|
|
282
|
+
"Allocated parking space",
|
|
283
|
+
"Driveway",
|
|
284
|
+
"On street",
|
|
285
|
+
"Resident permit",
|
|
286
|
+
"Metered parking",
|
|
287
|
+
"Communal parking",
|
|
288
|
+
"None"
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
"additionalProperties": false
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"properties": {
|
|
296
|
+
"parkingArrangementsType": {
|
|
297
|
+
"enum": ["Other"]
|
|
298
|
+
},
|
|
299
|
+
"otherParkingType": {
|
|
300
|
+
"baspiRef": "A1.6.2",
|
|
301
|
+
"title": "Please describe the other parking arrangements",
|
|
302
|
+
"type": "string"
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"required": ["otherParkingType"]
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
}
|
|
258
310
|
},
|
|
259
311
|
"electricVehicleChargingPoint": {
|
|
260
312
|
"baspiRef": "A1.6.1",
|
|
261
313
|
"title": "Is there an electric vehicle charging point belonging to the property?",
|
|
262
314
|
"$ref": "#/$defs/yesNo"
|
|
263
315
|
}
|
|
264
|
-
},
|
|
265
|
-
"dependencies": {
|
|
266
|
-
"parkingArrangementsType": {
|
|
267
|
-
"oneOf": [
|
|
268
|
-
{
|
|
269
|
-
"properties": {
|
|
270
|
-
"parkingArrangementsType": {
|
|
271
|
-
"enum": [
|
|
272
|
-
"Garage",
|
|
273
|
-
"Allocated parking space",
|
|
274
|
-
"Driveway",
|
|
275
|
-
"On street",
|
|
276
|
-
"Resident permit",
|
|
277
|
-
"Metered parking",
|
|
278
|
-
"Communal parking",
|
|
279
|
-
"None"
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
"properties": {
|
|
286
|
-
"parkingArrangementsType": {
|
|
287
|
-
"enum": ["Other"]
|
|
288
|
-
},
|
|
289
|
-
"otherParkingType": {
|
|
290
|
-
"baspiRef": "A1.6.2",
|
|
291
|
-
"title": "Please describe the other parking arrangements",
|
|
292
|
-
"type": "string"
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
"required": ["otherParkingType"]
|
|
296
|
-
}
|
|
297
|
-
]
|
|
298
|
-
}
|
|
299
316
|
}
|
|
300
317
|
},
|
|
301
318
|
"listingAndConservation": {
|
|
@@ -375,16 +392,25 @@
|
|
|
375
392
|
}
|
|
376
393
|
}
|
|
377
394
|
},
|
|
378
|
-
"
|
|
395
|
+
"flammableExternalWallSystem": {
|
|
379
396
|
"baspiRef": "A1.8.2",
|
|
380
397
|
"RDSRef": "Property/Flags,Certificates",
|
|
381
|
-
"
|
|
382
|
-
"
|
|
383
|
-
"
|
|
384
|
-
"
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
398
|
+
"type": "object",
|
|
399
|
+
"required": ["hasFlammableExternalWallSystem"],
|
|
400
|
+
"properties": {
|
|
401
|
+
"hasFlammableExternalWallSystem": {
|
|
402
|
+
"baspiRef": "A2.1",
|
|
403
|
+
"RDSRef": "Tenure/DisputesComplaints,Tenure/LegalClaims",
|
|
404
|
+
"lawSocietyRef": "TA6/2.1",
|
|
405
|
+
"title": "Does the property have potentially flammable external wall system - including cladding and balconies etc?",
|
|
406
|
+
"type": "string",
|
|
407
|
+
"enum": [
|
|
408
|
+
"Yes (EWS form attached)",
|
|
409
|
+
"Yes (No external wall system review to hand)",
|
|
410
|
+
"No"
|
|
411
|
+
]
|
|
412
|
+
}
|
|
413
|
+
}
|
|
388
414
|
},
|
|
389
415
|
"energyEfficiency": {
|
|
390
416
|
"baspiRef": "1.8.3",
|
|
@@ -577,7 +603,7 @@
|
|
|
577
603
|
"notices": {
|
|
578
604
|
"baspiRef": "A4",
|
|
579
605
|
"title": "Notices which Affect the Property",
|
|
580
|
-
"description": "Are you aware of, or have you received any of the following notices?",
|
|
606
|
+
"description": "Are you aware of, or have you received, any of the following notices?",
|
|
581
607
|
"type": "object",
|
|
582
608
|
"required": [
|
|
583
609
|
"neighbourDevelopment",
|
|
@@ -1118,7 +1144,7 @@
|
|
|
1118
1144
|
"partOnSeparateSiteOrDeed": {
|
|
1119
1145
|
"baspiRef": "A9.2",
|
|
1120
1146
|
"RDSRef": "Tenure *with different property entity and references etc*",
|
|
1121
|
-
"title": "Is any part of the property on a separate site or separate title
|
|
1147
|
+
"title": "Is any part of the property on a separate site or separate title number e.g. garden, outbuilding, parking, garage?",
|
|
1122
1148
|
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
1123
1149
|
},
|
|
1124
1150
|
"boundariesDifferFromTitlePlan": {
|
|
@@ -1300,7 +1326,7 @@
|
|
|
1300
1326
|
"RDSRef": "Tenure/OtherMaterialIssues",
|
|
1301
1327
|
"title": "Are you aware of any other material issue or information which relates to the property or has anything occurred which may affect the average person’s decision to proceed? (This disclosure is required under the Consumer Protection from Unfair Trading Regulations 2008)",
|
|
1302
1328
|
"$ref": "#/$defs/yesNoDetailIfYes",
|
|
1303
|
-
"description": "If yes, please describe this issue and any action that has been taken, if applicable
|
|
1329
|
+
"description": "If yes, please describe this issue and any action that has been taken, if applicable."
|
|
1304
1330
|
}
|
|
1305
1331
|
}
|
|
1306
1332
|
},
|
|
@@ -53,7 +53,14 @@
|
|
|
53
53
|
"RDSRef": "Participants/description=?,Participants/ActingFor/Participants/Role",
|
|
54
54
|
"title": "Sellers Conveyancer",
|
|
55
55
|
"type": "object",
|
|
56
|
-
"required": [
|
|
56
|
+
"required": [
|
|
57
|
+
"firstName",
|
|
58
|
+
"lastName",
|
|
59
|
+
"address",
|
|
60
|
+
"email",
|
|
61
|
+
"organisation",
|
|
62
|
+
"reference"
|
|
63
|
+
],
|
|
57
64
|
"properties": {
|
|
58
65
|
"firstName": {
|
|
59
66
|
"title": "First name",
|
|
@@ -63,15 +70,20 @@
|
|
|
63
70
|
"title": "Last name",
|
|
64
71
|
"type": "string"
|
|
65
72
|
},
|
|
66
|
-
"address": {
|
|
67
|
-
"title": "Address",
|
|
68
|
-
"$ref": "#/$defs/address"
|
|
69
|
-
},
|
|
70
73
|
"email": {
|
|
71
74
|
"title": "Email address",
|
|
72
75
|
"type": "string",
|
|
73
76
|
"format": "email"
|
|
74
77
|
},
|
|
78
|
+
"organisation": {
|
|
79
|
+
"title": "Organisation",
|
|
80
|
+
"type": "string"
|
|
81
|
+
},
|
|
82
|
+
"address": {
|
|
83
|
+
"title": "Address",
|
|
84
|
+
"$ref": "#/$defs/address"
|
|
85
|
+
},
|
|
86
|
+
|
|
75
87
|
"reference": {
|
|
76
88
|
"title": "Reference",
|
|
77
89
|
"type": "string"
|
|
@@ -315,8 +327,8 @@
|
|
|
315
327
|
"baspiRef": "",
|
|
316
328
|
"RDSRef": "Objects/Ownership",
|
|
317
329
|
"title": "Do you own the panels, and all equipment related to them, outright?",
|
|
318
|
-
"$ref": "#/$defs/
|
|
319
|
-
"description": "If
|
|
330
|
+
"$ref": "#/$defs/yesNoDetailIfNo",
|
|
331
|
+
"description": "If no, provide details of who owns them and the relevant documentation"
|
|
320
332
|
},
|
|
321
333
|
"panelProviderLease": {
|
|
322
334
|
"baspiRef": "B4.3.2",
|
|
@@ -366,7 +378,7 @@
|
|
|
366
378
|
"stopcockAndWaterMeterLocation": {
|
|
367
379
|
"baspiRef": "B4.6",
|
|
368
380
|
"RDSRef": "Objects/class='meters|valve|stopcock'&access=?&accessLocation=?",
|
|
369
|
-
"title": "Please describe, or attach a photograph of, the location of
|
|
381
|
+
"title": "Please describe, or attach a photograph of, the location of any stopcock and water meter",
|
|
370
382
|
"type": "string"
|
|
371
383
|
},
|
|
372
384
|
"photovoltaicMeterPanelLocation": {
|
|
@@ -375,7 +387,7 @@
|
|
|
375
387
|
"title": "Please describe, or attach a photograph of, the location of any photovoltaic panel meter",
|
|
376
388
|
"type": "string"
|
|
377
389
|
},
|
|
378
|
-
"
|
|
390
|
+
"photovoltaicBatteriesLocation": {
|
|
379
391
|
"baspiRef": "B4.8",
|
|
380
392
|
"RDSRef": "Objects/class='meters|valve|stopcock'&access=?&accessLocation=?",
|
|
381
393
|
"title": "Please describe, or attach a photograph of, the location of any photovoltaic batteries",
|
|
@@ -461,7 +473,8 @@
|
|
|
461
473
|
"hasValidGuaranteesOrWarranties": {
|
|
462
474
|
"enum": ["No"]
|
|
463
475
|
}
|
|
464
|
-
}
|
|
476
|
+
},
|
|
477
|
+
"additionalProperties": false
|
|
465
478
|
},
|
|
466
479
|
{
|
|
467
480
|
"properties": {
|
|
@@ -542,7 +555,8 @@
|
|
|
542
555
|
"baspiRef": "B5.1.11",
|
|
543
556
|
"RDSRef": "Property/Flags",
|
|
544
557
|
"title": "Please confirm that you will leave all paperwork relating to any guarantee or warranty at the property when you move out",
|
|
545
|
-
"
|
|
558
|
+
"type": "boolean",
|
|
559
|
+
"const": true
|
|
546
560
|
},
|
|
547
561
|
"outstandingClaimsOrApplications": {
|
|
548
562
|
"baspiRef": "B5.2",
|
|
@@ -22,51 +22,63 @@
|
|
|
22
22
|
"properties": {
|
|
23
23
|
"sellers": {
|
|
24
24
|
"RDSRef": "",
|
|
25
|
-
"title": "
|
|
26
|
-
"type": "
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
25
|
+
"title": "The sellers",
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"sellerInformation": {
|
|
29
|
+
"title": "Information about the sellers",
|
|
30
|
+
"type": "array",
|
|
31
|
+
"minItems": 1,
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"title": "Seller Details",
|
|
35
|
+
"required": [
|
|
36
|
+
"name",
|
|
37
|
+
"dateOfBirth",
|
|
38
|
+
"mobileNumber",
|
|
39
|
+
"email",
|
|
40
|
+
"address"
|
|
41
|
+
],
|
|
42
|
+
"properties": {
|
|
43
|
+
"name": {
|
|
44
|
+
"title": "Name",
|
|
45
|
+
"type": "object",
|
|
46
|
+
"required": ["firstName", "lastName"],
|
|
47
|
+
"properties": {
|
|
48
|
+
"firstName": {
|
|
49
|
+
"RDSRef": "",
|
|
50
|
+
"title": "First name",
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"middleNames": {
|
|
54
|
+
"title": "Middle name(s)",
|
|
55
|
+
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"lastName": {
|
|
58
|
+
"title": "Last name",
|
|
59
|
+
"type": "string"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"dateOfBirth": {
|
|
64
|
+
"title": "Date of birth",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"format": "date"
|
|
67
|
+
},
|
|
68
|
+
"mobileNumber": {
|
|
69
|
+
"title": "Mobile number",
|
|
70
|
+
"type": "string"
|
|
71
|
+
},
|
|
72
|
+
"email": {
|
|
73
|
+
"title": "Email address",
|
|
74
|
+
"type": "string",
|
|
75
|
+
"format": "email"
|
|
76
|
+
},
|
|
77
|
+
"address": {
|
|
78
|
+
"title": "Address",
|
|
79
|
+
"$ref": "#/$defs/address"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
70
82
|
}
|
|
71
83
|
}
|
|
72
84
|
}
|
|
@@ -766,7 +766,13 @@
|
|
|
766
766
|
},
|
|
767
767
|
"type": "object",
|
|
768
768
|
"properties": {
|
|
769
|
-
"OCSummaryData": {
|
|
770
|
-
|
|
769
|
+
"OCSummaryData": {
|
|
770
|
+
"title": "Official Copy Summary Data",
|
|
771
|
+
"$ref": "#/definitions/Q1OCSummaryDataType"
|
|
772
|
+
},
|
|
773
|
+
"OCRegisterData": {
|
|
774
|
+
"title": "Official Copy Register Data",
|
|
775
|
+
"$ref": "#/definitions/Q1OCRegisterDataType"
|
|
776
|
+
}
|
|
771
777
|
}
|
|
772
778
|
}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"propertyPack": {
|
|
5
5
|
"sellers": [
|
|
6
6
|
{
|
|
7
|
-
"firstName": "John",
|
|
8
|
-
"lastName": "Davies",
|
|
7
|
+
"name": { "firstName": "John", "lastName": "Davies" },
|
|
9
8
|
"dateOfBirth": "1975-12-25",
|
|
10
|
-
"
|
|
9
|
+
"mobileNumber": "07777 222333",
|
|
10
|
+
"email": "john@theseller.com",
|
|
11
11
|
"address": { "address1": "10 Downend Park", "postcode": "BS7 9PU" }
|
|
12
12
|
}
|
|
13
13
|
],
|
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
"ownership": {
|
|
29
29
|
"ownershipType": "Freehold"
|
|
30
30
|
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
31
|
+
"parking": {
|
|
32
|
+
"parkingArrangements": {
|
|
33
|
+
"parkingArrangementsType": "Other",
|
|
34
|
+
"otherParkingType": "Garage and double width driveway"
|
|
35
|
+
},
|
|
34
36
|
"electricVehicleChargingPoint": { "yesNo": "No" }
|
|
35
37
|
},
|
|
36
38
|
"listingAndConservation": {
|
|
@@ -44,7 +46,9 @@
|
|
|
44
46
|
"yesNo": "No"
|
|
45
47
|
}
|
|
46
48
|
},
|
|
47
|
-
"
|
|
49
|
+
"flammableExternalWallSystem": {
|
|
50
|
+
"hasFlammableExternalWallSystem": "No"
|
|
51
|
+
},
|
|
48
52
|
"councilTax": {
|
|
49
53
|
"councilTaxBand": "A",
|
|
50
54
|
"councilTaxAffectingAlterations": {
|
|
@@ -4,7 +4,8 @@ const {
|
|
|
4
4
|
propertyPackSchema,
|
|
5
5
|
validator,
|
|
6
6
|
getSubschema,
|
|
7
|
-
getSubschemaValidator
|
|
7
|
+
getSubschemaValidator,
|
|
8
|
+
getTitleAtPath
|
|
8
9
|
} = require("../../index.js");
|
|
9
10
|
const examplePropertyPack = require("./examplePropertyPack.json");
|
|
10
11
|
|
|
@@ -27,6 +28,16 @@ test("invalid sample is invalid", () => {
|
|
|
27
28
|
expect(isValid).toBe(false);
|
|
28
29
|
});
|
|
29
30
|
|
|
31
|
+
test("sample with missing dependent required fields is invalid", () => {
|
|
32
|
+
const clonedExamplePropertyPack = JSON.parse(
|
|
33
|
+
JSON.stringify(examplePropertyPack)
|
|
34
|
+
);
|
|
35
|
+
clonedExamplePropertyPack.propertyPack.materialFacts.ownership.ownershipType =
|
|
36
|
+
"leashold";
|
|
37
|
+
const isValid = validator(clonedExamplePropertyPack);
|
|
38
|
+
expect(isValid).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
|
|
30
41
|
test("correctly gets a subschema", () => {
|
|
31
42
|
const subschema = getSubschema("/propertyPack/materialFacts/notices");
|
|
32
43
|
expect(subschema.title).toBe("Notices which Affect the Property");
|
|
@@ -43,3 +54,56 @@ test("correctly gets a working subschema validator", () => {
|
|
|
43
54
|
isValid = validator(data);
|
|
44
55
|
expect(isValid).toBe(false);
|
|
45
56
|
});
|
|
57
|
+
|
|
58
|
+
test("correctly gets titles across schemas, arrays and non-existient title properties", () => {
|
|
59
|
+
expect(
|
|
60
|
+
getTitleAtPath(
|
|
61
|
+
propertyPackSchema,
|
|
62
|
+
"/propertyPack/materialFacts/ownership/ownershipType"
|
|
63
|
+
)
|
|
64
|
+
).toBe("What type of ownership is the property?");
|
|
65
|
+
expect(
|
|
66
|
+
getTitleAtPath(
|
|
67
|
+
propertyPackSchema,
|
|
68
|
+
"/propertyPack/materialFacts/ownership/leaseholdDetails/lengthOfLeaseInYears"
|
|
69
|
+
)
|
|
70
|
+
).toBe("Length of lease (years)");
|
|
71
|
+
expect(
|
|
72
|
+
getTitleAtPath(
|
|
73
|
+
propertyPackSchema,
|
|
74
|
+
"/propertyPack/materialFacts/ownership/managedFreeholdOrCommonhold/annualServiceCharge"
|
|
75
|
+
)
|
|
76
|
+
).toBe(
|
|
77
|
+
"Amount of current annual service charge/estate rentcharge/maintenance contribution (£)"
|
|
78
|
+
);
|
|
79
|
+
expect(
|
|
80
|
+
getTitleAtPath(
|
|
81
|
+
propertyPackSchema,
|
|
82
|
+
"/propertyPack/materialFacts/invalidPath"
|
|
83
|
+
)
|
|
84
|
+
).toBe(undefined);
|
|
85
|
+
expect(
|
|
86
|
+
getTitleAtPath(
|
|
87
|
+
propertyPackSchema,
|
|
88
|
+
"/propertyPack/titlesToBeSold/0/registerExtract"
|
|
89
|
+
)
|
|
90
|
+
).toBe("Property Data Trust Framework HMLR Register Extract representation");
|
|
91
|
+
expect(
|
|
92
|
+
getTitleAtPath(
|
|
93
|
+
propertyPackSchema,
|
|
94
|
+
"/propertyPack/titlesToBeSold/0/registerExtract/OCSummaryData/PropertyAddress"
|
|
95
|
+
)
|
|
96
|
+
).toBe("Property address");
|
|
97
|
+
expect(
|
|
98
|
+
getTitleAtPath(
|
|
99
|
+
propertyPackSchema,
|
|
100
|
+
"/propertyPack/titlesToBeSold/0/registerExtract/OCSummaryData/InvalidProp"
|
|
101
|
+
)
|
|
102
|
+
).toBe(undefined);
|
|
103
|
+
expect(
|
|
104
|
+
getTitleAtPath(
|
|
105
|
+
propertyPackSchema,
|
|
106
|
+
"/propertyPack/energyPerformanceCertificate/certificate/currentEnergyRating"
|
|
107
|
+
)
|
|
108
|
+
).toBe("Current energy rating");
|
|
109
|
+
});
|