@pdtf/schemas 3.0.0-1 → 3.0.0-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 +15 -13
- package/package.json +1 -1
- package/src/examples/v3/exampleTransaction.json +23 -22
- package/src/schemas/v2/overlays/baspi.json +510 -2331
- package/src/schemas/v2/overlays/con29DW.json +36 -125
- package/src/schemas/v2/overlays/con29R.json +5 -143
- package/src/schemas/v2/overlays/fme1.json +48 -233
- package/src/schemas/v2/overlays/lpe1.json +75 -367
- package/src/schemas/v2/overlays/nts.json +17 -103
- package/src/schemas/v2/overlays/piq.json +146 -693
- package/src/schemas/v2/overlays/rds.json +50 -316
- package/src/schemas/v2/overlays/ta10.json +540 -1755
- package/src/schemas/v2/overlays/ta6.json +241 -1193
- package/src/schemas/v2/overlays/ta7.json +106 -440
- package/src/schemas/v3/combined.json +762 -683
- package/src/schemas/v3/overlays/baspi.json +662 -2571
- package/src/schemas/v3/overlays/con29DW.json +46 -127
- package/src/schemas/v3/overlays/con29R.json +5 -143
- package/src/schemas/v3/overlays/fme1.json +53 -233
- package/src/schemas/v3/overlays/lpe1.json +85 -367
- package/src/schemas/v3/overlays/nts.json +493 -475
- package/src/schemas/v3/overlays/piq.json +225 -827
- package/src/schemas/v3/overlays/rds.json +172 -541
- package/src/schemas/v3/overlays/ta10.json +540 -1755
- package/src/schemas/v3/overlays/ta6.json +346 -1271
- package/src/schemas/v3/overlays/ta7.json +220 -462
- package/src/schemas/v3/pdtf-transaction.json +628 -600
- package/src/schemas/v3/skeleton.json +92 -67
- package/src/tests/v3/transactionSchema.test.js +27 -17
- package/src/tests/v3/verifiedClaimsValidator.test.js +2 -2
- package/src/utils/extractOverlay.js +5 -27
- package/src/tests/v2/transactionSchema.test.js +0 -361
- package/src/tests/v2/verifiedClaimsValidator.test.js +0 -128
|
@@ -34,10 +34,6 @@
|
|
|
34
34
|
"postcode": {}
|
|
35
35
|
},
|
|
36
36
|
"uprn": {},
|
|
37
|
-
"propertyType": {},
|
|
38
|
-
"isNewBuild": {
|
|
39
|
-
"yesNo": {}
|
|
40
|
-
},
|
|
41
37
|
"location": {
|
|
42
38
|
"latitude": {},
|
|
43
39
|
"longitude": {},
|
|
@@ -72,18 +68,38 @@
|
|
|
72
68
|
"caption": {}
|
|
73
69
|
},
|
|
74
70
|
"buildInformation": {
|
|
71
|
+
"building": {
|
|
72
|
+
"propertyType": {},
|
|
73
|
+
"otherType": {},
|
|
74
|
+
"builtForm": {},
|
|
75
|
+
"numberOfFloors": {},
|
|
76
|
+
"entranceFloor": {},
|
|
77
|
+
"hasLift": {},
|
|
78
|
+
"overCommercialPremises": {
|
|
79
|
+
"isLocatedOverCommercialPremises": {},
|
|
80
|
+
"details": {}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
75
83
|
"internalArea": {
|
|
76
84
|
"area": {},
|
|
77
85
|
"units": {}
|
|
78
86
|
},
|
|
79
87
|
"yearOfBuild": {},
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
"isNewBuild": {
|
|
89
|
+
"yesNo": {}
|
|
90
|
+
},
|
|
91
|
+
"roomDimensions": {
|
|
92
|
+
"hasFloorplan": {
|
|
93
|
+
"yesNo": {},
|
|
94
|
+
"rooms": {
|
|
95
|
+
"roomName": {},
|
|
96
|
+
"length": {},
|
|
97
|
+
"width": {},
|
|
98
|
+
"units": {},
|
|
99
|
+
"dimensionDetails": {},
|
|
100
|
+
"photoUrls": {}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
87
103
|
}
|
|
88
104
|
},
|
|
89
105
|
"residentialPropertyFeatures": {
|
|
@@ -2010,51 +2026,38 @@
|
|
|
2010
2026
|
"drainage": {
|
|
2011
2027
|
"mainsSurfaceWaterDrainage": {
|
|
2012
2028
|
"yesNo": {},
|
|
2013
|
-
"supplier": {},
|
|
2014
2029
|
"details": {},
|
|
2015
2030
|
"dateToBeConnected": {}
|
|
2016
2031
|
},
|
|
2017
2032
|
"mainsFoulDrainage": {
|
|
2018
2033
|
"yesNo": {},
|
|
2019
|
-
"supplier": {},
|
|
2020
2034
|
"details": {},
|
|
2021
2035
|
"dateToBeConnected": {},
|
|
2022
|
-
"
|
|
2023
|
-
|
|
2024
|
-
"
|
|
2025
|
-
"
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2036
|
+
"supplier": {},
|
|
2037
|
+
"offMainsDrainageSystem": {
|
|
2038
|
+
"offMainsDrainageSystemType": {},
|
|
2039
|
+
"otherConnectedProperties": {
|
|
2040
|
+
"yesNo": {},
|
|
2041
|
+
"numberOfPropertiesSharing": {},
|
|
2042
|
+
"details": {}
|
|
2043
|
+
},
|
|
2044
|
+
"plantOnOtherLand": {
|
|
2045
|
+
"yesNo": {},
|
|
2046
|
+
"attachments": {}
|
|
2047
|
+
},
|
|
2048
|
+
"plantRegistered": {
|
|
2049
|
+
"yesNo": {},
|
|
2050
|
+
"attachments": {}
|
|
2051
|
+
},
|
|
2052
|
+
"plantDrainsIntoWaterway": {
|
|
2053
|
+
"yesNo": {},
|
|
2054
|
+
"dischargeCompliesWithGBR": {}
|
|
2055
|
+
},
|
|
2029
2056
|
"dateReplaced": {},
|
|
2030
|
-
"dateLastEmptied": {}
|
|
2031
|
-
},
|
|
2032
|
-
"cesspit": {
|
|
2033
|
-
"yesNo": {},
|
|
2034
|
-
"dateLastEmptied": {}
|
|
2035
|
-
},
|
|
2036
|
-
"sewerageTreatmentPlant": {
|
|
2037
|
-
"yesNo": {},
|
|
2057
|
+
"dateLastEmptied": {},
|
|
2038
2058
|
"dateInstalled": {},
|
|
2039
2059
|
"dateLastServiced": {},
|
|
2040
2060
|
"attachments": {}
|
|
2041
|
-
},
|
|
2042
|
-
"otherConnectedProperties": {
|
|
2043
|
-
"yesNo": {},
|
|
2044
|
-
"numberOfPropertiesSharing": {},
|
|
2045
|
-
"details": {}
|
|
2046
|
-
},
|
|
2047
|
-
"plantOnOtherLand": {
|
|
2048
|
-
"yesNo": {},
|
|
2049
|
-
"attachments": {}
|
|
2050
|
-
},
|
|
2051
|
-
"plantRegistered": {
|
|
2052
|
-
"yesNo": {},
|
|
2053
|
-
"attachments": {}
|
|
2054
|
-
},
|
|
2055
|
-
"plantDrainsIntoWaterway": {
|
|
2056
|
-
"yesNo": {},
|
|
2057
|
-
"dischargeCompliesWithGBR": {}
|
|
2058
2061
|
}
|
|
2059
2062
|
},
|
|
2060
2063
|
"surfaceDrainageCharge": {
|
|
@@ -2226,15 +2229,17 @@
|
|
|
2226
2229
|
"environmentalIssues": {
|
|
2227
2230
|
"flooding": {
|
|
2228
2231
|
"floodRisk": {
|
|
2229
|
-
"
|
|
2232
|
+
"riskIndicator": {},
|
|
2230
2233
|
"actionAlertRating": {},
|
|
2234
|
+
"result": {},
|
|
2231
2235
|
"summary": {},
|
|
2232
2236
|
"recommendations": {},
|
|
2233
2237
|
"datasetAttribution": {},
|
|
2234
2238
|
"riskSubcategories": {
|
|
2235
2239
|
"subCategory": {},
|
|
2236
|
-
"
|
|
2240
|
+
"riskIndicator": {},
|
|
2237
2241
|
"actionAlertRating": {},
|
|
2242
|
+
"result": {},
|
|
2238
2243
|
"summary": {},
|
|
2239
2244
|
"recommendations": {},
|
|
2240
2245
|
"datasetAttribution": {}
|
|
@@ -2246,15 +2251,17 @@
|
|
|
2246
2251
|
},
|
|
2247
2252
|
"radon": {
|
|
2248
2253
|
"radonRisk": {
|
|
2249
|
-
"
|
|
2254
|
+
"riskIndicator": {},
|
|
2250
2255
|
"actionAlertRating": {},
|
|
2256
|
+
"result": {},
|
|
2251
2257
|
"summary": {},
|
|
2252
2258
|
"recommendations": {},
|
|
2253
2259
|
"datasetAttribution": {},
|
|
2254
2260
|
"riskSubcategories": {
|
|
2255
2261
|
"subCategory": {},
|
|
2256
|
-
"
|
|
2262
|
+
"riskIndicator": {},
|
|
2257
2263
|
"actionAlertRating": {},
|
|
2264
|
+
"result": {},
|
|
2258
2265
|
"summary": {},
|
|
2259
2266
|
"recommendations": {},
|
|
2260
2267
|
"datasetAttribution": {}
|
|
@@ -2271,15 +2278,17 @@
|
|
|
2271
2278
|
},
|
|
2272
2279
|
"contaminatedLand": {
|
|
2273
2280
|
"contaminatedLandRisk": {
|
|
2274
|
-
"
|
|
2281
|
+
"riskIndicator": {},
|
|
2275
2282
|
"actionAlertRating": {},
|
|
2283
|
+
"result": {},
|
|
2276
2284
|
"summary": {},
|
|
2277
2285
|
"recommendations": {},
|
|
2278
2286
|
"datasetAttribution": {},
|
|
2279
2287
|
"riskSubcategories": {
|
|
2280
2288
|
"subCategory": {},
|
|
2281
|
-
"
|
|
2289
|
+
"riskIndicator": {},
|
|
2282
2290
|
"actionAlertRating": {},
|
|
2291
|
+
"result": {},
|
|
2283
2292
|
"summary": {},
|
|
2284
2293
|
"recommendations": {},
|
|
2285
2294
|
"datasetAttribution": {}
|
|
@@ -2288,15 +2297,17 @@
|
|
|
2288
2297
|
},
|
|
2289
2298
|
"groundStability": {
|
|
2290
2299
|
"groundStabilityRisk": {
|
|
2291
|
-
"
|
|
2300
|
+
"riskIndicator": {},
|
|
2292
2301
|
"actionAlertRating": {},
|
|
2302
|
+
"result": {},
|
|
2293
2303
|
"summary": {},
|
|
2294
2304
|
"recommendations": {},
|
|
2295
2305
|
"datasetAttribution": {},
|
|
2296
2306
|
"riskSubcategories": {
|
|
2297
2307
|
"subCategory": {},
|
|
2298
|
-
"
|
|
2308
|
+
"riskIndicator": {},
|
|
2299
2309
|
"actionAlertRating": {},
|
|
2310
|
+
"result": {},
|
|
2300
2311
|
"summary": {},
|
|
2301
2312
|
"recommendations": {},
|
|
2302
2313
|
"datasetAttribution": {}
|
|
@@ -2305,15 +2316,17 @@
|
|
|
2305
2316
|
},
|
|
2306
2317
|
"energy": {
|
|
2307
2318
|
"energyRisk": {
|
|
2308
|
-
"
|
|
2319
|
+
"riskIndicator": {},
|
|
2309
2320
|
"actionAlertRating": {},
|
|
2321
|
+
"result": {},
|
|
2310
2322
|
"summary": {},
|
|
2311
2323
|
"recommendations": {},
|
|
2312
2324
|
"datasetAttribution": {},
|
|
2313
2325
|
"riskSubcategories": {
|
|
2314
2326
|
"subCategory": {},
|
|
2315
|
-
"
|
|
2327
|
+
"riskIndicator": {},
|
|
2316
2328
|
"actionAlertRating": {},
|
|
2329
|
+
"result": {},
|
|
2317
2330
|
"summary": {},
|
|
2318
2331
|
"recommendations": {},
|
|
2319
2332
|
"datasetAttribution": {}
|
|
@@ -2322,15 +2335,17 @@
|
|
|
2322
2335
|
},
|
|
2323
2336
|
"transportation": {
|
|
2324
2337
|
"transportationRisk": {
|
|
2325
|
-
"
|
|
2338
|
+
"riskIndicator": {},
|
|
2326
2339
|
"actionAlertRating": {},
|
|
2340
|
+
"result": {},
|
|
2327
2341
|
"summary": {},
|
|
2328
2342
|
"recommendations": {},
|
|
2329
2343
|
"datasetAttribution": {},
|
|
2330
2344
|
"riskSubcategories": {
|
|
2331
2345
|
"subCategory": {},
|
|
2332
|
-
"
|
|
2346
|
+
"riskIndicator": {},
|
|
2333
2347
|
"actionAlertRating": {},
|
|
2348
|
+
"result": {},
|
|
2334
2349
|
"summary": {},
|
|
2335
2350
|
"recommendations": {},
|
|
2336
2351
|
"datasetAttribution": {}
|
|
@@ -2339,15 +2354,17 @@
|
|
|
2339
2354
|
},
|
|
2340
2355
|
"planning": {
|
|
2341
2356
|
"planningRisk": {
|
|
2342
|
-
"
|
|
2357
|
+
"riskIndicator": {},
|
|
2343
2358
|
"actionAlertRating": {},
|
|
2359
|
+
"result": {},
|
|
2344
2360
|
"summary": {},
|
|
2345
2361
|
"recommendations": {},
|
|
2346
2362
|
"datasetAttribution": {},
|
|
2347
2363
|
"riskSubcategories": {
|
|
2348
2364
|
"subCategory": {},
|
|
2349
|
-
"
|
|
2365
|
+
"riskIndicator": {},
|
|
2350
2366
|
"actionAlertRating": {},
|
|
2367
|
+
"result": {},
|
|
2351
2368
|
"summary": {},
|
|
2352
2369
|
"recommendations": {},
|
|
2353
2370
|
"datasetAttribution": {}
|
|
@@ -2356,15 +2373,17 @@
|
|
|
2356
2373
|
},
|
|
2357
2374
|
"climate": {
|
|
2358
2375
|
"climateRisk": {
|
|
2359
|
-
"
|
|
2376
|
+
"riskIndicator": {},
|
|
2360
2377
|
"actionAlertRating": {},
|
|
2378
|
+
"result": {},
|
|
2361
2379
|
"summary": {},
|
|
2362
2380
|
"recommendations": {},
|
|
2363
2381
|
"datasetAttribution": {},
|
|
2364
2382
|
"riskSubcategories": {
|
|
2365
2383
|
"subCategory": {},
|
|
2366
|
-
"
|
|
2384
|
+
"riskIndicator": {},
|
|
2367
2385
|
"actionAlertRating": {},
|
|
2386
|
+
"result": {},
|
|
2368
2387
|
"summary": {},
|
|
2369
2388
|
"recommendations": {},
|
|
2370
2389
|
"datasetAttribution": {}
|
|
@@ -2372,45 +2391,51 @@
|
|
|
2372
2391
|
}
|
|
2373
2392
|
},
|
|
2374
2393
|
"coalMining": {
|
|
2375
|
-
"
|
|
2394
|
+
"riskIndicator": {},
|
|
2376
2395
|
"actionAlertRating": {},
|
|
2396
|
+
"result": {},
|
|
2377
2397
|
"summary": {},
|
|
2378
2398
|
"recommendations": {},
|
|
2379
2399
|
"datasetAttribution": {},
|
|
2380
2400
|
"riskSubcategories": {
|
|
2381
2401
|
"subCategory": {},
|
|
2382
|
-
"
|
|
2402
|
+
"riskIndicator": {},
|
|
2383
2403
|
"actionAlertRating": {},
|
|
2404
|
+
"result": {},
|
|
2384
2405
|
"summary": {},
|
|
2385
2406
|
"recommendations": {},
|
|
2386
2407
|
"datasetAttribution": {}
|
|
2387
2408
|
}
|
|
2388
2409
|
},
|
|
2389
2410
|
"nonCoalMining": {
|
|
2390
|
-
"
|
|
2411
|
+
"riskIndicator": {},
|
|
2391
2412
|
"actionAlertRating": {},
|
|
2413
|
+
"result": {},
|
|
2392
2414
|
"summary": {},
|
|
2393
2415
|
"recommendations": {},
|
|
2394
2416
|
"datasetAttribution": {},
|
|
2395
2417
|
"riskSubcategories": {
|
|
2396
2418
|
"subCategory": {},
|
|
2397
|
-
"
|
|
2419
|
+
"riskIndicator": {},
|
|
2398
2420
|
"actionAlertRating": {},
|
|
2421
|
+
"result": {},
|
|
2399
2422
|
"summary": {},
|
|
2400
2423
|
"recommendations": {},
|
|
2401
2424
|
"datasetAttribution": {}
|
|
2402
2425
|
}
|
|
2403
2426
|
},
|
|
2404
2427
|
"coastalErosion": {
|
|
2405
|
-
"
|
|
2428
|
+
"riskIndicator": {},
|
|
2406
2429
|
"actionAlertRating": {},
|
|
2430
|
+
"result": {},
|
|
2407
2431
|
"summary": {},
|
|
2408
2432
|
"recommendations": {},
|
|
2409
2433
|
"datasetAttribution": {},
|
|
2410
2434
|
"riskSubcategories": {
|
|
2411
2435
|
"subCategory": {},
|
|
2412
|
-
"
|
|
2436
|
+
"riskIndicator": {},
|
|
2413
2437
|
"actionAlertRating": {},
|
|
2438
|
+
"result": {},
|
|
2414
2439
|
"summary": {},
|
|
2415
2440
|
"recommendations": {},
|
|
2416
2441
|
"datasetAttribution": {}
|
|
@@ -11,23 +11,24 @@ const {
|
|
|
11
11
|
} = require("../../../index.js");
|
|
12
12
|
|
|
13
13
|
const exampleTransaction = require("../../examples/v3/exampleTransaction.json");
|
|
14
|
+
|
|
14
15
|
const schemaId =
|
|
15
16
|
"https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json";
|
|
16
17
|
// const validator = getValidator(schemaId);
|
|
17
18
|
const v3TransactionSchema = getTransactionSchema(schemaId);
|
|
18
19
|
|
|
19
|
-
test("exports a property pack schema, v3 with
|
|
20
|
-
const testSchema = getTransactionSchema();
|
|
21
|
-
expect(testSchema.$id).toEqual(
|
|
22
|
-
|
|
23
|
-
);
|
|
20
|
+
test("exports a property pack schema, v3 with no overlay by default", () => {
|
|
21
|
+
const testSchema = getTransactionSchema(schemaId);
|
|
22
|
+
// expect(testSchema.$id).toEqual(
|
|
23
|
+
// "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json"
|
|
24
|
+
// );
|
|
24
25
|
expect(
|
|
25
26
|
testSchema.properties.propertyPack.properties.materialFacts.baspiRef
|
|
26
|
-
).toEqual(
|
|
27
|
+
).toEqual(undefined);
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
test("sample is valid BASPI", () => {
|
|
30
|
-
const testSchema = getTransactionSchema();
|
|
31
|
+
const testSchema = getTransactionSchema(schemaId, ["baspiV4"]);
|
|
31
32
|
expect(
|
|
32
33
|
testSchema.properties.propertyPack.properties.materialFacts.baspiRef
|
|
33
34
|
).toEqual("A");
|
|
@@ -49,7 +50,7 @@ test("invalid sample is invalid", () => {
|
|
|
49
50
|
JSON.stringify(exampleTransaction)
|
|
50
51
|
);
|
|
51
52
|
delete clonedExampleTransaction.propertyPack.materialFacts.notices;
|
|
52
|
-
const validator = getValidator(schemaId);
|
|
53
|
+
const validator = getValidator(schemaId, ["baspiV4"]);
|
|
53
54
|
const isValid = validator(clonedExampleTransaction);
|
|
54
55
|
expect(isValid).toBe(false);
|
|
55
56
|
});
|
|
@@ -166,6 +167,15 @@ test("correctly gets yes another subschema but through a non-baspi oneOf structu
|
|
|
166
167
|
expect(subschema).toEqual({ type: "string" });
|
|
167
168
|
});
|
|
168
169
|
|
|
170
|
+
test("correctly gets an overlaid enum in a subschema", () => {
|
|
171
|
+
const subschema = getSubschema(
|
|
172
|
+
"/propertyPack/materialFacts/connectedUtilities/mainsElectricity/yesNo",
|
|
173
|
+
schemaId,
|
|
174
|
+
["nts2023"]
|
|
175
|
+
);
|
|
176
|
+
expect(subschema.enum).toEqual(["Yes", "No"]);
|
|
177
|
+
});
|
|
178
|
+
|
|
169
179
|
test("correctly gets a subschema with multiple overlays", () => {
|
|
170
180
|
const subschema = getSubschema(
|
|
171
181
|
"/propertyPack/materialFacts/parking/parkingArrangements",
|
|
@@ -194,7 +204,6 @@ test("correctly gets a subschema validator for a TA6 overlay", () => {
|
|
|
194
204
|
"ta6ed4",
|
|
195
205
|
]);
|
|
196
206
|
let isValid = validator(data);
|
|
197
|
-
// console.log(validator.errors);
|
|
198
207
|
expect(isValid).toBe(true);
|
|
199
208
|
});
|
|
200
209
|
|
|
@@ -267,14 +276,14 @@ test("correctly gets a subschema validator for an NTS overlay", () => {
|
|
|
267
276
|
expect(isValid).toBe(true);
|
|
268
277
|
});
|
|
269
278
|
|
|
270
|
-
test("correctly gets a subschema validator for an
|
|
279
|
+
test("correctly gets a subschema validator for an TA7 overlay", () => {
|
|
271
280
|
const path = "/propertyPack";
|
|
272
281
|
const clonedExampleTransaction = JSON.parse(
|
|
273
282
|
JSON.stringify(exampleTransaction)
|
|
274
283
|
);
|
|
275
284
|
const data = jp.get(clonedExampleTransaction, path);
|
|
276
285
|
const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
|
|
277
|
-
"
|
|
286
|
+
"ta7ed3",
|
|
278
287
|
]);
|
|
279
288
|
let isValid = validator(data);
|
|
280
289
|
expect(isValid).toBe(false);
|
|
@@ -299,48 +308,49 @@ test("correctly gets titles across schemas, arrays and non-existient title prope
|
|
|
299
308
|
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/ownershipType"
|
|
300
309
|
)
|
|
301
310
|
).toBe("What type of ownership is the property?");
|
|
311
|
+
|
|
302
312
|
expect(
|
|
303
313
|
getTitleAtPath(
|
|
304
314
|
v3TransactionSchema,
|
|
305
315
|
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/leaseholdInformation/leaseTerm/lengthOfLeaseInYears"
|
|
306
316
|
)
|
|
307
317
|
).toBe("Length of lease (years)");
|
|
308
|
-
|
|
309
|
-
getTitleAtPath(
|
|
310
|
-
v3TransactionSchema,
|
|
311
|
-
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/leaseholdInformation/serviceCharge/annualServiceCharge"
|
|
312
|
-
)
|
|
313
|
-
).toBe("Amount of current annual service charge (£)");
|
|
318
|
+
|
|
314
319
|
expect(
|
|
315
320
|
getTitleAtPath(
|
|
316
321
|
v3TransactionSchema,
|
|
317
322
|
"/propertyPack/materialFacts/invalidPath"
|
|
318
323
|
)
|
|
319
324
|
).toBe(undefined);
|
|
325
|
+
|
|
320
326
|
expect(
|
|
321
327
|
getTitleAtPath(
|
|
322
328
|
v3TransactionSchema,
|
|
323
329
|
"/propertyPack/titlesToBeSold/0/registerExtract"
|
|
324
330
|
)
|
|
325
331
|
).toBe("HMLR Official Copy Register Extract");
|
|
332
|
+
|
|
326
333
|
expect(
|
|
327
334
|
getTitleAtPath(
|
|
328
335
|
v3TransactionSchema,
|
|
329
336
|
"/propertyPack/titlesToBeSold/0/registerExtract/OCSummaryData/PropertyAddress"
|
|
330
337
|
)
|
|
331
338
|
).toBe("Property address");
|
|
339
|
+
|
|
332
340
|
expect(
|
|
333
341
|
getTitleAtPath(
|
|
334
342
|
v3TransactionSchema,
|
|
335
343
|
"/propertyPack/titlesToBeSold/0/registerExtract/OCSummaryData/InvalidProp"
|
|
336
344
|
)
|
|
337
345
|
).toBe(undefined);
|
|
346
|
+
|
|
338
347
|
expect(
|
|
339
348
|
getTitleAtPath(
|
|
340
349
|
v3TransactionSchema,
|
|
341
350
|
"/propertyPack/materialFacts/energyEfficiency/certificate/currentEnergyRating"
|
|
342
351
|
)
|
|
343
352
|
).toBe("Current energy efficiency rating");
|
|
353
|
+
|
|
344
354
|
expect(
|
|
345
355
|
getTitleAtPath(
|
|
346
356
|
v3TransactionSchema,
|
|
@@ -27,14 +27,14 @@ test("returns an array with an error stating if path is incorrect", () => {
|
|
|
27
27
|
]);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
test("returns errors if BASPI requirements are not met and BASPI overlay is specified
|
|
30
|
+
test("returns errors if BASPI requirements are not met and BASPI overlay is specified", () => {
|
|
31
31
|
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
32
32
|
clonedVouch.claims = {
|
|
33
33
|
"/propertyPack/materialFacts/delayFactors": {
|
|
34
34
|
hasDelayFactors: { yesNo: "Yes" },
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
-
const errors = validateVerifiedClaims([clonedVouch], v3SchemaId);
|
|
37
|
+
const errors = validateVerifiedClaims([clonedVouch], v3SchemaId, ["baspiV4"]);
|
|
38
38
|
expect(errors).toEqual([
|
|
39
39
|
{
|
|
40
40
|
instancePath: "/hasDelayFactors",
|
|
@@ -23,30 +23,15 @@ const extractFields = [
|
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
const overlayIncludeProperties = [
|
|
26
|
-
"title",
|
|
27
|
-
"description",
|
|
28
|
-
"enum",
|
|
26
|
+
// "title",
|
|
27
|
+
// "description",
|
|
28
|
+
// "enum",
|
|
29
29
|
"discriminator",
|
|
30
|
-
"minItems",
|
|
30
|
+
// "minItems",
|
|
31
31
|
];
|
|
32
32
|
|
|
33
|
-
const combineMerge = (target, source, options) => {
|
|
34
|
-
const destination = target.slice();
|
|
35
|
-
source.forEach((item, index) => {
|
|
36
|
-
if (typeof destination[index] === "undefined") {
|
|
37
|
-
destination[index] = options.cloneUnlessOtherwiseSpecified(item, options);
|
|
38
|
-
} else if (options.isMergeableObject(item)) {
|
|
39
|
-
destination[index] = merge(target[index], item, options);
|
|
40
|
-
} else if (target.indexOf(item) === -1) {
|
|
41
|
-
destination.push(item);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return destination;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
33
|
const flattenSkeleton = (schema) => {
|
|
48
34
|
if (!schema) return undefined;
|
|
49
|
-
// console.log(schema.properties);
|
|
50
35
|
let returnStructure = {};
|
|
51
36
|
if (schema.properties) {
|
|
52
37
|
Object.keys(schema.properties).forEach((key) => {
|
|
@@ -55,10 +40,8 @@ const flattenSkeleton = (schema) => {
|
|
|
55
40
|
}
|
|
56
41
|
if (schema.oneOf) {
|
|
57
42
|
schema.oneOf.forEach((aOneOf) => {
|
|
58
|
-
// console.log(aOneOf);
|
|
59
43
|
if (aOneOf.properties) {
|
|
60
44
|
Object.entries(aOneOf.properties).forEach(([key, value]) => {
|
|
61
|
-
// console.log(aProperty);
|
|
62
45
|
returnStructure[key] = flattenSkeleton(value);
|
|
63
46
|
});
|
|
64
47
|
}
|
|
@@ -153,12 +136,7 @@ const deleteProperties = (sourceSchema, propertyNames) => {
|
|
|
153
136
|
const overlays = {};
|
|
154
137
|
|
|
155
138
|
extractFields.forEach((key) => {
|
|
156
|
-
let overlay = extractOverlay(combinedSchema, key
|
|
157
|
-
"title",
|
|
158
|
-
"description",
|
|
159
|
-
"enum",
|
|
160
|
-
"discriminator",
|
|
161
|
-
]);
|
|
139
|
+
let overlay = extractOverlay(combinedSchema, key);
|
|
162
140
|
overlays[key] = overlay;
|
|
163
141
|
const fileName = `../schemas/v3/overlays/${key}.json`;
|
|
164
142
|
fs.writeFileSync(fileName, JSON.stringify(overlay, null, 2));
|