@pdtf/schemas 0.5.6 → 0.5.9

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://homebuyingandsellinggroup.co.uk/schemas/energy-performance-certificate-0.1.0.json",
3
+ "$id": "https://homebuyingandsellinggroup.co.uk/schemas/energy-performance-certificate.json",
4
4
  "type": "object",
5
5
  "title": "Energy Performance Certificate and Recommendations Schema, supporting data retrieved from https://epc.opendatacommunities.org ",
6
6
  "description": "Mirrors the Domestic EPC Glossary at https://epc.opendatacommunities.org/docs/guidance#glossary",
@@ -12,106 +12,109 @@
12
12
  "address1": { "type": "string" },
13
13
  "address2": { "type": "string" },
14
14
  "address3": { "type": "string" },
15
- "building-reference-number": { "type": "string" },
16
- "built-form": { "type": "string" },
17
- "co2-emiss-curr-per-floor-area": { "type": "number" },
18
- "co2-emissions-current": { "type": "number" },
19
- "co2-emissions-potential": { "type": "number" },
20
- "constituency-label": { "type": "string" },
15
+ "buildingReferenceNumber": { "type": "string" },
16
+ "builtForm": { "type": "string" },
17
+ "co2EmissCurrPerFloorArea": { "type": "number" },
18
+ "co2EmissionsCurrent": { "type": "number" },
19
+ "co2EmissionsPotential": { "type": "number" },
20
+ "constituencyLabel": { "type": "string" },
21
21
  "constituency": { "type": "string" },
22
- "construction-age-band": { "type": "string" },
22
+ "constructionAgeBand": { "type": "string" },
23
23
  "county": { "type": "string" },
