@pdtf/schemas 0.6.13 → 0.7.0
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 +7 -5
- package/package.json +35 -35
- package/src/examples/exampleTransaction.json +31 -47
- package/src/schemas/baspi-a-material-facts.json +150 -57
- package/src/schemas/baspi-b-legal-information.json +13 -50
- package/src/schemas/pdtf-transaction.json +7 -2
- package/src/tests/transactionSchema.test.js +0 -272
- package/src/tests/verifiedClaimsValidator.test.js +96 -0
package/index.js
CHANGED
|
@@ -119,18 +119,22 @@ const getTitleAtPath = (schema, path, rootPath = path) => {
|
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
const validateVerifiedClaims = (
|
|
122
|
+
const validateVerifiedClaims = (verifiedClaims) => {
|
|
123
123
|
const validatorVClaims = ajv.compile(verifiedClaimsSchema);
|
|
124
124
|
|
|
125
125
|
const validationErrorsArr = [];
|
|
126
126
|
const vClaimSchValidation = validatorVClaims({
|
|
127
|
-
verified_claims:
|
|
127
|
+
verified_claims: verifiedClaims,
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
if (!vClaimSchValidation) {
|
|
131
131
|
validationErrorsArr.push(validatorVClaims.errors);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
const verifiedClaimsArray = Array.isArray(verifiedClaims)
|
|
135
|
+
? verifiedClaims
|
|
136
|
+
: [verifiedClaims];
|
|
137
|
+
|
|
134
138
|
verifiedClaimsArray.forEach((claim) => {
|
|
135
139
|
const paths = Object.keys(claim.claims);
|
|
136
140
|
|
|
@@ -153,8 +157,6 @@ const validateVerifiedClaims = (verifiedClaimsArray) => {
|
|
|
153
157
|
return validationErrorsArr;
|
|
154
158
|
};
|
|
155
159
|
|
|
156
|
-
|
|
157
|
-
|
|
158
160
|
module.exports = {
|
|
159
161
|
transactionSchema,
|
|
160
162
|
validator,
|
|
@@ -163,5 +165,5 @@ module.exports = {
|
|
|
163
165
|
getSubschemaValidator,
|
|
164
166
|
getTitleAtPath,
|
|
165
167
|
verifiedClaimsSchema,
|
|
166
|
-
validateVerifiedClaims
|
|
168
|
+
validateVerifiedClaims,
|
|
167
169
|
};
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
2
|
+
"name": "@pdtf/schemas",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Property Data Trust Framework Schemas and Utilities",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"doc": "docs"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"test:watch": "jest --watch"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/Property-Data-Trust-Framework/schemas.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"PDTF",
|
|
19
|
+
"Schemas"
|
|
20
|
+
],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Property-Data-Trust-Framework/schemas/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/Property-Data-Trust-Framework/schemas#readme",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@jdw/jst": "^2.0.0-beta.15",
|
|
29
|
+
"ajv": "^8.10.0",
|
|
30
|
+
"ajv-formats": "^2.1.1",
|
|
31
|
+
"jsonpointer": "^5.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"jest": "^27.5.1"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -82,12 +82,10 @@
|
|
|
82
82
|
"yesNo": "Yes"
|
|
83
83
|
},
|
|
84
84
|
"listedBuildingConsent": {
|
|
85
|
-
"yesNo": "Not required"
|
|
86
|
-
"reasons": "Not listed building\n"
|
|
85
|
+
"yesNo": "Not required"
|
|
87
86
|
},
|
|
88
87
|
"deedRestrictionConsent": {
|
|
89
|
-
"yesNo": "Not required"
|
|
90
|
-
"reasons": "Retrospective consent obtained from leasehold provider but property now freehold"
|
|
88
|
+
"yesNo": "Not required"
|
|
91
89
|
},
|
|
92
90
|
"unfinished": {
|
|
93
91
|
"yesNo": "No"
|
|
@@ -97,20 +95,16 @@
|
|
|
97
95
|
},
|
|
98
96
|
"windowReplacementsSince2002": {
|
|
99
97
|
"buildingRegApproval": {
|
|
100
|
-
"yesNo": "Not required"
|
|
101
|
-
"reasons": "Not required"
|
|
98
|
+
"yesNo": "Not required"
|
|
102
99
|
},
|
|
103
100
|
"planningPermission": {
|
|
104
|
-
"yesNo": "Not required"
|
|
105
|
-
"reasons": "Not required"
|
|
101
|
+
"yesNo": "Not required"
|
|
106
102
|
},
|
|
107
103
|
"listedBuildingConsent": {
|
|
108
|
-
"yesNo": "Not required"
|
|
109
|
-
"reasons": "Not listed building"
|
|
104
|
+
"yesNo": "Not required"
|
|
110
105
|
},
|
|
111
106
|
"deedRestrictionConsent": {
|
|
112
|
-
"yesNo": "Not required"
|
|
113
|
-
"reasons": "None required"
|
|
107
|
+
"yesNo": "Not required"
|
|
114
108
|
},
|
|
115
109
|
"unfinished": {
|
|
116
110
|
"yesNo": "No"
|
|
@@ -120,20 +114,17 @@
|
|
|
120
114
|
},
|
|
121
115
|
"hasAddedConservatory": {
|
|
122
116
|
"buildingRegApproval": {
|
|
123
|
-
"yesNo": "Not required"
|
|
124
|
-
"reasons": "Added as part of initial build"
|
|
117
|
+
"yesNo": "Not required"
|
|
125
118
|
},
|
|
126
119
|
"planningPermission": {
|
|
127
|
-
"yesNo": "Not required"
|
|
128
|
-
"reasons": "Added as part of initial build"
|
|
120
|
+
"yesNo": "Not required"
|
|
129
121
|
},
|
|
130
122
|
"listedBuildingConsent": {
|
|
131
|
-
"yesNo": "Not required"
|
|
132
|
-
"reasons": "Not listed building"
|
|
123
|
+
"yesNo": "Not required"
|
|
133
124
|
},
|
|
134
125
|
"deedRestrictionConsent": {
|
|
135
|
-
"yesNo": "
|
|
136
|
-
"
|
|
126
|
+
"yesNo": "No",
|
|
127
|
+
"details": "Added as part of initial build and deeds"
|
|
137
128
|
},
|
|
138
129
|
"unfinished": {
|
|
139
130
|
"yesNo": "No"
|
|
@@ -201,25 +192,32 @@
|
|
|
201
192
|
"maintenanceAgreements": {
|
|
202
193
|
"yesNo": "No"
|
|
203
194
|
},
|
|
204
|
-
"yesNo": "
|
|
205
|
-
"
|
|
195
|
+
"yesNo": "To be connected",
|
|
196
|
+
"dateToBeConnected": "2022-12-15",
|
|
206
197
|
"supplier": "Northumbria Water"
|
|
207
198
|
},
|
|
208
199
|
"mainsSurfaceWaterDrainage": {
|
|
209
200
|
"maintenanceAgreements": {
|
|
210
201
|
"yesNo": "No"
|
|
211
202
|
},
|
|
212
|
-
"yesNo": "Yes"
|
|
213
|
-
"connected": "Yes",
|
|
214
|
-
"supplier": "Northumbria Water"
|
|
203
|
+
"yesNo": "Yes"
|
|
215
204
|
},
|
|
216
205
|
"mainsFoulDrainage": {
|
|
217
|
-
"
|
|
218
|
-
|
|
206
|
+
"yesNo": "No",
|
|
207
|
+
"sustainableDrainageSystem": { "yesNo": "No" },
|
|
208
|
+
"septicTank": {
|
|
209
|
+
"yesNo": "Yes",
|
|
210
|
+
"details": "Last emptied on 1 Jan 2022"
|
|
219
211
|
},
|
|
220
|
-
"yesNo": "
|
|
221
|
-
"
|
|
222
|
-
"
|
|
212
|
+
"cesspit": { "yesNo": "No" },
|
|
213
|
+
"sewerageTreatmentPlant": { "yesNo": "No" },
|
|
214
|
+
"otherConnectedProperties": { "yesNo": "No" },
|
|
215
|
+
"plantOnOtherLand": { "yesNo": "No" },
|
|
216
|
+
"plantRegistered": { "yesNo": "No" },
|
|
217
|
+
"plantDrainsIntoWaterway": {
|
|
218
|
+
"yesNo": "Yes",
|
|
219
|
+
"dischargeCompliesWithGBR": "Yes"
|
|
220
|
+
}
|
|
223
221
|
}
|
|
224
222
|
},
|
|
225
223
|
"utilities": {
|
|
@@ -228,7 +226,6 @@
|
|
|
228
226
|
"yesNo": "No"
|
|
229
227
|
},
|
|
230
228
|
"yesNo": "Yes",
|
|
231
|
-
"connected": "Yes",
|
|
232
229
|
"supplier": "Octopus Energy"
|
|
233
230
|
},
|
|
234
231
|
"gas": {
|
|
@@ -236,7 +233,6 @@
|
|
|
236
233
|
"yesNo": "No"
|
|
237
234
|
},
|
|
238
235
|
"yesNo": "Yes",
|
|
239
|
-
"connected": "Yes",
|
|
240
236
|
"supplier": "Octopus Energy"
|
|
241
237
|
},
|
|
242
238
|
"lpg": {
|
|
@@ -250,7 +246,6 @@
|
|
|
250
246
|
"yesNo": "No"
|
|
251
247
|
},
|
|
252
248
|
"yesNo": "Yes",
|
|
253
|
-
"connected": "Yes",
|
|
254
249
|
"supplier": "EE"
|
|
255
250
|
},
|
|
256
251
|
"cableSatelliteTV": {
|
|
@@ -258,7 +253,6 @@
|
|
|
258
253
|
"yesNo": "No"
|
|
259
254
|
},
|
|
260
255
|
"yesNo": "Yes",
|
|
261
|
-
"connected": "Yes",
|
|
262
256
|
"supplier": "Sky"
|
|
263
257
|
},
|
|
264
258
|
"broadband": {
|
|
@@ -266,7 +260,6 @@
|
|
|
266
260
|
"yesNo": "No"
|
|
267
261
|
},
|
|
268
262
|
"yesNo": "Yes",
|
|
269
|
-
"connected": "Yes",
|
|
270
263
|
"supplier": "EE"
|
|
271
264
|
},
|
|
272
265
|
"solarPanels": {
|
|
@@ -291,7 +284,7 @@
|
|
|
291
284
|
"heatingInGoodWorkingOrder": {
|
|
292
285
|
"yesNo": "Yes"
|
|
293
286
|
},
|
|
294
|
-
"centralHeatingFuel": "Gas
|
|
287
|
+
"centralHeatingFuel": { "centralHeatingFuelType": "Gas" },
|
|
295
288
|
"centralHeatingInstalled": "2016-04-20",
|
|
296
289
|
"heatingLastServiced": "2021-03-26"
|
|
297
290
|
}
|
|
@@ -333,7 +326,7 @@
|
|
|
333
326
|
"publicRightOfWay": {
|
|
334
327
|
"yesNo": "No"
|
|
335
328
|
},
|
|
336
|
-
"
|
|
329
|
+
"rightsOfLightOrSupport": {
|
|
337
330
|
"yesNo": "No"
|
|
338
331
|
},
|
|
339
332
|
"rightsCreatedThroughCustom": {
|
|
@@ -365,8 +358,7 @@
|
|
|
365
358
|
},
|
|
366
359
|
"failedTransactionsInLast12Months": {
|
|
367
360
|
"yesNo": "No"
|
|
368
|
-
}
|
|
369
|
-
"comments": "Not applicable"
|
|
361
|
+
}
|
|
370
362
|
},
|
|
371
363
|
"additionalInformation": {
|
|
372
364
|
"restrictionsOnUseNotCompliedWith": {
|
|
@@ -387,14 +379,6 @@
|
|
|
387
379
|
"lastName": "Hetherington-Smythe"
|
|
388
380
|
}
|
|
389
381
|
],
|
|
390
|
-
"sellersConveyancer": {
|
|
391
|
-
"firstName": "John",
|
|
392
|
-
"lastName": "Lawson",
|
|
393
|
-
"address": { "line1": "66 Railway Ave", "postcode": "SL12 1AA" },
|
|
394
|
-
"email": "john@bodgit.co.uk",
|
|
395
|
-
"organisation": "Bodgit, Leggit and Run Partners",
|
|
396
|
-
"reference": "12345"
|
|
397
|
-
},
|
|
398
382
|
"sellersCapacity": { "capacity": "Legal Owner" },
|
|
399
383
|
"legalBoundaries": {
|
|
400
384
|
"left": "Seller",
|
|
@@ -372,7 +372,8 @@
|
|
|
372
372
|
"yesNo": {
|
|
373
373
|
"enum": ["No"]
|
|
374
374
|
}
|
|
375
|
-
}
|
|
375
|
+
},
|
|
376
|
+
"additionalProperties": false
|
|
376
377
|
},
|
|
377
378
|
{
|
|
378
379
|
"properties": {
|
|
@@ -545,7 +546,8 @@
|
|
|
545
546
|
"yesNo": {
|
|
546
547
|
"enum": ["No"]
|
|
547
548
|
}
|
|
548
|
-
}
|
|
549
|
+
},
|
|
550
|
+
"additionalProperties": false
|
|
549
551
|
},
|
|
550
552
|
{
|
|
551
553
|
"properties": {
|
|
@@ -593,7 +595,8 @@
|
|
|
593
595
|
"yesNo": {
|
|
594
596
|
"enum": ["No"]
|
|
595
597
|
}
|
|
596
|
-
}
|
|
598
|
+
},
|
|
599
|
+
"additionalProperties": false
|
|
597
600
|
},
|
|
598
601
|
{
|
|
599
602
|
"properties": {
|
|
@@ -709,7 +712,7 @@
|
|
|
709
712
|
"containsAsbestos": {
|
|
710
713
|
"baspiRef": "A5.2",
|
|
711
714
|
"RDSRef": "Property/Flags,BuildingSections/EnvironmentalIssues",
|
|
712
|
-
"title": "To your knowledge, does any part of your property contain
|
|
715
|
+
"title": "To your knowledge, does any part of your property contain asbestos?",
|
|
713
716
|
"$ref": "#/$defs/yesNoDetailIfYes",
|
|
714
717
|
"description": "If yes, please state whether there is a management plan in place and attach a copy"
|
|
715
718
|
},
|
|
@@ -717,7 +720,8 @@
|
|
|
717
720
|
"baspiRef": "A5.3",
|
|
718
721
|
"RDSRef": "Property/Flags,BuildingSections/EnvironmentalIssues,Use/EnvironmentalIssues",
|
|
719
722
|
"lawSocietyRef": "TA6/7.8",
|
|
720
|
-
"title": "To your knowledge, is the property or neighbouring land, affected by Japanese knotweed or other invasive species?
|
|
723
|
+
"title": "To your knowledge, is the property or neighbouring land, affected by Japanese knotweed or other invasive species?",
|
|
724
|
+
"description": "If so please state whether there is a management plan in place and attach a copy",
|
|
721
725
|
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
722
726
|
},
|
|
723
727
|
"subsidenceOrStructuralFault": {
|
|
@@ -738,7 +742,7 @@
|
|
|
738
742
|
"baspiRef": "A6",
|
|
739
743
|
"lawSocietyRef": "TA10",
|
|
740
744
|
"title": "Fixtures and Fittings",
|
|
741
|
-
"description": "
|
|
745
|
+
"description": "This is so a buyer's offer can take into account whether you are taking something of value or leaving extra items. A full list will need to be completed after the sale is agreed.",
|
|
742
746
|
"type": "object",
|
|
743
747
|
"required": ["itemsToRemove", "itemsToInclude"],
|
|
744
748
|
"properties": {
|
|
@@ -792,7 +796,7 @@
|
|
|
792
796
|
"yesNo": {
|
|
793
797
|
"type": "string",
|
|
794
798
|
"title": "",
|
|
795
|
-
"enum": ["Yes", "No"]
|
|
799
|
+
"enum": ["Yes", "To be connected", "No"]
|
|
796
800
|
}
|
|
797
801
|
},
|
|
798
802
|
"dependencies": {
|
|
@@ -860,26 +864,64 @@
|
|
|
860
864
|
"baspiRef": "A7.2.8",
|
|
861
865
|
"RDSRef": "Services/OtherServices/{isExternallyConnected='yes?true'}",
|
|
862
866
|
"title": "Does the septic tank, cesspit or sewerage treatment plant drain into a waterway (lake, river, stream etc)",
|
|
863
|
-
"type": "
|
|
864
|
-
"
|
|
865
|
-
"
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
"
|
|
875
|
-
|
|
876
|
-
"
|
|
877
|
-
|
|
867
|
+
"type": "object",
|
|
868
|
+
"properties": {
|
|
869
|
+
"yesNo": {
|
|
870
|
+
"type": "string",
|
|
871
|
+
"title": "",
|
|
872
|
+
"enum": [
|
|
873
|
+
"Yes",
|
|
874
|
+
"No, the effluent is discharged through a soakaway system."
|
|
875
|
+
]
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
"required": ["yesNo"],
|
|
879
|
+
"dependencies": {
|
|
880
|
+
"yesNo": {
|
|
881
|
+
"oneOf": [
|
|
882
|
+
{
|
|
883
|
+
"properties": {
|
|
884
|
+
"yesNo": {
|
|
885
|
+
"enum": [
|
|
886
|
+
"No, the effluent is discharged through a soakaway system."
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
},
|
|
890
|
+
"additionalProperties": false
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
"properties": {
|
|
894
|
+
"yesNo": {
|
|
895
|
+
"enum": ["Yes"]
|
|
896
|
+
},
|
|
897
|
+
"dischargeCompliesWithGBR": {
|
|
898
|
+
"baspiRef": "A7.2.9",
|
|
899
|
+
"RDSRef": "Services/OtherServices/ExternalConnections/Flags",
|
|
900
|
+
"title": "Does it comply with the General Binding Rules for discharge into a waterway?",
|
|
901
|
+
"type": "string",
|
|
902
|
+
"enum": [
|
|
903
|
+
"Yes",
|
|
904
|
+
"No, it does not comply with the rules for discharge into a waterway."
|
|
905
|
+
]
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
"required": ["dischargeCompliesWithGBR"]
|
|
909
|
+
}
|
|
910
|
+
]
|
|
911
|
+
}
|
|
912
|
+
}
|
|
878
913
|
}
|
|
879
914
|
},
|
|
915
|
+
"additionalProperties": false,
|
|
880
916
|
"required": [
|
|
881
|
-
"
|
|
882
|
-
"
|
|
917
|
+
"sustainableDrainageSystem",
|
|
918
|
+
"septicTank",
|
|
919
|
+
"cesspit",
|
|
920
|
+
"sewerageTreatmentPlant",
|
|
921
|
+
"otherConnectedProperties",
|
|
922
|
+
"plantOnOtherLand",
|
|
923
|
+
"plantRegistered",
|
|
924
|
+
"plantDrainsIntoWaterway"
|
|
883
925
|
]
|
|
884
926
|
},
|
|
885
927
|
{
|
|
@@ -887,22 +929,42 @@
|
|
|
887
929
|
"yesNo": {
|
|
888
930
|
"enum": ["Yes"]
|
|
889
931
|
},
|
|
890
|
-
"
|
|
891
|
-
"title": "
|
|
932
|
+
"supplier": {
|
|
933
|
+
"title": "Supplier (if known)",
|
|
892
934
|
"type": "string",
|
|
893
935
|
"minLength": 1
|
|
894
936
|
},
|
|
937
|
+
"maintenanceAgreements": {
|
|
938
|
+
"title": "Do you have any licences, maintenance agreements, contracts or service agreements in relation to this service?",
|
|
939
|
+
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
940
|
+
}
|
|
941
|
+
},
|
|
942
|
+
"additionalProperties": false,
|
|
943
|
+
"required": ["maintenanceAgreements"]
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
"properties": {
|
|
947
|
+
"yesNo": {
|
|
948
|
+
"enum": ["To be connected"]
|
|
949
|
+
},
|
|
950
|
+
"dateToBeConnected": {
|
|
951
|
+
"title": "Date to be connected",
|
|
952
|
+
"type": "string",
|
|
953
|
+
"format": "date"
|
|
954
|
+
},
|
|
895
955
|
"supplier": {
|
|
896
956
|
"title": "Supplier (if known)",
|
|
897
|
-
"type": "string"
|
|
898
|
-
"minLength": 1
|
|
957
|
+
"type": "string"
|
|
899
958
|
},
|
|
900
959
|
"maintenanceAgreements": {
|
|
960
|
+
"BASPIRef": "A7.2",
|
|
961
|
+
"RDSRef": "Services/Certificates,Services/OtherServices/Certificates",
|
|
901
962
|
"title": "Do you have any licences, maintenance agreements, contracts or service agreements in relation to this service?",
|
|
902
963
|
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
903
964
|
}
|
|
904
965
|
},
|
|
905
|
-
"
|
|
966
|
+
"additionalProperties": false,
|
|
967
|
+
"required": ["dateToBeConnected", "maintenanceAgreements"]
|
|
906
968
|
}
|
|
907
969
|
]
|
|
908
970
|
}
|
|
@@ -1039,9 +1101,44 @@
|
|
|
1039
1101
|
"baspiRef": "A7.5.1",
|
|
1040
1102
|
"RDSRef": "Buildings|BuildingSections/Heating/isGas=no|yes|true|false",
|
|
1041
1103
|
"lawSocietyRef": "TA6/12.3a",
|
|
1042
|
-
"
|
|
1043
|
-
"
|
|
1044
|
-
"
|
|
1104
|
+
"type": "object",
|
|
1105
|
+
"title": "Central Heating Fuel",
|
|
1106
|
+
"required": ["centralHeatingFuelType"],
|
|
1107
|
+
"properties": {
|
|
1108
|
+
"centralHeatingFuelType": {
|
|
1109
|
+
"baspiRef": "A1.6.1",
|
|
1110
|
+
"title": "What type of fuel does the system and boiler run on?",
|
|
1111
|
+
"type": "string",
|
|
1112
|
+
"enum": ["Gas", "Electricity", "Oil", "LPG", "Other"]
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
1115
|
+
"dependencies": {
|
|
1116
|
+
"centralHeatingFuelType": {
|
|
1117
|
+
"oneOf": [
|
|
1118
|
+
{
|
|
1119
|
+
"properties": {
|
|
1120
|
+
"centralHeatingFuelType": {
|
|
1121
|
+
"enum": ["Gas", "Electricity", "Oil", "LPG"]
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
"additionalProperties": false
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
"properties": {
|
|
1128
|
+
"centralHeatingFuelType": {
|
|
1129
|
+
"enum": ["Other"]
|
|
1130
|
+
},
|
|
1131
|
+
"otherCentralHeatingFuelType": {
|
|
1132
|
+
"title": "Please describe the other fuel type",
|
|
1133
|
+
"type": "string",
|
|
1134
|
+
"minLength": 1
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
"required": ["otherCentralHeatingFuelType"]
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1045
1142
|
},
|
|
1046
1143
|
"centralHeatingInstalled": {
|
|
1047
1144
|
"baspiRef": "A7.5.2",
|
|
@@ -1055,7 +1152,7 @@
|
|
|
1055
1152
|
"baspiRef": "A7.5.3",
|
|
1056
1153
|
"RDSRef": "Objects/Installation,Objects/Certificates",
|
|
1057
1154
|
"lawSocietyRef": "TA6/12.3b",
|
|
1058
|
-
"title": "Was a gas boiler installed after 1st April 2005, or a solid fuel or oil boiler installed after
|
|
1155
|
+
"title": "Was a gas boiler installed after 1st April 2005, or a solid fuel or oil boiler installed after 1st October 2010?",
|
|
1059
1156
|
"$ref": "#/$defs/yesNoDetailIfYes",
|
|
1060
1157
|
"description": "If yes, please supply a copy of the installation completion certificate from a competent person qualified under the relevant self-certification scheme e.g. HETAS etc"
|
|
1061
1158
|
},
|
|
@@ -1223,7 +1320,7 @@
|
|
|
1223
1320
|
"type": "object",
|
|
1224
1321
|
"required": [
|
|
1225
1322
|
"publicRightOfWay",
|
|
1226
|
-
"
|
|
1323
|
+
"rightsOfLightOrSupport",
|
|
1227
1324
|
"rightsCreatedThroughCustom",
|
|
1228
1325
|
"minesAndMinerals",
|
|
1229
1326
|
"churchChancel",
|
|
@@ -1238,7 +1335,7 @@
|
|
|
1238
1335
|
"$ref": "#/$defs/yesNoDetailIfYes",
|
|
1239
1336
|
"description": "If yes, please mark the route on a plan of the property"
|
|
1240
1337
|
},
|
|
1241
|
-
"
|
|
1338
|
+
"rightsOfLightOrSupport": {
|
|
1242
1339
|
"baspiRef": "A10.4.2",
|
|
1243
1340
|
"RDSRef": "Tenure/Rights,Tenure/Restrictions,Tenure/Responsibilities",
|
|
1244
1341
|
"lawSocietyRef": "TA6/8.4a",
|
|
@@ -1286,8 +1383,7 @@
|
|
|
1286
1383
|
"excessiveNoise",
|
|
1287
1384
|
"crime",
|
|
1288
1385
|
"cautionOrConviction",
|
|
1289
|
-
"failedTransactionsInLast12Months"
|
|
1290
|
-
"comments"
|
|
1386
|
+
"failedTransactionsInLast12Months"
|
|
1291
1387
|
],
|
|
1292
1388
|
"properties": {
|
|
1293
1389
|
"environmental": {
|
|
@@ -1321,12 +1417,6 @@
|
|
|
1321
1417
|
"RDSRef": "Tenure/OtherMaterialIssues",
|
|
1322
1418
|
"title": "Have there been any failed purchase transactions on the property within the last 12 months?",
|
|
1323
1419
|
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
1324
|
-
},
|
|
1325
|
-
"comments": {
|
|
1326
|
-
"baspiRef": "A11.6",
|
|
1327
|
-
"RDSRef": "Tenure/OtherMaterialIssues,Tenure/OtherDocumentation",
|
|
1328
|
-
"title": "Please add any comments to the previous questions and provide any relevant documentation eg flood risk report, radon report and confirmation of any remedial measures on construction to reduce risk etc",
|
|
1329
|
-
"type": "string"
|
|
1330
1420
|
}
|
|
1331
1421
|
}
|
|
1332
1422
|
},
|
|
@@ -1454,7 +1544,7 @@
|
|
|
1454
1544
|
}
|
|
1455
1545
|
}
|
|
1456
1546
|
},
|
|
1457
|
-
"
|
|
1547
|
+
"yesNoNotRequiredDetailIfNo": {
|
|
1458
1548
|
"type": "object",
|
|
1459
1549
|
"properties": {
|
|
1460
1550
|
"yesNo": {
|
|
@@ -1470,7 +1560,7 @@
|
|
|
1470
1560
|
{
|
|
1471
1561
|
"properties": {
|
|
1472
1562
|
"yesNo": {
|
|
1473
|
-
"enum": ["Yes"]
|
|
1563
|
+
"enum": ["Yes", "Not required"]
|
|
1474
1564
|
}
|
|
1475
1565
|
},
|
|
1476
1566
|
"additionalProperties": false
|
|
@@ -1478,15 +1568,15 @@
|
|
|
1478
1568
|
{
|
|
1479
1569
|
"properties": {
|
|
1480
1570
|
"yesNo": {
|
|
1481
|
-
"enum": ["No"
|
|
1571
|
+
"enum": ["No"]
|
|
1482
1572
|
},
|
|
1483
|
-
"
|
|
1573
|
+
"details": {
|
|
1484
1574
|
"title": "Please outline the reasons why",
|
|
1485
1575
|
"type": "string",
|
|
1486
1576
|
"minLength": 1
|
|
1487
1577
|
}
|
|
1488
1578
|
},
|
|
1489
|
-
"required": ["
|
|
1579
|
+
"required": ["details"]
|
|
1490
1580
|
}
|
|
1491
1581
|
]
|
|
1492
1582
|
}
|
|
@@ -1529,7 +1619,7 @@
|
|
|
1529
1619
|
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
1530
1620
|
}
|
|
1531
1621
|
},
|
|
1532
|
-
"required": ["
|
|
1622
|
+
"required": ["maintenanceAgreements"]
|
|
1533
1623
|
},
|
|
1534
1624
|
{
|
|
1535
1625
|
"properties": {
|
|
@@ -1552,7 +1642,7 @@
|
|
|
1552
1642
|
"$ref": "#/$defs/yesNoDetailIfYes"
|
|
1553
1643
|
}
|
|
1554
1644
|
},
|
|
1555
|
-
"required": ["dateToBeConnected"]
|
|
1645
|
+
"required": ["dateToBeConnected", "maintenanceAgreements"]
|
|
1556
1646
|
}
|
|
1557
1647
|
]
|
|
1558
1648
|
}
|
|
@@ -1576,7 +1666,8 @@
|
|
|
1576
1666
|
"yesNo": {
|
|
1577
1667
|
"enum": ["No"]
|
|
1578
1668
|
}
|
|
1579
|
-
}
|
|
1669
|
+
},
|
|
1670
|
+
"additionalProperties": false
|
|
1580
1671
|
},
|
|
1581
1672
|
{
|
|
1582
1673
|
"properties": {
|
|
@@ -1593,28 +1684,28 @@
|
|
|
1593
1684
|
"RDSRef": "WorksAlterationsChanges/ConsentApproval",
|
|
1594
1685
|
"lawSocietyRef": "TA6/4.2",
|
|
1595
1686
|
"title": "Was building regulation approval and a completion certificate obtained or an equivalent Competent Person Scheme Certificate?",
|
|
1596
|
-
"$ref": "#/$defs/
|
|
1687
|
+
"$ref": "#/$defs/yesNoNotRequiredDetailIfNo"
|
|
1597
1688
|
},
|
|
1598
1689
|
"planningPermission": {
|
|
1599
1690
|
"baspiRef": "A3.4.2",
|
|
1600
1691
|
"RDSRef": "WorksAlterationsChanges/ConsentApproval",
|
|
1601
1692
|
"lawSocietyRef": "TA6/4.2",
|
|
1602
1693
|
"title": "Was planning permission obtained?",
|
|
1603
|
-
"$ref": "#/$defs/
|
|
1694
|
+
"$ref": "#/$defs/yesNoNotRequiredDetailIfNo"
|
|
1604
1695
|
},
|
|
1605
1696
|
"listedBuildingConsent": {
|
|
1606
1697
|
"baspiRef": "A3.4.3",
|
|
1607
1698
|
"RDSRef": "WorksAlterationsChanges/ConsentApproval",
|
|
1608
1699
|
"lawSocietyRef": "TA6/4.2",
|
|
1609
1700
|
"title": "Was listed building consent obtained?",
|
|
1610
|
-
"$ref": "#/$defs/
|
|
1701
|
+
"$ref": "#/$defs/yesNoNotRequiredDetailIfNo"
|
|
1611
1702
|
},
|
|
1612
1703
|
"deedRestrictionConsent": {
|
|
1613
1704
|
"baspiRef": "A3.4.4",
|
|
1614
1705
|
"RDSRef": "WorksAlterationsChanges/ConsentApproval",
|
|
1615
1706
|
"lawSocietyRef": "TA6/4.2",
|
|
1616
1707
|
"title": "Was any consent under a restriction in the deeds obtained? E.g. if your deeds require consent from someone else to alter or extend the property",
|
|
1617
|
-
"$ref": "#/$defs/
|
|
1708
|
+
"$ref": "#/$defs/yesNoNotRequiredDetailIfNo"
|
|
1618
1709
|
},
|
|
1619
1710
|
"unfinished": {
|
|
1620
1711
|
"baspiRef": "A3.5",
|
|
@@ -1671,11 +1762,13 @@
|
|
|
1671
1762
|
"firstName": {
|
|
1672
1763
|
"RDSRef": "",
|
|
1673
1764
|
"title": "First name",
|
|
1674
|
-
"type": "string"
|
|
1765
|
+
"type": "string",
|
|
1766
|
+
"minLength": 1
|
|
1675
1767
|
},
|
|
1676
1768
|
"lastName": {
|
|
1677
1769
|
"title": "Last name",
|
|
1678
|
-
"type": "string"
|
|
1770
|
+
"type": "string",
|
|
1771
|
+
"minLength": 1
|
|
1679
1772
|
},
|
|
1680
1773
|
"emailAddress": {
|
|
1681
1774
|
"title": "Email address",
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
"baspiRef": "B",
|
|
8
8
|
"required": [
|
|
9
9
|
"namesOfLegalOwners",
|
|
10
|
-
"sellersConveyancer",
|
|
11
10
|
"sellersCapacity",
|
|
12
11
|
"legalBoundaries",
|
|
13
12
|
"servicesCrossing",
|
|
@@ -33,7 +32,8 @@
|
|
|
33
32
|
"firstName": {
|
|
34
33
|
"baspiRef": "B1.1.1",
|
|
35
34
|
"title": "First name",
|
|
36
|
-
"type": "string"
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
37
|
},
|
|
38
38
|
"middleNames": {
|
|
39
39
|
"baspiRef": "B1.1.2",
|
|
@@ -43,53 +43,12 @@
|
|
|
43
43
|
"lastName": {
|
|
44
44
|
"baspiRef": "B1.1.3",
|
|
45
45
|
"title": "Last name",
|
|
46
|
-
"type": "string"
|
|
46
|
+
"type": "string",
|
|
47
|
+
"minLength": 1
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
|
-
"sellersConveyancer": {
|
|
52
|
-
"baspiRef": "B1.2",
|
|
53
|
-
"RDSRef": "Participants/description=?,Participants/ActingFor/Participants/Role",
|
|
54
|
-
"title": "Sellers Conveyancer",
|
|
55
|
-
"type": "object",
|
|
56
|
-
"required": [
|
|
57
|
-
"firstName",
|
|
58
|
-
"lastName",
|
|
59
|
-
"address",
|
|
60
|
-
"email",
|
|
61
|
-
"organisation",
|
|
62
|
-
"reference"
|
|
63
|
-
],
|
|
64
|
-
"properties": {
|
|
65
|
-
"firstName": {
|
|
66
|
-
"title": "First name",
|
|
67
|
-
"type": "string"
|
|
68
|
-
},
|
|
69
|
-
"lastName": {
|
|
70
|
-
"title": "Last name",
|
|
71
|
-
"type": "string"
|
|
72
|
-
},
|
|
73
|
-
"email": {
|
|
74
|
-
"title": "Email address",
|
|
75
|
-
"type": "string",
|
|
76
|
-
"format": "email"
|
|
77
|
-
},
|
|
78
|
-
"organisation": {
|
|
79
|
-
"title": "Organisation",
|
|
80
|
-
"type": "string"
|
|
81
|
-
},
|
|
82
|
-
"address": {
|
|
83
|
-
"title": "Address",
|
|
84
|
-
"$ref": "#/$defs/address"
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
"reference": {
|
|
88
|
-
"title": "Reference",
|
|
89
|
-
"type": "string"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
52
|
"sellersCapacity": {
|
|
94
53
|
"baspiRef": "B1.3",
|
|
95
54
|
"RDSRef": "Participants/description=?,Participants/ActingFor/Participants/Role",
|
|
@@ -118,7 +77,8 @@
|
|
|
118
77
|
"capacity": {
|
|
119
78
|
"enum": ["Legal Owner", "Mortgagee in Possession"]
|
|
120
79
|
}
|
|
121
|
-
}
|
|
80
|
+
},
|
|
81
|
+
"additionalProperties": false
|
|
122
82
|
},
|
|
123
83
|
{
|
|
124
84
|
"properties": {
|
|
@@ -301,6 +261,7 @@
|
|
|
301
261
|
"enum": ["Yes", "No"]
|
|
302
262
|
}
|
|
303
263
|
},
|
|
264
|
+
"required": ["hasSolarPanels"],
|
|
304
265
|
"dependencies": {
|
|
305
266
|
"hasSolarPanels": {
|
|
306
267
|
"oneOf": [
|
|
@@ -309,7 +270,8 @@
|
|
|
309
270
|
"hasSolarPanels": {
|
|
310
271
|
"enum": ["No"]
|
|
311
272
|
}
|
|
312
|
-
}
|
|
273
|
+
},
|
|
274
|
+
"additionalProperties": false
|
|
313
275
|
},
|
|
314
276
|
{
|
|
315
277
|
"properties": {
|
|
@@ -598,7 +560,6 @@
|
|
|
598
560
|
"type": "object",
|
|
599
561
|
"required": [
|
|
600
562
|
"sellerLivesAtProperty",
|
|
601
|
-
"otherOver17sAtProperty",
|
|
602
563
|
"over17sWillSignToConfirmWillVacate"
|
|
603
564
|
],
|
|
604
565
|
"properties": {
|
|
@@ -963,7 +924,8 @@
|
|
|
963
924
|
"properties": {
|
|
964
925
|
"line1": {
|
|
965
926
|
"title": "Address 1",
|
|
966
|
-
"type": "string"
|
|
927
|
+
"type": "string",
|
|
928
|
+
"minLength": 1
|
|
967
929
|
},
|
|
968
930
|
"line2": {
|
|
969
931
|
"title": "Address 2",
|
|
@@ -979,7 +941,8 @@
|
|
|
979
941
|
},
|
|
980
942
|
"postcode": {
|
|
981
943
|
"title": "Postcode",
|
|
982
|
-
"type": "string"
|
|
944
|
+
"type": "string",
|
|
945
|
+
"minLength": 1
|
|
983
946
|
}
|
|
984
947
|
},
|
|
985
948
|
"required": ["line1", "postcode"]
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"properties": {
|
|
41
41
|
"firstName": {
|
|
42
42
|
"title": "First name",
|
|
43
|
-
"type": "string"
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
44
45
|
},
|
|
45
46
|
"middleName": {
|
|
46
47
|
"title": "Middle name(s)",
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
},
|
|
49
50
|
"lastName": {
|
|
50
51
|
"title": "lastName",
|
|
51
|
-
"type": "string"
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
52
54
|
},
|
|
53
55
|
"preferredName": {
|
|
54
56
|
"title": "Preferred name / known as",
|
|
@@ -93,6 +95,9 @@
|
|
|
93
95
|
"Buyer's Conveyancer",
|
|
94
96
|
"Estate Agent"
|
|
95
97
|
]
|
|
98
|
+
},
|
|
99
|
+
"externalIds": {
|
|
100
|
+
"type": "object"
|
|
96
101
|
}
|
|
97
102
|
}
|
|
98
103
|
}
|
|
@@ -7,7 +7,6 @@ const {
|
|
|
7
7
|
isPathValid,
|
|
8
8
|
getSubschemaValidator,
|
|
9
9
|
getTitleAtPath,
|
|
10
|
-
validateVerifiedClaims
|
|
11
10
|
} = require("../../index.js");
|
|
12
11
|
const exampleTransaction = require("../examples/exampleTransaction.json");
|
|
13
12
|
|
|
@@ -183,274 +182,3 @@ test("correctly gets titles across schemas, arrays and non-existient title prope
|
|
|
183
182
|
)
|
|
184
183
|
).toBe("Current energy rating");
|
|
185
184
|
});
|
|
186
|
-
|
|
187
|
-
test("returns an array with an error stating if path is incorrect", () => {
|
|
188
|
-
const vClaims = [
|
|
189
|
-
{
|
|
190
|
-
verification: {
|
|
191
|
-
trust_framework: "uk_pdtf",
|
|
192
|
-
time: "2022-01-25T13:16:44.527Z",
|
|
193
|
-
evidence: [
|
|
194
|
-
{
|
|
195
|
-
verification_method: {
|
|
196
|
-
type: "auth",
|
|
197
|
-
},
|
|
198
|
-
type: "vouch",
|
|
199
|
-
attestation: {
|
|
200
|
-
voucher: {
|
|
201
|
-
name: "Maria Harris",
|
|
202
|
-
},
|
|
203
|
-
type: "digital_attestation",
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
type: "document",
|
|
208
|
-
attachments: [
|
|
209
|
-
{
|
|
210
|
-
digest: {
|
|
211
|
-
alg: "md5",
|
|
212
|
-
value: "randomHashValue",
|
|
213
|
-
},
|
|
214
|
-
url: "https://fakeFileStore.com/some/kind/of/file",
|
|
215
|
-
desc: "proofOfAddress.pdf",
|
|
216
|
-
},
|
|
217
|
-
],
|
|
218
|
-
},
|
|
219
|
-
],
|
|
220
|
-
},
|
|
221
|
-
claims: {
|
|
222
|
-
"/propertyPack/INVALID/materialFacts/councilTax": {
|
|
223
|
-
councilTaxBand: "D",
|
|
224
|
-
councilTaxAffectingAlterations: {
|
|
225
|
-
yesNo: "Yes",
|
|
226
|
-
details:
|
|
227
|
-
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
];
|
|
233
|
-
expect(validateVerifiedClaims(vClaims)).toEqual([
|
|
234
|
-
"Path /propertyPack/INVALID/materialFacts/councilTax is not a valid PDTF schema path",
|
|
235
|
-
]);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
test("returns an empty array if path is correct", () => {
|
|
239
|
-
const vClaims = [
|
|
240
|
-
{
|
|
241
|
-
verification: {
|
|
242
|
-
trust_framework: "uk_pdtf",
|
|
243
|
-
time: "2022-01-25T13:16:44.527Z",
|
|
244
|
-
evidence: [
|
|
245
|
-
{
|
|
246
|
-
verification_method: {
|
|
247
|
-
type: "auth",
|
|
248
|
-
},
|
|
249
|
-
type: "vouch",
|
|
250
|
-
attestation: {
|
|
251
|
-
voucher: {
|
|
252
|
-
name: "Maria Harris",
|
|
253
|
-
},
|
|
254
|
-
type: "digital_attestation",
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
type: "document",
|
|
259
|
-
attachments: [
|
|
260
|
-
{
|
|
261
|
-
digest: {
|
|
262
|
-
alg: "md5",
|
|
263
|
-
value: "randomHashValue",
|
|
264
|
-
},
|
|
265
|
-
url: "https://fakeFileStore.com/some/kind/of/file",
|
|
266
|
-
desc: "proofOfAddress.pdf",
|
|
267
|
-
},
|
|
268
|
-
],
|
|
269
|
-
},
|
|
270
|
-
],
|
|
271
|
-
},
|
|
272
|
-
claims: {
|
|
273
|
-
"/propertyPack/materialFacts/councilTax": {
|
|
274
|
-
councilTaxBand: "D",
|
|
275
|
-
councilTaxAffectingAlterations: {
|
|
276
|
-
yesNo: "Yes",
|
|
277
|
-
details:
|
|
278
|
-
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
];
|
|
284
|
-
expect(validateVerifiedClaims(vClaims)).toEqual([]);
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
test("returns an array of errors if data in the path is in invalid format", () => {
|
|
288
|
-
const vClaims = [
|
|
289
|
-
{
|
|
290
|
-
verification: {
|
|
291
|
-
trust_framework: "uk_pdtf",
|
|
292
|
-
time: "2022-01-25T13:16:44.527Z",
|
|
293
|
-
evidence: [
|
|
294
|
-
{
|
|
295
|
-
verification_method: {
|
|
296
|
-
type: "auth",
|
|
297
|
-
},
|
|
298
|
-
type: "vouch",
|
|
299
|
-
attestation: {
|
|
300
|
-
voucher: {
|
|
301
|
-
name: "Maria Harris",
|
|
302
|
-
},
|
|
303
|
-
type: "digital_attestation",
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
type: "document",
|
|
308
|
-
attachments: [
|
|
309
|
-
{
|
|
310
|
-
digest: {
|
|
311
|
-
alg: "md5",
|
|
312
|
-
value: "randomHashValue",
|
|
313
|
-
},
|
|
314
|
-
url: "https://fakeFileStore.com/some/kind/of/file",
|
|
315
|
-
desc: "proofOfAddress.pdf",
|
|
316
|
-
},
|
|
317
|
-
],
|
|
318
|
-
},
|
|
319
|
-
],
|
|
320
|
-
},
|
|
321
|
-
claims: {
|
|
322
|
-
"/propertyPack/materialFacts/councilTax": {
|
|
323
|
-
councilTaxBand: "D",
|
|
324
|
-
councilTaxAffectingAlterationsINVALID: {
|
|
325
|
-
yesNo: "Yes",
|
|
326
|
-
details:
|
|
327
|
-
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
];
|
|
333
|
-
expect(validateVerifiedClaims(vClaims)).toEqual([
|
|
334
|
-
{
|
|
335
|
-
instancePath: "",
|
|
336
|
-
schemaPath: "#/required",
|
|
337
|
-
keyword: "required",
|
|
338
|
-
params: { missingProperty: "councilTaxAffectingAlterations" },
|
|
339
|
-
message: "must have required property 'councilTaxAffectingAlterations'",
|
|
340
|
-
},
|
|
341
|
-
]);
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
test("returns an array of errors for verified claim with multiple paths", () => {
|
|
345
|
-
const vClaims = [
|
|
346
|
-
{
|
|
347
|
-
verification: {
|
|
348
|
-
trust_framework: "uk_pdtf",
|
|
349
|
-
time: "2022-01-25T13:16:44.527Z",
|
|
350
|
-
evidence: [
|
|
351
|
-
{
|
|
352
|
-
verification_method: {
|
|
353
|
-
type: "auth",
|
|
354
|
-
},
|
|
355
|
-
type: "vouch",
|
|
356
|
-
attestation: {
|
|
357
|
-
voucher: {
|
|
358
|
-
name: "Maria Harris",
|
|
359
|
-
},
|
|
360
|
-
type: "digital_attestation",
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
type: "document",
|
|
365
|
-
attachments: [
|
|
366
|
-
{
|
|
367
|
-
digest: {
|
|
368
|
-
alg: "md5",
|
|
369
|
-
value: "randomHashValue",
|
|
370
|
-
},
|
|
371
|
-
url: "https://fakeFileStore.com/some/kind/of/file",
|
|
372
|
-
desc: "proofOfAddress.pdf",
|
|
373
|
-
},
|
|
374
|
-
],
|
|
375
|
-
},
|
|
376
|
-
],
|
|
377
|
-
},
|
|
378
|
-
claims: {
|
|
379
|
-
"/propertyPack/materialFacts/cousncilTaxBad": {
|
|
380
|
-
councilTaxBand: "D",
|
|
381
|
-
councilTaxAffectingAlterations: {
|
|
382
|
-
yesNo: "Yes",
|
|
383
|
-
details:
|
|
384
|
-
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
385
|
-
},
|
|
386
|
-
},
|
|
387
|
-
"/propertyPack/materialFacts/councilTaxBadTwo": {
|
|
388
|
-
councilTaxBand: "D",
|
|
389
|
-
councilTaxAffectingAlterations: {
|
|
390
|
-
yesNo: "Yes",
|
|
391
|
-
details:
|
|
392
|
-
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
];
|
|
398
|
-
expect(validateVerifiedClaims(vClaims)).toEqual(["Path /propertyPack/materialFacts/cousncilTaxBad is not a valid PDTF schema path",
|
|
399
|
-
"Path /propertyPack/materialFacts/councilTaxBadTwo is not a valid PDTF schema path"]);
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
test("returns an empty array of errors for verified claim with multiple paths", () => {
|
|
403
|
-
const vClaims = [
|
|
404
|
-
{
|
|
405
|
-
verification: {
|
|
406
|
-
trust_framework: "uk_pdtf",
|
|
407
|
-
time: "2022-01-25T13:16:44.527Z",
|
|
408
|
-
evidence: [
|
|
409
|
-
{
|
|
410
|
-
verification_method: {
|
|
411
|
-
type: "auth",
|
|
412
|
-
},
|
|
413
|
-
type: "vouch",
|
|
414
|
-
attestation: {
|
|
415
|
-
voucher: {
|
|
416
|
-
name: "Maria Harris",
|
|
417
|
-
},
|
|
418
|
-
type: "digital_attestation",
|
|
419
|
-
},
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
type: "document",
|
|
423
|
-
attachments: [
|
|
424
|
-
{
|
|
425
|
-
digest: {
|
|
426
|
-
alg: "md5",
|
|
427
|
-
value: "randomHashValue",
|
|
428
|
-
},
|
|
429
|
-
url: "https://fakeFileStore.com/some/kind/of/file",
|
|
430
|
-
desc: "proofOfAddress.pdf",
|
|
431
|
-
},
|
|
432
|
-
],
|
|
433
|
-
},
|
|
434
|
-
],
|
|
435
|
-
},
|
|
436
|
-
claims: {
|
|
437
|
-
"/propertyPack/materialFacts/councilTax": {
|
|
438
|
-
councilTaxBand: "D",
|
|
439
|
-
councilTaxAffectingAlterations: {
|
|
440
|
-
yesNo: "Yes",
|
|
441
|
-
details:
|
|
442
|
-
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
443
|
-
},
|
|
444
|
-
},
|
|
445
|
-
"/propertyPack/materialFacts/address": {
|
|
446
|
-
line1: "property.line1",
|
|
447
|
-
line2: "property.line2",
|
|
448
|
-
town: "property.city",
|
|
449
|
-
county: "property.province",
|
|
450
|
-
postcode: "property.postcode",
|
|
451
|
-
},
|
|
452
|
-
},
|
|
453
|
-
},
|
|
454
|
-
];
|
|
455
|
-
expect(validateVerifiedClaims(vClaims)).toEqual([]);
|
|
456
|
-
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const { validateVerifiedClaims } = require("../../index.js");
|
|
2
|
+
|
|
3
|
+
const exampleVouch = require("../examples/exampleVouch.json");
|
|
4
|
+
const exampleDocumentedVouch = require("../examples/exampleDocumentedVouch.json");
|
|
5
|
+
|
|
6
|
+
test("returns an empty array for a valid claim", () => {
|
|
7
|
+
expect(validateVerifiedClaims(exampleVouch)).toEqual([]);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test("returns an empty array for a valid array of claims", () => {
|
|
11
|
+
const claimsArray = [exampleVouch, exampleDocumentedVouch];
|
|
12
|
+
expect(validateVerifiedClaims(claimsArray)).toEqual([]);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("returns an array with an error stating if path is incorrect", () => {
|
|
16
|
+
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
17
|
+
const originalPath = Object.keys(clonedVouch.claims)[0];
|
|
18
|
+
const data = clonedVouch.claims[originalPath];
|
|
19
|
+
clonedVouch.claims = {
|
|
20
|
+
"/propertyPack/INVALID/materialFacts/councilTax": data,
|
|
21
|
+
};
|
|
22
|
+
expect(validateVerifiedClaims(clonedVouch)).toEqual([
|
|
23
|
+
"Path /propertyPack/INVALID/materialFacts/councilTax is not a valid PDTF schema path",
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("returns an array of errors if data in the path is in invalid format", () => {
|
|
28
|
+
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
29
|
+
clonedVouch.claims = {
|
|
30
|
+
"/propertyPack/materialFacts/councilTax": {
|
|
31
|
+
councilTaxBand: "D",
|
|
32
|
+
councilTaxAffectingAlterationsINVALID: {
|
|
33
|
+
yesNo: "Yes",
|
|
34
|
+
details:
|
|
35
|
+
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
expect(validateVerifiedClaims(clonedVouch)).toEqual([
|
|
40
|
+
{
|
|
41
|
+
instancePath: "",
|
|
42
|
+
schemaPath: "#/required",
|
|
43
|
+
keyword: "required",
|
|
44
|
+
params: { missingProperty: "councilTaxAffectingAlterations" },
|
|
45
|
+
message: "must have required property 'councilTaxAffectingAlterations'",
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("returns an array of errors for verified claim with multiple paths", () => {
|
|
51
|
+
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
52
|
+
clonedVouch.claims = {
|
|
53
|
+
"/propertyPack/materialFacts/cousncilTaxBad": {
|
|
54
|
+
councilTaxBand: "D",
|
|
55
|
+
councilTaxAffectingAlterations: {
|
|
56
|
+
yesNo: "Yes",
|
|
57
|
+
details:
|
|
58
|
+
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
"/propertyPack/materialFacts/councilTaxBadTwo": {
|
|
62
|
+
councilTaxBand: "D",
|
|
63
|
+
councilTaxAffectingAlterations: {
|
|
64
|
+
yesNo: "Yes",
|
|
65
|
+
details:
|
|
66
|
+
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
expect(validateVerifiedClaims(clonedVouch)).toEqual([
|
|
71
|
+
"Path /propertyPack/materialFacts/cousncilTaxBad is not a valid PDTF schema path",
|
|
72
|
+
"Path /propertyPack/materialFacts/councilTaxBadTwo is not a valid PDTF schema path",
|
|
73
|
+
]);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("returns an empty array of errors for verified claim with multiple valid paths", () => {
|
|
77
|
+
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
78
|
+
clonedVouch.claims = {
|
|
79
|
+
"/propertyPack/materialFacts/councilTax": {
|
|
80
|
+
councilTaxBand: "D",
|
|
81
|
+
councilTaxAffectingAlterations: {
|
|
82
|
+
yesNo: "Yes",
|
|
83
|
+
details:
|
|
84
|
+
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
"/propertyPack/materialFacts/address": {
|
|
88
|
+
line1: "property.line1",
|
|
89
|
+
line2: "property.line2",
|
|
90
|
+
town: "property.city",
|
|
91
|
+
county: "property.province",
|
|
92
|
+
postcode: "property.postcode",
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
expect(validateVerifiedClaims(clonedVouch)).toEqual([]);
|
|
96
|
+
});
|