@pdtf/schemas 3.4.1-5 → 3.4.1-7

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.
@@ -8,7 +8,8 @@
8
8
  "Bash(jq:*)",
9
9
  "Bash(grep:*)",
10
10
  "Bash(rm:*)",
11
- "Bash(npm test:*)"
11
+ "Bash(npm test:*)",
12
+ "Bash(npm install:*)"
12
13
  ],
13
14
  "deny": []
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdtf/schemas",
3
- "version": "3.4.1-5",
3
+ "version": "3.4.1-7",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -9228,6 +9228,12 @@
9228
9228
  "controlledParking",
9229
9229
  "electricVehicleChargingPoint"
9230
9230
  ],
9231
+ "ntsl2Required": [
9232
+ "parkingArrangements",
9233
+ "disabledParking",
9234
+ "controlledParking",
9235
+ "electricVehicleChargingPoint"
9236
+ ],
9231
9237
  "ta6Required": ["parkingArrangements", "controlledParking"],
9232
9238
  "properties": {
9233
9239
  "parkingArrangements": {
@@ -9456,6 +9462,11 @@
9456
9462
  "isConservationArea",
9457
9463
  "hasTreePreservationOrder"
9458
9464
  ],
9465
+ "ntsl2Required": [
9466
+ "isListed",
9467
+ "isConservationArea",
9468
+ "hasTreePreservationOrder"
9469
+ ],
9459
9470
  "baspi4Required": [
9460
9471
  "isListed",
9461
9472
  "isConservationArea",
@@ -252,6 +252,12 @@
252
252
  },
253
253
  "parking": {
254
254
  "ntsl2Ref": "B4",
255
+ "required": [
256
+ "parkingArrangements",
257
+ "disabledParking",
258
+ "controlledParking",
259
+ "electricVehicleChargingPoint"
260
+ ],
255
261
  "properties": {
256
262
  "parkingArrangements": {
257
263
  "ntsl2Ref": "B4.1",
@@ -320,6 +326,11 @@
320
326
  },
321
327
  "listingAndConservation": {
322
328
  "ntsl2Ref": "C2.1",
329
+ "required": [
330
+ "isListed",
331
+ "isConservationArea",
332
+ "hasTreePreservationOrder"
333
+ ],
323
334
  "properties": {
324
335
  "isListed": {
325
336
  "ntsl2Ref": "C2.1.1",
@@ -448,3 +448,49 @@ test("validates a valid contract", () => {
448
448
  const isValid = validator(data);
449
449
  expect(isValid).toBe(true);
450
450
  });
451
+
452
+ test("ntsl2025 requires parking and listingAndConservation fields", () => {
453
+ // This test validates that the ntsl2025 overlay correctly enforces required fields
454
+ // for the parking and listingAndConservation sections.
455
+ // It should fail validation when these fields are missing.
456
+ // NOTE: This test will fail until overlays are regenerated from combined.json
457
+ const validator = getValidator(schemaId, ["ntsl2025"]);
458
+ const clonedExampleTransaction = JSON.parse(
459
+ JSON.stringify(exampleTransaction)
460
+ );
461
+
462
+ // Set up lettings-specific fields
463
+ clonedExampleTransaction.propertyPack.lettingInformation = {
464
+ rent: 3500,
465
+ rentFrequency: "Monthly",
466
+ securityDeposit: 5000,
467
+ };
468
+ delete clonedExampleTransaction.propertyPack.priceInformation;
469
+ delete clonedExampleTransaction.propertyPack.ownership;
470
+
471
+ // Remove ALL parking fields - this should make validation fail
472
+ delete clonedExampleTransaction.propertyPack.parking.parkingArrangements;
473
+ delete clonedExampleTransaction.propertyPack.parking.disabledParking;
474
+ delete clonedExampleTransaction.propertyPack.parking.controlledParking;
475
+ delete clonedExampleTransaction.propertyPack.parking.electricVehicleChargingPoint;
476
+
477
+ // Remove ALL listingAndConservation fields - this should make validation fail
478
+ delete clonedExampleTransaction.propertyPack.listingAndConservation.isListed;
479
+ delete clonedExampleTransaction.propertyPack.listingAndConservation.isConservationArea;
480
+ delete clonedExampleTransaction.propertyPack.listingAndConservation.hasTreePreservationOrder;
481
+
482
+ const isValid = validator(clonedExampleTransaction);
483
+
484
+ // The data should be INVALID because required fields are missing
485
+ expect(isValid).toBe(false);
486
+
487
+ // Specifically check that parking and listingAndConservation fields are reported as missing
488
+ const errorMessages = validator.errors.map(e => e.message);
489
+ expect(errorMessages).toContain("must have required property 'parkingArrangements'");
490
+ expect(errorMessages).toContain("must have required property 'disabledParking'");
491
+ expect(errorMessages).toContain("must have required property 'controlledParking'");
492
+ expect(errorMessages).toContain("must have required property 'electricVehicleChargingPoint'");
493
+ expect(errorMessages).toContain("must have required property 'isListed'");
494
+ expect(errorMessages).toContain("must have required property 'isConservationArea'");
495
+ expect(errorMessages).toContain("must have required property 'hasTreePreservationOrder'");
496
+ });