@pdtf/schemas 3.4.1-3 → 3.4.1-5
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/package.json +1 -1
- package/src/schemas/v3/combined.json +61 -1
- package/src/schemas/v3/overlays/extensions/er.json +4 -1
- package/src/schemas/v3/overlays/nts2.json +4 -1
- package/src/schemas/v3/pdtf-transaction.json +75 -0
- package/src/schemas/v3/skeleton.json +18 -0
- package/src/tests/v3/extensionOverlays.test.js +83 -0
package/package.json
CHANGED
|
@@ -190,6 +190,65 @@
|
|
|
190
190
|
"participantStatus": {
|
|
191
191
|
"type": "string",
|
|
192
192
|
"enum": ["Proposed", "Invited", "Active", "Removed"]
|
|
193
|
+
},
|
|
194
|
+
"verification": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"properties": {
|
|
197
|
+
"identity": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"properties": {
|
|
200
|
+
"result": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"enum": ["pass", "fail", "consider"]
|
|
203
|
+
},
|
|
204
|
+
"reports": {
|
|
205
|
+
"type": "array",
|
|
206
|
+
"items": {
|
|
207
|
+
"type": "object",
|
|
208
|
+
"properties": {
|
|
209
|
+
"reportName": {
|
|
210
|
+
"type": "string"
|
|
211
|
+
},
|
|
212
|
+
"result": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"enum": ["pass", "fail", "consider"]
|
|
215
|
+
},
|
|
216
|
+
"details": {
|
|
217
|
+
"type": "string"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"antiMoneyLaundering": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"result": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"enum": ["pass", "fail", "consider"]
|
|
230
|
+
},
|
|
231
|
+
"reports": {
|
|
232
|
+
"type": "array",
|
|
233
|
+
"items": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"properties": {
|
|
236
|
+
"reportName": {
|
|
237
|
+
"type": "string"
|
|
238
|
+
},
|
|
239
|
+
"result": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"enum": ["pass", "fail", "consider"]
|
|
242
|
+
},
|
|
243
|
+
"details": {
|
|
244
|
+
"type": "string"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
193
252
|
}
|
|
194
253
|
},
|
|
195
254
|
"discriminator": {
|
|
@@ -1862,7 +1921,8 @@
|
|
|
1862
1921
|
}
|
|
1863
1922
|
},
|
|
1864
1923
|
"baspi4Required": ["wholeFreeholdForSale"],
|
|
1865
|
-
"baspi5Required": ["wholeFreeholdForSale"]
|
|
1924
|
+
"baspi5Required": ["wholeFreeholdForSale"],
|
|
1925
|
+
"nts2Required": ["estateRentcharges"]
|
|
1866
1926
|
},
|
|
1867
1927
|
{
|
|
1868
1928
|
"properties": {
|
|
@@ -191,6 +191,81 @@
|
|
|
191
191
|
"Active",
|
|
192
192
|
"Removed"
|
|
193
193
|
]
|
|
194
|
+
},
|
|
195
|
+
"verification": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"properties": {
|
|
198
|
+
"identity": {
|
|
199
|
+
"type": "object",
|
|
200
|
+
"properties": {
|
|
201
|
+
"result": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"enum": [
|
|
204
|
+
"pass",
|
|
205
|
+
"fail",
|
|
206
|
+
"consider"
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
"reports": {
|
|
210
|
+
"type": "array",
|
|
211
|
+
"items": {
|
|
212
|
+
"type": "object",
|
|
213
|
+
"properties": {
|
|
214
|
+
"reportName": {
|
|
215
|
+
"type": "string"
|
|
216
|
+
},
|
|
217
|
+
"result": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"enum": [
|
|
220
|
+
"pass",
|
|
221
|
+
"fail",
|
|
222
|
+
"consider"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"details": {
|
|
226
|
+
"type": "string"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"antiMoneyLaundering": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"properties": {
|
|
236
|
+
"result": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"enum": [
|
|
239
|
+
"pass",
|
|
240
|
+
"fail",
|
|
241
|
+
"consider"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"reports": {
|
|
245
|
+
"type": "array",
|
|
246
|
+
"items": {
|
|
247
|
+
"type": "object",
|
|
248
|
+
"properties": {
|
|
249
|
+
"reportName": {
|
|
250
|
+
"type": "string"
|
|
251
|
+
},
|
|
252
|
+
"result": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"enum": [
|
|
255
|
+
"pass",
|
|
256
|
+
"fail",
|
|
257
|
+
"consider"
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
"details": {
|
|
261
|
+
"type": "string"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
194
269
|
}
|
|
195
270
|
},
|
|
196
271
|
"oneOf": [
|
|
@@ -31,6 +31,24 @@
|
|
|
31
31
|
"role": {},
|
|
32
32
|
"externalIds": {},
|
|
33
33
|
"participantStatus": {},
|
|
34
|
+
"verification": {
|
|
35
|
+
"identity": {
|
|
36
|
+
"result": {},
|
|
37
|
+
"reports": {
|
|
38
|
+
"reportName": {},
|
|
39
|
+
"result": {},
|
|
40
|
+
"details": {}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"antiMoneyLaundering": {
|
|
44
|
+
"result": {},
|
|
45
|
+
"reports": {
|
|
46
|
+
"reportName": {},
|
|
47
|
+
"result": {},
|
|
48
|
+
"details": {}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
34
52
|
"sellersCapacity": {
|
|
35
53
|
"capacity": {},
|
|
36
54
|
"sellersCapacityDetails": {},
|
|
@@ -351,6 +351,89 @@ describe("Extension Overlays", () => {
|
|
|
351
351
|
expect(siSection.required).toContain("containsAsbestos");
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
+
test("should make estateRentcharges required when er extension is applied", () => {
|
|
355
|
+
const schema = getTransactionSchema(schemaId, ["nts2023", "er"]);
|
|
356
|
+
|
|
357
|
+
// Check that estateRentcharges is required at the oneOf branch level
|
|
358
|
+
const freeholdBranch =
|
|
359
|
+
schema.properties?.propertyPack?.properties?.ownership?.properties
|
|
360
|
+
?.ownershipsToBeTransferred?.items?.oneOf?.[0];
|
|
361
|
+
|
|
362
|
+
expect(freeholdBranch).toBeDefined();
|
|
363
|
+
expect(freeholdBranch.required).toBeDefined();
|
|
364
|
+
expect(freeholdBranch.required).toContain("estateRentcharges");
|
|
365
|
+
|
|
366
|
+
// Verify the estateRentcharges property itself is properly structured
|
|
367
|
+
const erProp = freeholdBranch.properties?.estateRentcharges;
|
|
368
|
+
expect(erProp).toBeDefined();
|
|
369
|
+
expect(erProp.ntsRef).toBe("A3.4");
|
|
370
|
+
expect(erProp.required).toContain("yesNo");
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test("should consistently apply required fields at parent level for extension properties", () => {
|
|
374
|
+
// Test multiple extensions that should have required fields at parent level
|
|
375
|
+
const schema = getTransactionSchema(schemaId, [
|
|
376
|
+
"nts2023",
|
|
377
|
+
"jk",
|
|
378
|
+
"er",
|
|
379
|
+
"ma",
|
|
380
|
+
"tf",
|
|
381
|
+
]);
|
|
382
|
+
|
|
383
|
+
// Check specialist issues - japaneseKnotweed should be required
|
|
384
|
+
const siSection =
|
|
385
|
+
schema.properties?.propertyPack?.properties?.specialistIssues;
|
|
386
|
+
expect(siSection?.required).toContain("japaneseKnotweed");
|
|
387
|
+
|
|
388
|
+
// Check ownership - estateRentcharges should be required in freehold branch
|
|
389
|
+
const freeholdBranch =
|
|
390
|
+
schema.properties?.propertyPack?.properties?.ownership?.properties
|
|
391
|
+
?.ownershipsToBeTransferred?.items?.oneOf?.[0];
|
|
392
|
+
expect(freeholdBranch?.required).toContain("estateRentcharges");
|
|
393
|
+
|
|
394
|
+
// Check leasehold - leaseholdInformation should be required in leasehold branch
|
|
395
|
+
const leaseholdBranch =
|
|
396
|
+
schema.properties?.propertyPack?.properties?.ownership?.properties
|
|
397
|
+
?.ownershipsToBeTransferred?.items?.oneOf?.[2];
|
|
398
|
+
expect(leaseholdBranch?.required).toContain("leaseholdInformation");
|
|
399
|
+
|
|
400
|
+
// Verify that the required arrays are properly merged (not overwritten)
|
|
401
|
+
// Note: The length check might fail if only one extension is applied to specialistIssues
|
|
402
|
+
// Let's check what's actually in the required arrays
|
|
403
|
+
console.log("SpecialistIssues required:", siSection?.required);
|
|
404
|
+
console.log("FreeholdBranch required:", freeholdBranch?.required);
|
|
405
|
+
console.log("LeaseholdBranch required:", leaseholdBranch?.required);
|
|
406
|
+
|
|
407
|
+
expect(siSection.required.length).toBeGreaterThanOrEqual(1);
|
|
408
|
+
expect(freeholdBranch.required.length).toBeGreaterThan(0);
|
|
409
|
+
expect(leaseholdBranch.required.length).toBeGreaterThan(0);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
test("should merge required arrays for multiple specialist issues overlays", () => {
|
|
413
|
+
// Apply multiple specialist issues overlays
|
|
414
|
+
const overlays = ["nts2023", "jk", "as", "dr", "sb", "hs"];
|
|
415
|
+
const schema = getTransactionSchema(schemaId, overlays);
|
|
416
|
+
const siSection =
|
|
417
|
+
schema.properties?.propertyPack?.properties?.specialistIssues;
|
|
418
|
+
|
|
419
|
+
// The overlays correspond to these property keys
|
|
420
|
+
const expectedRequired = [
|
|
421
|
+
"japaneseKnotweed",
|
|
422
|
+
"containsAsbestos",
|
|
423
|
+
"dryRotEtcTreatment",
|
|
424
|
+
"subsidenceOrStructuralFault",
|
|
425
|
+
"ongoingHealthOrSafetyIssue",
|
|
426
|
+
];
|
|
427
|
+
|
|
428
|
+
expect(siSection?.required).toBeDefined();
|
|
429
|
+
// Should contain all expected keys
|
|
430
|
+
expectedRequired.forEach((key) => {
|
|
431
|
+
expect(siSection.required).toContain(key);
|
|
432
|
+
});
|
|
433
|
+
// Should be the same length as the number of overlays (excluding nts2023)
|
|
434
|
+
expect(siSection.required.length).toBe(expectedRequired.length);
|
|
435
|
+
});
|
|
436
|
+
|
|
354
437
|
test("should handle discriminator patterns correctly", () => {
|
|
355
438
|
const schema = getTransactionSchema(schemaId, ["nts2023", "jk"]);
|
|
356
439
|
const jkProp =
|