24
- "current-energy-efficiency": { "type": "integer" },
25
- "current-energy-rating": { "type": "string" },
26
- "energy-consumption-current": { "type": "integer" },
27
- "energy-consumption-potential": { "type": "integer" },
28
- "energy-tariff": { "type": "string" },
29
- "environment-impact-current": { "type": "integer" },
30
- "environment-impact-potential": { "type": "integer" },
31
- "extension-count": { "type": "integer" },
32
- "fixed-lighting-outlets-count": { "type": "integer" },
33
- "flat-storey-count": { "type": "integer" },
34
- "flat-top-storey": { "type": "string" },
35
- "floor-description": { "type": "string" },
36
- "floor-energy-eff": { "type": "string" },
37
- "floor-env-eff": { "type": "string" },
38
- "floor-height": { "type": "number" },
39
- "floor-level": { "type": "string" },
40
- "glazed-area": { "type": "string" },
41
- "glazed-type": { "type": "string" },
42
- "heat-loss-corridor": { "type": "string" },
43
- "heating-cost-current": { "type": "integer" },
44
- "heating-cost-potential": { "type": "integer" },
45
- "hot-water-cost-current": { "type": "integer" },
46
- "hot-water-cost-potential": { "type": "integer" },
47
- "hot-water-energy-eff": { "type": "string" },
48
- "hot-water-env-eff": { "type": "string" },
49
- "hotwater-description": { "type": "string" },
50
- "inspection-date": { "type": "string", "format": "date" },
51
- "lighting-cost-current": { "type": "integer" },
52
- "lighting-cost-potential": { "type": "integer" },
53
- "lighting-description": { "type": "string" },
54
- "lighting-energy-eff": { "type": "string" },
55
- "lighting-env-eff": { "type": "string" },
56
- "lmk-key": { "type": "string" },
57
- "local-authority-label": { "type": "string" },
58
- "local-authority": { "type": "string" },
59
- "lodgement-date": { "type": "string", "format": "date" },
60
- "lodgement-datetime": { "type": "string", "format": "date-time" },
61
- "low-energy-fixed-light-count": { "type": "integer" },
62
- "low-energy-lighting": { "type": "integer" },
63
- "main-fuel": { "type": "string" },
64
- "main-heating-controls": { "type": "string" },
65
- "mainheat-description": { "type": "string" },
66
- "mainheat-energy-eff": { "type": "string" },
67
- "mainheat-env-eff": { "type": "string" },
68
- "mainheatc-energy-eff": { "type": "string" },
69
- "mainheatc-env-eff": { "type": "string" },
70
- "mainheatcont-description": { "type": "string" },
71
- "mains-gas-flag": { "type": "string" },
72
- "mechanical-ventilation": { "type": "string" },
73
- "multi-glaze-proportion": { "type": "integer" },
74
- "number-habitable-rooms": { "type": "integer" },
75
- "number-heated-rooms": { "type": "integer" },
76
- "number-open-fireplaces": { "type": "integer" },
77
- "photo-supply": { "type": "integer" },
24
+ "currentEnergyEfficiency": { "type": "integer" },
25
+ "currentEnergyRating": { "type": "string" },
26
+ "energyConsumptionCurrent": { "type": "integer" },
27
+ "energyConsumptionPotential": { "type": "integer" },
28
+ "energyTariff": { "type": "string" },
29
+ "environmentImpactCurrent": { "type": "integer" },
30
+ "environmentImpactPotential": { "type": "integer" },
31
+ "extensionCount": { "type": "integer" },
32
+ "fixedLightingOutletsCount": { "type": "integer" },
33
+ "flatStoreyCount": { "type": "integer" },
34
+ "flatTopStorey": { "type": "string" },
35
+ "floorDescription": { "type": "string" },
36
+ "floorEnergyEff": { "type": "string" },
37
+ "floorEnvEff": { "type": "string" },
38
+ "floorHeight": { "type": "number" },
39
+ "floorLevel": { "type": "string" },
40
+ "glazedArea": { "type": "string" },
41
+ "glazedType": { "type": "string" },
42
+ "heatLossCorridor": { "type": "string" },
43
+ "heatingCostCurrent": { "type": "integer" },
44
+ "heatingCostPotential": { "type": "integer" },
45
+ "hotWaterCostCurrent": { "type": "integer" },
46
+ "hotWaterCostPotential": { "type": "integer" },
47
+ "hotWaterEnergyEff": { "type": "string" },
48
+ "hotWaterEnvEff": { "type": "string" },
49
+ "hotwaterDescription": { "type": "string" },
50
+ "inspectionDate": { "type": "string", "format": "date" },
51
+ "lightingCostCurrent": { "type": "integer" },
52
+ "lightingCostPotential": { "type": "integer" },
53
+ "lightingDescription": { "type": "string" },
54
+ "lightingEnergyEff": { "type": "string" },
55
+ "lightingEnvEff": { "type": "string" },
56
+ "lmkKey": { "type": "string" },
57
+ "localAuthorityLabel": { "type": "string" },
58
+ "localAuthority": { "type": "string" },
59
+ "lodgementDate": { "type": "string", "format": "date" },
60
+ "lodgementDatetime": { "type": "string", "format": "date-time" },
61
+ "lowEnergyFixedLightCount": { "type": "integer" },
62
+ "lowEnergyLighting": { "type": "integer" },
63
+ "mainFuel": { "type": "string" },
64
+ "mainHeatingControls": { "type": "string" },
65
+ "mainheatDescription": { "type": "string" },
66
+ "mainheatEnergyEff": { "type": "string" },
67
+ "mainheatEnvEff": { "type": "string" },
68
+ "mainheatcEnergyEff": { "type": "string" },
69
+ "mainheatcEnvEff": { "type": "string" },
70
+ "mainheatcontDescription": { "type": "string" },
71
+ "mainsGasFlag": { "type": "string" },
72
+ "mechanicalVentilation": { "type": "string" },
73
+ "multiGlazeProportion": { "type": "integer" },
74
+ "numberHabitableRooms": { "type": "integer" },
75
+ "numberHeatedRooms": { "type": "integer" },
76
+ "numberOpenFireplaces": { "type": "integer" },
77
+ "photoSupply": { "type": "integer" },
78
78
  "postcode": { "type": "string" },
79
79
  "posttown": { "type": "string" },
80
- "potential-energy-efficiency": { "type": "integer" },
81
- "potential-energy-rating": { "type": "string" },
82
- "property-type": { "type": "string" },
83
- "roof-description": { "type": "string" },
84
- "roof-energy-eff": { "type": "string" },
85
- "roof-env-eff": { "type": "string" },
86
- "secondheat-description": { "type": "string" },
87
- "sheating-energy-eff": { "type": "string" },
88
- "sheating-env-eff": { "type": "string" },
89
- "solar-water-heating-flag": { "type": "string" },
80
+ "potentialEnergyEfficiency": { "type": "integer" },
81
+ "potentialEnergyRating": { "type": "string" },
82
+ "propertyType": { "type": "string" },
83
+ "roofDescription": { "type": "string" },
84
+ "roofEnergyEff": { "type": "string" },
85
+ "roofEnvEff": { "type": "string" },
86
+ "secondheatDescription": { "type": "string" },
87
+ "sheatingEnergyEff": { "type": "string" },
88
+ "sheatingEnvEff": { "type": "string" },
89
+ "solarWaterHeatingFlag": { "type": "string" },
90
90
  "tenure": { "type": "string" },
