@pdtf/schemas 2.0.0-1 → 2.0.0-3
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 +12 -9
- package/package.json +1 -1
- package/src/examples/v2/exampleTransaction.json +18 -7
- package/src/schemas/v2/combined.json +23 -33
- package/src/schemas/v2/core.json +6 -7
- package/src/schemas/v2/merged.json +13 -9
- package/src/schemas/v2/overlays/baspi.json +13 -9
- package/src/tests/v1/transactionSchema.test.js +21 -13
- package/src/tests/v2/transactionSchema.test.js +15 -24
package/index.js
CHANGED
|
@@ -105,7 +105,8 @@ const getValidator = (schemaId, overlay = "baspiV4") => {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
// common functions for v1 and v2
|
|
108
|
-
const getSubschema = (path,
|
|
108
|
+
const getSubschema = (path, schemaId, overlay) => {
|
|
109
|
+
const sourceSchema = getTransactionSchema(schemaId, overlay);
|
|
109
110
|
const pathArray = path.split("/").slice(1);
|
|
110
111
|
if (pathArray.length < 1) return sourceSchema;
|
|
111
112
|
return pathArray.reduce((schema, pathElement) => {
|
|
@@ -127,23 +128,25 @@ const getSubschema = (path, sourceSchema = transactionSchema) => {
|
|
|
127
128
|
}, sourceSchema);
|
|
128
129
|
};
|
|
129
130
|
|
|
130
|
-
const isPathValid = (path,
|
|
131
|
+
const isPathValid = (path, schemaId, overlay) => {
|
|
132
|
+
const schema = getTransactionSchema(schemaId, overlay);
|
|
131
133
|
try {
|
|
132
|
-
return getSubschema(path,
|
|
134
|
+
return getSubschema(path, schemaId, overlay) !== undefined;
|
|
133
135
|
} catch (err) {
|
|
134
136
|
return false;
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
139
|
|
|
138
|
-
const getSubschemaValidator = (path,
|
|
139
|
-
const subSchema = getSubschema(path,
|
|
140
|
+
const getSubschemaValidator = (path, schemaId, overlay) => {
|
|
141
|
+
const subSchema = getSubschema(path, schemaId, overlay);
|
|
140
142
|
// see if we can retrieve the schema by path
|
|
141
|
-
|
|
143
|
+
const cacheKey = `${path}-${schemaId}`;
|
|
144
|
+
let validator = ajv.getSchema(cacheKey);
|
|
142
145
|
// retrieve whole schema by $id if available
|
|
143
|
-
if (!validator && subSchema.$id) validator = ajv.getSchema(
|
|
146
|
+
if (!validator && subSchema.$id) validator = ajv.getSchema(cacheKey);
|
|
144
147
|
if (!validator) {
|
|
145
|
-
ajv.addSchema(subSchema,
|
|
146
|
-
validator = ajv.getSchema(
|
|
148
|
+
ajv.addSchema(subSchema, cacheKey);
|
|
149
|
+
validator = ajv.getSchema(cacheKey);
|
|
147
150
|
}
|
|
148
151
|
return validator;
|
|
149
152
|
};
|
package/package.json
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"address": {
|
|
22
22
|
"line1": "47 Park Road",
|
|
23
23
|
"line2": "",
|
|
24
|
+
"line3": "",
|
|
24
25
|
"town": "HARPENDEN",
|
|
25
|
-
"county": "Herts",
|
|
26
26
|
"postcode": "AL3 5AF"
|
|
27
27
|
},
|
|
28
28
|
"delayFactors": {
|
|
@@ -119,12 +119,15 @@
|
|
|
119
119
|
"isStandardForm": {
|
|
120
120
|
"yesNo": "Yes"
|
|
121
121
|
},
|
|
122
|
-
"
|
|
122
|
+
"buildingSafetyRemediation": { "yesNo": "No" },
|
|
123
|
+
"sprayFoamInsulation": {
|
|
124
|
+
"hasSprayFoamInstalled": "No"
|
|
125
|
+
}
|
|
123
126
|
},
|
|
124
127
|
"energyEfficiency": {
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
+
"certificate": {
|
|
129
|
+
"certificateNumber": "12345",
|
|
130
|
+
"currentEnergyRating": "A"
|
|
128
131
|
}
|
|
129
132
|
},
|
|
130
133
|
"councilTax": {
|
|
@@ -428,7 +431,7 @@
|
|
|
428
431
|
}
|
|
429
432
|
}
|
|
430
433
|
},
|
|
431
|
-
"
|
|
434
|
+
"environmentalIssues": {
|
|
432
435
|
"flooding": {
|
|
433
436
|
"floodRiskReport": { "yesNo": "No" },
|
|
434
437
|
"hasBeenFlooded": "Yes",
|
|
@@ -460,7 +463,9 @@
|
|
|
460
463
|
},
|
|
461
464
|
"otherEnvironmental": {
|
|
462
465
|
"yesNo": "No"
|
|
463
|
-
}
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"otherIssues": {
|
|
464
469
|
"excessiveNoise": {
|
|
465
470
|
"yesNo": "No"
|
|
466
471
|
},
|
|
@@ -493,6 +498,12 @@
|
|
|
493
498
|
"ownerType": "Private individual",
|
|
494
499
|
"firstName": "Peter",
|
|
495
500
|
"lastName": "Hetherington-Smythe"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"ownerType": "Private individual",
|
|
504
|
+
"firstName": "Clarissa",
|
|
505
|
+
"middleNames": "Jane",
|
|
506
|
+
"lastName": "Hetherington-Smythe"
|
|
496
507
|
}
|
|
497
508
|
]
|
|
498
509
|
},
|
|
@@ -81,12 +81,12 @@
|
|
|
81
81
|
"title": "Address 2",
|
|
82
82
|
"type": "string"
|
|
83
83
|
},
|
|
84
|
-
"
|
|
85
|
-
"title": "
|
|
84
|
+
"line 3": {
|
|
85
|
+
"title": "Address 3",
|
|
86
86
|
"type": "string"
|
|
87
87
|
},
|
|
88
|
-
"
|
|
89
|
-
"title": "
|
|
88
|
+
"town": {
|
|
89
|
+
"title": "Town",
|
|
90
90
|
"type": "string"
|
|
91
91
|
},
|
|
92
92
|
"postcode": {
|
|
@@ -155,6 +155,7 @@
|
|
|
155
155
|
"insurance",
|
|
156
156
|
"boundaries",
|
|
157
157
|
"rightsAndInformalArrangements",
|
|
158
|
+
"environmentalIssues",
|
|
158
159
|
"otherIssues",
|
|
159
160
|
"additionalInformation",
|
|
160
161
|
"consumerProtectionRegulationsDeclaration"
|
|
@@ -7051,7 +7052,8 @@
|
|
|
7051
7052
|
"type": "object",
|
|
7052
7053
|
"baspiRequired": [
|
|
7053
7054
|
"isStandardForm",
|
|
7054
|
-
"
|
|
7055
|
+
"buildingSafetyRemediation",
|
|
7056
|
+
"sprayFoamInsulation"
|
|
7055
7057
|
],
|
|
7056
7058
|
"properties": {
|
|
7057
7059
|
"isStandardForm": {
|
|
@@ -7142,38 +7144,38 @@
|
|
|
7142
7144
|
}
|
|
7143
7145
|
]
|
|
7144
7146
|
},
|
|
7145
|
-
"
|
|
7147
|
+
"sprayFoamInsulation": {
|
|
7146
7148
|
"baspiRef": "A1.8.4",
|
|
7147
7149
|
"title": "Has spray foam insulation been installed at the property?",
|
|
7148
7150
|
"type": "object",
|
|
7149
7151
|
"properties": {
|
|
7150
|
-
"
|
|
7152
|
+
"hasSprayFoamInstalled": {
|
|
7151
7153
|
"baspiRef": "A1.8.4.1",
|
|
7152
7154
|
"type": "string",
|
|
7153
7155
|
"title": "",
|
|
7154
7156
|
"enum": ["Yes", "No"]
|
|
7155
7157
|
}
|
|
7156
7158
|
},
|
|
7157
|
-
"baspiRequired": ["
|
|
7159
|
+
"baspiRequired": ["hasSprayFoamInstalled"],
|
|
7158
7160
|
"discriminator": {
|
|
7159
|
-
"propertyName": "
|
|
7161
|
+
"propertyName": "hasSprayFoamInstalled"
|
|
7160
7162
|
},
|
|
7161
7163
|
"oneOf": [
|
|
7162
7164
|
{
|
|
7163
7165
|
"properties": {
|
|
7164
|
-
"
|
|
7166
|
+
"hasSprayFoamInstalled": {
|
|
7165
7167
|
"enum": ["No"]
|
|
7166
7168
|
}
|
|
7167
7169
|
}
|
|
7168
7170
|
},
|
|
7169
7171
|
{
|
|
7170
7172
|
"properties": {
|
|
7171
|
-
"
|
|
7173
|
+
"hasSprayFoamInstalled": {
|
|
7172
7174
|
"enum": ["Yes"]
|
|
7173
7175
|
},
|
|
7174
7176
|
"details": {
|
|
7175
7177
|
"baspiRef": "A1.8.4.2",
|
|
7176
|
-
"title": "
|
|
7178
|
+
"title": "Please give details together with certification from BBA or KIWA and the installation warranty for the work carried out",
|
|
7177
7179
|
"type": "string",
|
|
7178
7180
|
"minLength": 1
|
|
7179
7181
|
},
|
|
@@ -7186,8 +7188,7 @@
|
|
|
7186
7188
|
},
|
|
7187
7189
|
"baspiRequired": ["details", "attachments"]
|
|
7188
7190
|
}
|
|
7189
|
-
]
|
|
7190
|
-
"description": "If yes, please give details together with certification from BBA or KIWA and the installation warranty for the work carried out."
|
|
7191
|
+
]
|
|
7191
7192
|
}
|
|
7192
7193
|
}
|
|
7193
7194
|
},
|
|
@@ -7196,6 +7197,7 @@
|
|
|
7196
7197
|
"rdsRef": "Certificates/{category='energyEfficiency',standard='EPC',gradeLevelRating=?},Certificates/{category='energyEfficiency',standard='EPC',status='exempt'},",
|
|
7197
7198
|
"title": "Energy Efficiency",
|
|
7198
7199
|
"type": "object",
|
|
7200
|
+
"baspiRequired": ["certificate"],
|
|
7199
7201
|
"properties": {
|
|
7200
7202
|
"certificate": {
|
|
7201
7203
|
"baspiRef": "A1.8.3.1",
|
|
@@ -12499,16 +12501,13 @@
|
|
|
12499
12501
|
"baspiRef": "A13",
|
|
12500
12502
|
"title": "Consumer Protection Regulations Declaration",
|
|
12501
12503
|
"type": "object",
|
|
12502
|
-
"
|
|
12504
|
+
"required": ["consumerProtectionRegulationsResponse"],
|
|
12503
12505
|
"properties": {
|
|
12504
12506
|
"consumerProtectionRegulationsResponse": {
|
|
12505
12507
|
"baspiRef": "A13.1",
|
|
12506
12508
|
"title": "Seller’s declaration",
|
|
12507
12509
|
"description": "I/we confirm the answers to be truthful and accurate and to the best of my/our knowledge. The questions have been designed to assist with the disclosure of material information and any misleading or incorrect answers are likely to be exposed later in the legal process which may hinder my/our sale. I/we will provide my property lawyer with the additional documentation in support of the information supplied on this form. If there are any changes which alter the information provided, I/we will immediately notify the person marketing the property as well as my/our property lawyer.",
|
|
12508
|
-
"
|
|
12509
|
-
"type": "string",
|
|
12510
|
-
"enum": ["true", "false"]
|
|
12511
|
-
}
|
|
12510
|
+
"type": "boolean"
|
|
12512
12511
|
}
|
|
12513
12512
|
}
|
|
12514
12513
|
}
|
|
@@ -14297,13 +14296,10 @@
|
|
|
14297
14296
|
"willRemoveAllRubbish": {
|
|
14298
14297
|
"baspiRef": "B7.1",
|
|
14299
14298
|
"rdsRef": "RightsHolders/Flags",
|
|
14300
|
-
"
|
|
14299
|
+
"ta6Ref": "14.4",
|
|
14301
14300
|
"title": "Please confirm that on completion you will remove all rubbish and items not included in the sale from the property including its garden, loft and any sheds or outbuildings.",
|
|
14302
14301
|
"description": "When the property is cleared out you will be expected to take reasonable care when clearing the property, leaving it clean and tidy and repairing any damage caused when removing items from the property and making safe any light or electrical fittings which are being removed.\n\nKeys for all door and window locks, along with any alarm codes, should be available for the buyer on the day of completion. If there is any reason why you cannot do this you should let the estate agent and your property lawyer know. For all internet connected services eg doorbells, boiler controls, burglar alarms, CCTV cameras etc) access to them will need to be provided to the buyer on the day of completion so that they can control them or sign up to the service. If there is any reason why you cannot do this you should let the estate agent and your property lawyer know.",
|
|
14303
|
-
"
|
|
14304
|
-
"type": "string",
|
|
14305
|
-
"enum": ["true", "false"]
|
|
14306
|
-
}
|
|
14302
|
+
"type": "boolean"
|
|
14307
14303
|
},
|
|
14308
14304
|
"otherPropertyInChain": {
|
|
14309
14305
|
"baspiRef": "B7.2",
|
|
@@ -14503,7 +14499,7 @@
|
|
|
14503
14499
|
"baspiRef": "B8",
|
|
14504
14500
|
"title": "Confirmation to be supplied by all owners or their representative",
|
|
14505
14501
|
"type": "object",
|
|
14506
|
-
"
|
|
14502
|
+
"required": [
|
|
14507
14503
|
"confirmWillProvideAdditionalDocumentation",
|
|
14508
14504
|
"confirmInformationIsAccurate"
|
|
14509
14505
|
],
|
|
@@ -14511,18 +14507,12 @@
|
|
|
14511
14507
|
"confirmWillProvideAdditionalDocumentation": {
|
|
14512
14508
|
"baspiRef": "B8.1",
|
|
14513
14509
|
"title": "I/we will provide my property lawyer with the additional documentation in support of the information supplied.",
|
|
14514
|
-
"
|
|
14515
|
-
"type": "string",
|
|
14516
|
-
"enum": ["true", "false"]
|
|
14517
|
-
}
|
|
14510
|
+
"type": "boolean"
|
|
14518
14511
|
},
|
|
14519
14512
|
"confirmInformationIsAccurate": {
|
|
14520
14513
|
"baspiRef": "B8.2",
|
|
14521
14514
|
"title": "I/we confirm that all information provided is accurate to the best of our knowledge and if we become aware of any change to/changes which alter the information supplied/provided prior to exchange of contracts for the sale of the property, I/we will update immediately notify the person marketing the property as well as my/our property lawyer. All sellers should sign this form",
|
|
14522
|
-
"
|
|
14523
|
-
"type": "string",
|
|
14524
|
-
"enum": ["true", "false"]
|
|
14525
|
-
}
|
|
14515
|
+
"type": "boolean"
|
|
14526
14516
|
}
|
|
14527
14517
|
}
|
|
14528
14518
|
}
|
package/src/schemas/v2/core.json
CHANGED
|
@@ -6476,11 +6476,11 @@
|
|
|
6476
6476
|
}
|
|
6477
6477
|
]
|
|
6478
6478
|
},
|
|
6479
|
-
"
|
|
6479
|
+
"sprayFoamInsulation": {
|
|
6480
6480
|
"title": "Has spray foam insulation been installed at the property?",
|
|
6481
6481
|
"type": "object",
|
|
6482
6482
|
"properties": {
|
|
6483
|
-
"
|
|
6483
|
+
"hasSprayFoamInstalled": {
|
|
6484
6484
|
"type": "string",
|
|
6485
6485
|
"title": "",
|
|
6486
6486
|
"enum": [
|
|
@@ -6492,7 +6492,7 @@
|
|
|
6492
6492
|
"oneOf": [
|
|
6493
6493
|
{
|
|
6494
6494
|
"properties": {
|
|
6495
|
-
"
|
|
6495
|
+
"hasSprayFoamInstalled": {
|
|
6496
6496
|
"enum": [
|
|
6497
6497
|
"No"
|
|
6498
6498
|
]
|
|
@@ -6501,13 +6501,13 @@
|
|
|
6501
6501
|
},
|
|
6502
6502
|
{
|
|
6503
6503
|
"properties": {
|
|
6504
|
-
"
|
|
6504
|
+
"hasSprayFoamInstalled": {
|
|
6505
6505
|
"enum": [
|
|
6506
6506
|
"Yes"
|
|
6507
6507
|
]
|
|
6508
6508
|
},
|
|
6509
6509
|
"details": {
|
|
6510
|
-
"title": "
|
|
6510
|
+
"title": "Please give details together with certification from BBA or KIWA and the installation warranty for the work carried out",
|
|
6511
6511
|
"type": "string",
|
|
6512
6512
|
"minLength": 1
|
|
6513
6513
|
},
|
|
@@ -6521,8 +6521,7 @@
|
|
|
6521
6521
|
}
|
|
6522
6522
|
}
|
|
6523
6523
|
}
|
|
6524
|
-
]
|
|
6525
|
-
"description": "If yes, please give details together with certification from BBA or KIWA and the installation warranty for the work carried out."
|
|
6524
|
+
]
|
|
6526
6525
|
}
|
|
6527
6526
|
}
|
|
6528
6527
|
},
|
|
@@ -151,6 +151,7 @@
|
|
|
151
151
|
"insurance",
|
|
152
152
|
"boundaries",
|
|
153
153
|
"rightsAndInformalArrangements",
|
|
154
|
+
"environmentalIssues",
|
|
154
155
|
"otherIssues",
|
|
155
156
|
"additionalInformation",
|
|
156
157
|
"consumerProtectionRegulationsDeclaration"
|
|
@@ -6654,7 +6655,8 @@
|
|
|
6654
6655
|
"title": "Type of Construction",
|
|
6655
6656
|
"required": [
|
|
6656
6657
|
"isStandardForm",
|
|
6657
|
-
"
|
|
6658
|
+
"buildingSafetyRemediation",
|
|
6659
|
+
"sprayFoamInsulation"
|
|
6658
6660
|
],
|
|
6659
6661
|
"properties": {
|
|
6660
6662
|
"isStandardForm": {
|
|
@@ -6770,17 +6772,16 @@
|
|
|
6770
6772
|
},
|
|
6771
6773
|
"type": "object"
|
|
6772
6774
|
},
|
|
6773
|
-
"
|
|
6775
|
+
"sprayFoamInsulation": {
|
|
6774
6776
|
"baspiRef": "A1.8.4",
|
|
6775
6777
|
"title": "Has spray foam insulation been installed at the property?",
|
|
6776
|
-
"description": "If yes, please give details together with certification from BBA or KIWA and the installation warranty for the work carried out.",
|
|
6777
6778
|
"discriminator": {
|
|
6778
|
-
"propertyName": "
|
|
6779
|
+
"propertyName": "hasSprayFoamInstalled"
|
|
6779
6780
|
},
|
|
6780
6781
|
"oneOf": [
|
|
6781
6782
|
{
|
|
6782
6783
|
"properties": {
|
|
6783
|
-
"
|
|
6784
|
+
"hasSprayFoamInstalled": {
|
|
6784
6785
|
"enum": [
|
|
6785
6786
|
"No"
|
|
6786
6787
|
]
|
|
@@ -6789,14 +6790,14 @@
|
|
|
6789
6790
|
},
|
|
6790
6791
|
{
|
|
6791
6792
|
"properties": {
|
|
6792
|
-
"
|
|
6793
|
+
"hasSprayFoamInstalled": {
|
|
6793
6794
|
"enum": [
|
|
6794
6795
|
"Yes"
|
|
6795
6796
|
]
|
|
6796
6797
|
},
|
|
6797
6798
|
"details": {
|
|
6798
6799
|
"baspiRef": "A1.8.4.2",
|
|
6799
|
-
"title": "
|
|
6800
|
+
"title": "Please give details together with certification from BBA or KIWA and the installation warranty for the work carried out",
|
|
6800
6801
|
"type": "string",
|
|
6801
6802
|
"minLength": 1
|
|
6802
6803
|
},
|
|
@@ -6817,10 +6818,10 @@
|
|
|
6817
6818
|
}
|
|
6818
6819
|
],
|
|
6819
6820
|
"required": [
|
|
6820
|
-
"
|
|
6821
|
+
"hasSprayFoamInstalled"
|
|
6821
6822
|
],
|
|
6822
6823
|
"properties": {
|
|
6823
|
-
"
|
|
6824
|
+
"hasSprayFoamInstalled": {
|
|
6824
6825
|
"baspiRef": "A1.8.4.1",
|
|
6825
6826
|
"enum": [
|
|
6826
6827
|
"Yes",
|
|
@@ -6838,6 +6839,9 @@
|
|
|
6838
6839
|
"energyEfficiency": {
|
|
6839
6840
|
"baspiRef": "A1.8.3",
|
|
6840
6841
|
"title": "Energy Efficiency",
|
|
6842
|
+
"required": [
|
|
6843
|
+
"certificate"
|
|
6844
|
+
],
|
|
6841
6845
|
"properties": {
|
|
6842
6846
|
"certificate": {
|
|
6843
6847
|
"baspiRef": "A1.8.3.1",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"insurance",
|
|
62
62
|
"boundaries",
|
|
63
63
|
"rightsAndInformalArrangements",
|
|
64
|
+
"environmentalIssues",
|
|
64
65
|
"otherIssues",
|
|
65
66
|
"additionalInformation",
|
|
66
67
|
"consumerProtectionRegulationsDeclaration"
|
|
@@ -1204,7 +1205,8 @@
|
|
|
1204
1205
|
"title": "Type of Construction",
|
|
1205
1206
|
"required": [
|
|
1206
1207
|
"isStandardForm",
|
|
1207
|
-
"
|
|
1208
|
+
"buildingSafetyRemediation",
|
|
1209
|
+
"sprayFoamInsulation"
|
|
1208
1210
|
],
|
|
1209
1211
|
"properties": {
|
|
1210
1212
|
"isStandardForm": {
|
|
@@ -1309,17 +1311,16 @@
|
|
|
1309
1311
|
}
|
|
1310
1312
|
}
|
|
1311
1313
|
},
|
|
1312
|
-
"
|
|
1314
|
+
"sprayFoamInsulation": {
|
|
1313
1315
|
"baspiRef": "A1.8.4",
|
|
1314
1316
|
"title": "Has spray foam insulation been installed at the property?",
|
|
1315
|
-
"description": "If yes, please give details together with certification from BBA or KIWA and the installation warranty for the work carried out.",
|
|
1316
1317
|
"discriminator": {
|
|
1317
|
-
"propertyName": "
|
|
1318
|
+
"propertyName": "hasSprayFoamInstalled"
|
|
1318
1319
|
},
|
|
1319
1320
|
"oneOf": [
|
|
1320
1321
|
{
|
|
1321
1322
|
"properties": {
|
|
1322
|
-
"
|
|
1323
|
+
"hasSprayFoamInstalled": {
|
|
1323
1324
|
"enum": [
|
|
1324
1325
|
"No"
|
|
1325
1326
|
]
|
|
@@ -1328,14 +1329,14 @@
|
|
|
1328
1329
|
},
|
|
1329
1330
|
{
|
|
1330
1331
|
"properties": {
|
|
1331
|
-
"
|
|
1332
|
+
"hasSprayFoamInstalled": {
|
|
1332
1333
|
"enum": [
|
|
1333
1334
|
"Yes"
|
|
1334
1335
|
]
|
|
1335
1336
|
},
|
|
1336
1337
|
"details": {
|
|
1337
1338
|
"baspiRef": "A1.8.4.2",
|
|
1338
|
-
"title": "
|
|
1339
|
+
"title": "Please give details together with certification from BBA or KIWA and the installation warranty for the work carried out"
|
|
1339
1340
|
},
|
|
1340
1341
|
"attachments": {
|
|
1341
1342
|
"baspiRef": "A1.8.4.3",
|
|
@@ -1353,10 +1354,10 @@
|
|
|
1353
1354
|
}
|
|
1354
1355
|
],
|
|
1355
1356
|
"required": [
|
|
1356
|
-
"
|
|
1357
|
+
"hasSprayFoamInstalled"
|
|
1357
1358
|
],
|
|
1358
1359
|
"properties": {
|
|
1359
|
-
"
|
|
1360
|
+
"hasSprayFoamInstalled": {
|
|
1360
1361
|
"baspiRef": "A1.8.4.1",
|
|
1361
1362
|
"enum": [
|
|
1362
1363
|
"Yes",
|
|
@@ -1370,6 +1371,9 @@
|
|
|
1370
1371
|
"energyEfficiency": {
|
|
1371
1372
|
"baspiRef": "A1.8.3",
|
|
1372
1373
|
"title": "Energy Efficiency",
|
|
1374
|
+
"required": [
|
|
1375
|
+
"certificate"
|
|
1376
|
+
],
|
|
1373
1377
|
"properties": {
|
|
1374
1378
|
"certificate": {
|
|
1375
1379
|
"baspiRef": "A1.8.3.1",
|
|
@@ -10,6 +10,14 @@ const {
|
|
|
10
10
|
} = require("../../../index.js");
|
|
11
11
|
const exampleTransaction = require("../../examples/v1/exampleTransaction.json");
|
|
12
12
|
|
|
13
|
+
const getV1Subschema = (path) => {
|
|
14
|
+
return getSubschema(
|
|
15
|
+
path,
|
|
16
|
+
"https://trust.propdata.org.uk/schemas/v1/pdtf-transaction.json",
|
|
17
|
+
null
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
13
21
|
test("exports a property pack schema", () => {
|
|
14
22
|
expect(transactionSchema).not.toBeNull();
|
|
15
23
|
});
|
|
@@ -65,45 +73,45 @@ test("correctly identifies an array invalid path", () => {
|
|
|
65
73
|
});
|
|
66
74
|
|
|
67
75
|
test("correctly gets a subschema", () => {
|
|
68
|
-
const subschema =
|
|
76
|
+
const subschema = getV1Subschema("/propertyPack/materialFacts/notices");
|
|
69
77
|
expect(subschema.title).toBe("Notices which Affect the Property");
|
|
70
78
|
});
|
|
71
79
|
|
|
72
80
|
test("correctly gets a subschema through an arrays element", () => {
|
|
73
|
-
const subschema =
|
|
81
|
+
const subschema = getV1Subschema(
|
|
74
82
|
"/propertyPack/titlesToBeSold/0/registerExtract"
|
|
75
83
|
);
|
|
76
84
|
expect(subschema.title).toBe("HMLR Official Copy Register Extract");
|
|
77
85
|
});
|
|
78
86
|
|
|
79
87
|
test("correctly gets another subschema through an arrays element", () => {
|
|
80
|
-
const subschema =
|
|
88
|
+
const subschema = getV1Subschema("/participants/0/name/firstName");
|
|
81
89
|
expect(subschema.title).toBe("First name");
|
|
82
90
|
});
|
|
83
91
|
|
|
84
92
|
test("correctly gets a subschema through a dependency", () => {
|
|
85
|
-
const subschema =
|
|
93
|
+
const subschema = getV1Subschema(
|
|
86
94
|
"/propertyPack/materialFacts/delayFactors/hasDelayFactors/details"
|
|
87
95
|
);
|
|
88
96
|
expect(subschema.title).toBe("Details");
|
|
89
97
|
});
|
|
90
98
|
|
|
91
99
|
test("correctly gets another subschema through a dependency", () => {
|
|
92
|
-
const subschema =
|
|
100
|
+
const subschema = getV1Subschema(
|
|
93
101
|
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/lengthOfLeaseInYears"
|
|
94
102
|
);
|
|
95
103
|
expect(subschema.title).toBe("Length of lease (years)");
|
|
96
104
|
});
|
|
97
105
|
|
|
98
106
|
test("correctly gets yet another subschema through a dependency", () => {
|
|
99
|
-
const subschema =
|
|
107
|
+
const subschema = getV1Subschema(
|
|
100
108
|
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/rentIncrease/details"
|
|
101
109
|
);
|
|
102
110
|
expect(subschema.title).toBe("Details");
|
|
103
111
|
});
|
|
104
112
|
|
|
105
113
|
test("correctly gets yet, yet another subschema through a dependency", () => {
|
|
106
|
-
const subschema =
|
|
114
|
+
const subschema = getV1Subschema(
|
|
107
115
|
"/propertyPack/materialFacts/listingAndConservation/isConservationArea/yesNo"
|
|
108
116
|
);
|
|
109
117
|
expect(subschema.type).toBe("string");
|
|
@@ -111,7 +119,7 @@ test("correctly gets yet, yet another subschema through a dependency", () => {
|
|
|
111
119
|
});
|
|
112
120
|
|
|
113
121
|
test("correctly gets yet, yet, yet another subschema through a dependency", () => {
|
|
114
|
-
const subschema =
|
|
122
|
+
const subschema = getV1Subschema(
|
|
115
123
|
"/propertyPack/materialFacts/otherIssues/flooding/typeOfFlooding/groundWater/yesNo"
|
|
116
124
|
);
|
|
117
125
|
expect(subschema.type).toBe("string");
|
|
@@ -119,21 +127,21 @@ test("correctly gets yet, yet, yet another subschema through a dependency", () =
|
|
|
119
127
|
});
|
|
120
128
|
|
|
121
129
|
test("correctly gets yet, yet, yet another subschema through a second item dependency", () => {
|
|
122
|
-
const subschema =
|
|
130
|
+
const subschema = getV1Subschema(
|
|
123
131
|
"/propertyPack/materialFacts/otherIssues/flooding/typeOfFlooding"
|
|
124
132
|
);
|
|
125
133
|
expect(subschema.type).toBe("object");
|
|
126
134
|
});
|
|
127
135
|
|
|
128
136
|
test("correctly gets yes another subschema but through a non-baspi oneOf structure", () => {
|
|
129
|
-
const subschema =
|
|
137
|
+
const subschema = getV1Subschema(
|
|
130
138
|
"/propertyPack/titlesToBeSold/0/registerExtract/OCSummaryData/RestrictionDetails/RestrictionEntry/ChargeRestriction/EntryDetails/EntryText"
|
|
131
139
|
);
|
|
132
140
|
expect(subschema).toEqual({ type: "string" });
|
|
133
141
|
});
|
|
134
142
|
|
|
135
143
|
test("correctly gets yes another subschema but through a non-baspi oneOf structure with array option", () => {
|
|
136
|
-
const subschema =
|
|
144
|
+
const subschema = getV1Subschema(
|
|
137
145
|
"/propertyPack/titlesToBeSold/0/registerExtract/OCSummaryData/RestrictionDetails/RestrictionEntry/0/ChargeRestriction/EntryDetails/EntryText"
|
|
138
146
|
);
|
|
139
147
|
expect(subschema).toEqual({ type: "string" });
|
|
@@ -141,11 +149,11 @@ test("correctly gets yes another subschema but through a non-baspi oneOf structu
|
|
|
141
149
|
|
|
142
150
|
test("correctly gets a subschema validator which is already cached", () => {
|
|
143
151
|
const validator = getSubschemaValidator(
|
|
144
|
-
"/propertyPack/
|
|
152
|
+
"/propertyPack/materialFacts/energyEfficiency/certificate"
|
|
145
153
|
);
|
|
146
154
|
expect(validator).not.toBeNull();
|
|
147
155
|
const anotherValidator = getSubschemaValidator(
|
|
148
|
-
"/propertyPack/
|
|
156
|
+
"/propertyPack/materialFacts/energyEfficiency/certificate"
|
|
149
157
|
);
|
|
150
158
|
expect(anotherValidator).not.toBeNull();
|
|
151
159
|
});
|
|
@@ -59,46 +59,37 @@ test("sample with missing dependent required fields is invalid", () => {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
test("correctly gets a top level subschema", () => {
|
|
62
|
-
const subschema = getSubschema("/propertyPack"
|
|
62
|
+
const subschema = getSubschema("/propertyPack");
|
|
63
63
|
expect(subschema.title).toBe("Property Pack");
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
test("correctly identifies a valid path", () => {
|
|
67
|
-
const isValid = isPathValid(
|
|
68
|
-
"/propertyPack/materialFacts",
|
|
69
|
-
v2TransactionSchema
|
|
70
|
-
);
|
|
67
|
+
const isValid = isPathValid("/propertyPack/materialFacts");
|
|
71
68
|
expect(isValid).toBe(true);
|
|
72
69
|
});
|
|
73
70
|
|
|
74
71
|
test("correctly identifies an undefined invalid path", () => {
|
|
75
|
-
const isValid = isPathValid(
|
|
76
|
-
"/propertyPack/materialItems",
|
|
77
|
-
v2TransactionSchema
|
|
78
|
-
);
|
|
72
|
+
const isValid = isPathValid("/propertyPack/materialItems");
|
|
79
73
|
expect(isValid).toBe(false);
|
|
80
74
|
});
|
|
81
75
|
|
|
82
76
|
test("correctly identifies an error generating invalid path", () => {
|
|
83
77
|
const isValid = isPathValid(
|
|
84
78
|
"/propertyPack/materialItems/someProperty/item",
|
|
85
|
-
|
|
79
|
+
schemaId
|
|
86
80
|
);
|
|
87
81
|
expect(isValid).toBe(false);
|
|
88
82
|
});
|
|
89
83
|
|
|
90
84
|
test("correctly identifies an array invalid path", () => {
|
|
91
|
-
const isValid = isPathValid(
|
|
92
|
-
"/propertyPack/materialFacts/1/item",
|
|
93
|
-
v2TransactionSchema
|
|
94
|
-
);
|
|
85
|
+
const isValid = isPathValid("/propertyPack/materialFacts/1/item");
|
|
95
86
|
expect(isValid).toBe(false);
|
|
96
87
|
});
|
|
97
88
|
|
|
98
89
|
test("correctly gets a subschema", () => {
|
|
99
90
|
const subschema = getSubschema(
|
|
100
91
|
"/propertyPack/materialFacts/notices",
|
|
101
|
-
|
|
92
|
+
schemaId
|
|
102
93
|
);
|
|
103
94
|
expect(subschema.title).toBe("Notices which Affect the Property");
|
|
104
95
|
});
|
|
@@ -106,7 +97,7 @@ test("correctly gets a subschema", () => {
|
|
|
106
97
|
test("correctly gets a subschema through an arrays element", () => {
|
|
107
98
|
const subschema = getSubschema(
|
|
108
99
|
"/propertyPack/titlesToBeSold/0/registerExtract",
|
|
109
|
-
|
|
100
|
+
schemaId
|
|
110
101
|
);
|
|
111
102
|
expect(Object.keys(subschema.properties)).toEqual([
|
|
112
103
|
"OCSummaryData",
|
|
@@ -117,7 +108,7 @@ test("correctly gets a subschema through an arrays element", () => {
|
|
|
117
108
|
test("correctly gets a subschema through a dependency", () => {
|
|
118
109
|
const subschema = getSubschema(
|
|
119
110
|
"/propertyPack/materialFacts/delayFactors/hasDelayFactors/details",
|
|
120
|
-
|
|
111
|
+
schemaId
|
|
121
112
|
);
|
|
122
113
|
expect(subschema.title).toBe("Details");
|
|
123
114
|
});
|
|
@@ -125,16 +116,16 @@ test("correctly gets a subschema through a dependency", () => {
|
|
|
125
116
|
test("correctly gets another subschema through a dependency", () => {
|
|
126
117
|
const subschema = getSubschema(
|
|
127
118
|
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/leaseholdInformation/general/leaseTerm/lengthOfLeaseInYears",
|
|
128
|
-
|
|
119
|
+
schemaId
|
|
129
120
|
);
|
|
130
121
|
expect(subschema.title).toBe("Length of lease (years)");
|
|
131
122
|
});
|
|
132
123
|
|
|
133
124
|
test("correctly gets yet another subschema through a dependency", () => {
|
|
134
125
|
const subschema = getSubschema(
|
|
135
|
-
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/
|
|
126
|
+
"/propertyPack/materialFacts/ownership/ownershipsToBeTransferred/0/leaseholdInformation/groundRent/rentSubjectToIncrease/rentIncreaseCalculated"
|
|
136
127
|
);
|
|
137
|
-
expect(subschema.title).toBe("
|
|
128
|
+
expect(subschema.title).toBe("How is the increase calculated?");
|
|
138
129
|
});
|
|
139
130
|
|
|
140
131
|
test("correctly gets yet, yet another subschema through a dependency", () => {
|
|
@@ -147,7 +138,7 @@ test("correctly gets yet, yet another subschema through a dependency", () => {
|
|
|
147
138
|
|
|
148
139
|
test("correctly gets yet, yet, yet another subschema through a dependency", () => {
|
|
149
140
|
const subschema = getSubschema(
|
|
150
|
-
"/propertyPack/materialFacts/
|
|
141
|
+
"/propertyPack/materialFacts/environmentalIssues/flooding/typeOfFlooding/groundWater/yesNo"
|
|
151
142
|
);
|
|
152
143
|
expect(subschema.type).toBe("string");
|
|
153
144
|
expect(subschema.enum).toStrictEqual(["Yes", "No"]);
|
|
@@ -155,7 +146,7 @@ test("correctly gets yet, yet, yet another subschema through a dependency", () =
|
|
|
155
146
|
|
|
156
147
|
test("correctly gets yet, yet, yet another subschema through a second item dependency", () => {
|
|
157
148
|
const subschema = getSubschema(
|
|
158
|
-
"/propertyPack/materialFacts/
|
|
149
|
+
"/propertyPack/materialFacts/environmentalIssues/flooding/typeOfFlooding"
|
|
159
150
|
);
|
|
160
151
|
expect(subschema.type).toBe("object");
|
|
161
152
|
});
|
|
@@ -176,11 +167,11 @@ test("correctly gets yes another subschema but through a non-baspi oneOf structu
|
|
|
176
167
|
|
|
177
168
|
test("correctly gets a subschema validator which is already cached", () => {
|
|
178
169
|
const validator = getSubschemaValidator(
|
|
179
|
-
"/propertyPack/
|
|
170
|
+
"/propertyPack/materialFacts/energyEfficiency/certificate"
|
|
180
171
|
);
|
|
181
172
|
expect(validator).not.toBeNull();
|
|
182
173
|
const anotherValidator = getSubschemaValidator(
|
|
183
|
-
"/propertyPack/
|
|
174
|
+
"/propertyPack/materialFacts/energyEfficiency/certificate"
|
|
184
175
|
);
|
|
185
176
|
expect(anotherValidator).not.toBeNull();
|
|
186
177
|
});
|