91
- "total-floor-area": { "type": "number" },
92
- "transaction-type": { "type": "string" },
93
- "unheated-corridor-length": { "type": "number" },
94
- "uprn-source": { "type": "string" },
91
+ "totalFloorArea": { "type": "number" },
92
+ "transactionType": { "type": "string" },
93
+ "unheatedCorridorLength": { "type": "number" },
94
+ "uprnSource": { "type": "string" },
95
95
  "uprn": { "type": "integer" },
96
- "walls-description": { "type": "string" },
97
- "walls-energy-eff": { "type": "string" },
98
- "walls-env-eff": { "type": "string" },
99
- "wind-turbine-count": { "type": "integer" },
100
- "windows-description": { "type": "string" },
101
- "windows-energy-eff": { "type": "string" },
102
- "windows-env-eff": { "type": "string" }
96
+ "wallsDescription": { "type": "string" },
97
+ "wallsEnergyEff": { "type": "string" },
98
+ "wallsEnvEff": { "type": "string" },
99
+ "windTurbineCount": { "type": "integer" },
100
+ "windowsDescription": { "type": "string" },
101
+ "windowsEnergyEff": { "type": "string" },
102
+ "windowsEnvEff": { "type": "string" }
103
103
  }
104
104
  },
105
105
  "recommendations": {
106
- "type": "object",
107
- "properties": {
108
- "lmk-key": { "type": "string" },
109
- "improvement-item": { "type": "integer" },
110
- "indicative-cost": { "type": "string" },
111
- "improvement-summary-text": { "type": "string" },
112
- "improvement-descr-text": { "type": "string" },
113
- "improvement-id": { "type": "string" },
114
- "improvement-id-text": { "type": "string" }
106
+ "type": "array",
107
+ "items": {
108
+ "type": "object",
109
+ "properties": {
110
+ "lmkKey": { "type": "string" },
111
+ "improvementItem": { "type": "integer" },
112
+ "indicativeCost": { "type": "string" },
113
+ "improvementSummaryText": { "type": "string" },
114
+ "improvementDescrText": { "type": "string" },
115
+ "improvementId": { "type": "string" },
116
+ "improvementIdText": { "type": "string" }
117
+ }
115
118
  }
116
119
  }
117
120
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://homebuyingandsellinggroup.co.uk/schemas/pdtf-claim-0.1.0.json",
3
+ "$id": "https://homebuyingandsellinggroup.co.uk/schemas/pdtf-claim.json",
4
4
  "type": "object",
5
5
  "title": "Property Data Trust Framework Claim",
6
6
  "description": "PDTF verified claims are implemented in accordance with the OpenID Connect Verified Claims model, within which the actual claims object should conform to this schema to ensure the necessary metadata is attached",
@@ -3,7 +3,7 @@
3
3
  "$id": "https://homebuyingandsellinggroup.co.uk/schemas/property-pack.json",
4
4
  "type": "object",
5
5
  "title": "Property Data Trust Framework Schema",
6
- "description": "A schema defining the PDTF data structure, supporting mapping to BASPI, Law Society and RICS Data Schema elements.",
6
+ "description": "A schema defining the PDTF Property Pack data structure, supporting mapping to BASPI, Law Society and RICS Data Schema elements.",
7
7
  "required": ["$schema", "uprn", "propertyPack"],
8
8
  "properties": {
9
9
  "$schema": {
@@ -18,7 +18,70 @@
18
18
  "propertyPack": {
19
19
  "title": "Property Pack",
20
20
  "type": "object",
21
+ "required": ["sellers"],
21
22
  "properties": {
23
+ "sellers": {
24
+ "RDSRef": "",
25
+ "title": "About the sellers",
26
+ "type": "array",
27
+ "minItems": 1,
28
+ "items": {
29
+ "type": "object",
30
+ "title": "Seller information",
31
+ "required": [
32
+ "name",
33
+ "dateOfBirth",
34
+ "mobileNumber",
35
+ "email",
36
+ "address"
37
+ ],
38
+ "properties": {
39
+ "name": {
40
+ "title": "Name",
41
+ "type": "object",
42
+ "required": ["firstName", "lastName"],
43
+ "properties": {
44
+ "firstName": {
45
+ "RDSRef": "",
46
+ "title": "First name",
47
+ "type": "string"
48
+ },
49
+ "middleNames": {
50
+ "title": "Middle name(s)",
51
+ "type": "string"
52
+ },
53
+ "lastName": {
54
+ "title": "Last name",
55
+ "type": "string"
56
+ }
57
+ }
58
+ },
59
+ "dateOfBirth": {
60
+ "title": "Date of birth",
61
+ "type": "string",
62
+ "format": "date"
63
+ },
64
+ "mobileNumber": {
65
+ "title": "Mobile number",
66
+ "type": "string"
67
+ },
68
+ "email": {
69
+ "title": "Email address",
70
+ "type": "string",
71
+ "format": "email"
72
+ },
73
+ "address": {
74
+ "title": "Address",
75
+ "$ref": "#/$defs/address"
76
+ },
77
+ "amlCheckResult": {
78
+ "title": "AML check result",
79
+ "type": "string",
80
+ "enum": ["clear", "consider"]
81
+ }
82
+ }
83
+ }
84
+ },
22
85
  "materialFacts": {
23
86
  "$ref": "https://homebuyingandsellinggroup.co.uk/schemas/baspi-a-material-facts.json"
24
87
  },
@@ -95,5 +158,35 @@
95
158
  }
96
159
  }
97
160
  }
161
+ },
162
+ "$defs": {
163
+ "address": {
164
+ "type": "object",
165
+ "properties": {
166
+ "address1": {
167
+ "title": "Address 1",
168
+ "type": "string",
169
+ "minLength": 1
170
+ },
171
+ "address2": {
172
+ "title": "Address 2",
173
+ "type": "string"
174
+ },
175
+ "town": {
176
+ "title": "Town",
177
+ "type": "string"
178
+ },
179
+ "county": {
180
+ "title": "County",
181
+ "type": "string"
182
+ },
183
+ "postcode": {
184
+ "title": "Postcode",
185
+ "type": "string",
186
+ "minLength": 1
187
+ }
188
+ },
189
+ "required": ["address1", "postcode"]
190
+ }
98
191
  }
99
192
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://homebuyingandsellinggroup.co.uk/schemas/title-deed-0.1.0.json",
3
+ "$id": "https://homebuyingandsellinggroup.co.uk/schemas/title-deed.json",
4
4
  "title": "Property Data Trust Framework HMLR Register Extract representation",
5
- "description": "A schema mirroring the V2_1 XML version of the HMLR Register Extract web service. Versioning is using SchemaVer",
5
+ "description": "A schema mirroring the V2_1 XML version of the HMLR Register Extract web service.",
6
6
  "definitions": {
7
7
  "BinaryObjectType": {
8
8
  "type": "object",
@@ -766,8 +766,13 @@
766
766
  },
767
767
  "type": "object",
768
768
  "properties": {
769
- "Attachment": { "$ref": "#/definitions/Q1AttachmentType" },
770
- "OCSummaryData": { "$ref": "#/definitions/Q1OCSummaryDataType" },
771
- "OCRegisterData": { "$ref": "#/definitions/Q1OCRegisterDataType" }
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
+ }
772
777
  }
773
778
  }
@@ -2,50 +2,57 @@
2
2
  "$schema": "https://homebuyingandsellinggroup.co.uk/schemas/property-pack.json",
3
3
  "uprn": 100000059583,
4
4
  "propertyPack": {
5
+ "sellers": [
6
+ {
7
+ "name": { "firstName": "John", "lastName": "Davies" },
8
+ "dateOfBirth": "1975-12-25",
9
+ "mobileNumber": "07777 222333",
10
+ "email": "john@theseller.com",
11
+ "address": { "address1": "10 Downend Park", "postcode": "BS7 9PU" }
12
+ }
13
+ ],
5
14
  "materialFacts": {
6
- "propertyToBeSold": {
7
- "address": {
8
- "address1": "10 Downend Park",
9
- "address2": "",
10
- "town": "BRISTOLS",
11
- "county": "Avon",
12
- "postcode": "BS7 9PU"
13
- },
14
- "energyEfficiency": {
15
- "energyEfficiencyRating": "A"
16
- },
17
- "delayFactors": {
18
- "yesNo": "No"
19
- },
20
- "ownership": {
21
- "ownershipType": "Freehold"
22
- },
15
+ "address": {
16
+ "address1": "10 Downend Park",
17
+ "address2": "",
18
+ "town": "BRISTOLS",
19
+ "county": "Avon",
20
+ "postcode": "BS7 9PU"
21
+ },
22
+ "energyEfficiency": {
23
+ "energyEfficiencyRating": "A"
24
+ },
25
+ "delayFactors": {
26
+ "yesNo": "No"
27
+ },
28
+ "ownership": {
29
+ "ownershipType": "Freehold"
30
+ },
31
+ "parking": {
23
32
  "parkingArrangements": {
24
33
  "parkingArrangementsType": "Other",
25
34
  "otherParkingType": "Garage and double width driveway"
26
35
  },
27
- "listingAndConservation": {
28
- "isListed": {
29
- "yesNo": "No"
30
- },
31
- "isConservationArea": {
32
- "yesNo": "No"
33
- },
34
- "hasTreePreservationOrder": {
35
- "yesNo": "No"
36
- }
36
+ "electricVehicleChargingPoint": { "yesNo": "No" }
37
+ },
38
+ "listingAndConservation": {
39
+ "isListed": {
40
+ "yesNo": "No"
37
41
  },
38
- "typeOfConstruction": {
39
- "isStandardForm": {
40
- "yesNo": "Yes"
41
- },
42
- "hasFlammableExternalWallSystem": "No"
42
+ "isConservationArea": {
43
+ "yesNo": "No"
43
44
  },
44
- "councilTax": {
45
- "councilTaxBand": "A",
46
- "councilTaxAffectingAlterations": {
47
- "yesNo": "No"
48
- }
45
+ "hasTreePreservationOrder": {
46
+ "yesNo": "No"
47
+ }
48
+ },
49
+ "flammableExternalWallSystem": {
50
+ "hasFlammableExternalWallSystem": "No"
51
+ },
52
+ "councilTax": {
53
+ "councilTaxBand": "A",
54
+ "councilTaxAffectingAlterations": {
55
+ "yesNo": "No"
49
56
  }
50
57
  },
51
58
  "disputesAndComplaints": {
@@ -357,7 +364,9 @@
357
364
  "yesNo": "No"
358
365
  }
359
366
  },
360
- "consumerProtectionRegulationsDeclaration": true
367
+ "consumerProtectionRegulationsDeclaration": {
368
+ "consumerProtectionRegulationsResponse": true
369
+ }
361
370
  }
362
371
  }
363
372
  }
@@ -1,12 +1,13 @@
1
- import jp from "jsonpointer";
1
+ const jp = require("jsonpointer");
2
2
 
3
- import {
3
+ const {
4
4
  propertyPackSchema,
5
5
  validator,
6
6
  getSubschema,
7
- getSubschemaValidator
8
- } from "../../index.js";
9
- import examplePropertyPack from "./examplePropertyPack.json";
7
+ getSubschemaValidator,
8
+ getTitleAtPath
9
+ } = require("../../index.js");
10
+ const examplePropertyPack = require("./examplePropertyPack.json");
10
11
 
11
12
  test("exports a property pack schema", () => {
12
13
  expect(propertyPackSchema).not.toBeNull();
@@ -14,6 +15,7 @@ test("exports a property pack schema", () => {
14
15
 
15
16
  test("sample is valid", () => {
16
17
  const isValid = validator(examplePropertyPack);
18
+ console.log(validator.errors);
17
19
  expect(isValid).toBe(true);
18
20
  });
19
21
 
@@ -26,6 +28,16 @@ test("invalid sample is invalid", () => {
26
28
  expect(isValid).toBe(false);
27
29
  });
28
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
+
29
41
  test("correctly gets a subschema", () => {
30
42
  const subschema = getSubschema("/propertyPack/materialFacts/notices");
31
43
  expect(subschema.title).toBe("Notices which Affect the Property");
@@ -42,3 +54,56 @@ test("correctly gets a working subschema validator", () => {
42
54
  isValid = validator(data);
43
55
  expect(isValid).toBe(false);
44
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
+ });
package/babel.config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- presets: [["@babel/preset-env", { targets: { node: "current" } }]]
3
- };