@pdtf/schemas 3.0.0-9 → 3.0.1-2
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/LICENSE +21 -0
- package/package.json +1 -1
- package/src/examples/v3/exampleAddParticipantVouch.json +32 -0
- package/src/examples/v3/exampleDocumentedVouch.json +40 -0
- package/src/examples/v3/exampleElectronicRecord.json +30 -0
- package/src/examples/v3/exampleTransaction.json +716 -668
- package/src/examples/v3/exampleVouch.json +25 -0
- package/src/schemas/v2/combined.json +10 -2
- package/src/schemas/v2/overlays/baspi.json +14 -2
- package/src/schemas/v2/overlays/ta6.json +7 -0
- package/src/schemas/v2/pdtf-transaction.json +4 -6
- package/src/schemas/v2/skeleton.json +2 -1
- package/src/schemas/v3/combined.json +22993 -22893
- package/src/schemas/v3/overlays/baspi.json +5825 -6167
- package/src/schemas/v3/overlays/con29DW.json +568 -557
- package/src/schemas/v3/overlays/con29R.json +1 -1
- package/src/schemas/v3/overlays/fme1.json +1039 -1039
- package/src/schemas/v3/overlays/llc1.json +5 -5
- package/src/schemas/v3/overlays/lpe1.json +1720 -1680
- package/src/schemas/v3/overlays/nts.json +1436 -1245
- package/src/schemas/v3/overlays/oc1.json +821 -821
- package/src/schemas/v3/overlays/piq.json +2295 -2494
- package/src/schemas/v3/overlays/rds.json +2899 -3191
- package/src/schemas/v3/overlays/ta10.json +5280 -4282
- package/src/schemas/v3/overlays/ta6.json +3160 -3089
- package/src/schemas/v3/overlays/ta7.json +1071 -807
- package/src/schemas/v3/pdtf-transaction.json +19396 -18694
- package/src/schemas/v3/skeleton.json +2808 -2755
- package/src/tests/v3/transactionSchema.test.js +57 -46
- package/src/tests/v3/verifiedClaimsValidator.test.js +13 -13
- package/src/utils/extractOverlay.js +13 -6
|
@@ -22,17 +22,15 @@ test("exports a property pack schema, v3 with no overlay by default", () => {
|
|
|
22
22
|
// expect(testSchema.$id).toEqual(
|
|
23
23
|
// "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json"
|
|
24
24
|
// );
|
|
25
|
-
expect(
|
|
26
|
-
|
|
27
|
-
)
|
|
25
|
+
expect(testSchema.properties.propertyPack.properties.baspiRef).toEqual(
|
|
26
|
+
undefined
|
|
27
|
+
);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
test("sample is valid BASPI", () => {
|
|
31
31
|
const testSchema = getTransactionSchema(schemaId, ["baspiV4"]);
|
|
32
|
-
expect(
|
|
33
|
-
|
|
34
|
-
).toEqual("A");
|
|
35
|
-
const validator = getValidator(schemaId);
|
|
32
|
+
expect(testSchema.properties.propertyPack.baspiRef).toEqual("0");
|
|
33
|
+
const validator = getValidator(schemaId, ["baspiV4"]);
|
|
36
34
|
const isValid = validator(exampleTransaction);
|
|
37
35
|
if (!isValid) console.log(validator.errors);
|
|
38
36
|
expect(isValid).toBe(true);
|
|
@@ -49,7 +47,7 @@ test("invalid sample is invalid", () => {
|
|
|
49
47
|
const clonedExampleTransaction = JSON.parse(
|
|
50
48
|
JSON.stringify(exampleTransaction)
|
|
51
49
|
);
|
|
52
|
-
delete clonedExampleTransaction.propertyPack.
|
|
50
|
+
delete clonedExampleTransaction.propertyPack.notices;
|
|
53
51
|
const validator = getValidator(schemaId, ["baspiV4"]);
|
|
54
52
|
const isValid = validator(clonedExampleTransaction);
|
|
55
53
|
expect(isValid).toBe(false);
|
|
@@ -59,7 +57,7 @@ test("sample with missing dependent required fields is invalid", () => {
|
|
|
59
57
|
const clonedExampleTransaction = JSON.parse(
|
|
60
58
|
JSON.stringify(exampleTransaction)
|
|
61
59
|
);
|
|
62
|
-
clonedExampleTransaction.propertyPack.
|
|
60
|
+
clonedExampleTransaction.propertyPack.ownership.ownershipsToBeTransferred[0].ownershipType =
|
|
63
61
|
"leasehold";
|
|
64
62
|
const validator = getValidator(schemaId);
|
|
65
63
|
const isValid = validator(clonedExampleTransaction);
|
|
@@ -72,7 +70,7 @@ test("correctly gets a top level subschema", () => {
|
|
|
72
70
|
});
|
|
73
71
|
|
|
74
72
|
test("correctly identifies a valid path", () => {
|
|
75
|
-
const isValid = isPathValid("/propertyPack
|
|
73
|
+
const isValid = isPathValid("/propertyPack");
|
|
76
74
|
expect(isValid).toBe(true);
|
|
77
75
|
});
|
|
78
76
|
|
|
@@ -90,15 +88,12 @@ test("correctly identifies an error generating invalid path", () => {
|
|
|
90
88
|
});
|
|
91
89
|
|
|
92
90
|
test("correctly identifies an array invalid path", () => {
|
|
93
|
-
const isValid = isPathValid("/propertyPack/
|
|
91
|
+
const isValid = isPathValid("/propertyPack/1/item");
|
|
94
92
|
expect(isValid).toBe(false);
|
|
95
93
|
});
|
|
96
94
|
|
|
97
95
|
test("correctly gets a subschema", () => {
|
|
98
|
-
const subschema = getSubschema(
|
|
99
|
-
"/propertyPack/materialFacts/notices",
|
|
100
|
-
schemaId
|
|
101
|
-
);
|
|
96
|
+
const subschema = getSubschema("/propertyPack/notices", schemaId);
|
|
102
97
|
expect(subschema.title).toBe("Notices which Affect the Property");
|
|
103
98
|
});
|
|
104
99
|
|
|
@@ -108,14 +103,14 @@ test("correctly gets a subschema through an arrays element", () => {
|
|
|
108
103
|
schemaId
|
|
109
104
|
);
|
|
110
105
|
expect(Object.keys(subschema.properties)).toEqual([
|
|
111
|
-
"
|
|
112
|
-
"
|
|
106
|
+
"ocSummaryData",
|
|
107
|
+
"ocRegisterData",
|
|
113
108
|
]);
|
|
114
109
|
});
|
|
115
110
|
|
|
116
111
|
test("correctly gets a subschema through a dependency", () => {
|
|
117
112
|
const subschema = getSubschema(
|
|
118
|
-
"/propertyPack/
|
|
113
|
+
"/propertyPack/delayFactors/hasDelayFactors/details",
|
|
119
114
|
schemaId
|
|
120
115
|
);
|
|
121
116
|
expect(subschema.title).toBe(
|
|
@@ -125,7 +120,7 @@ test("correctly gets a subschema through a dependency", () => {
|
|
|
125
120
|
|
|
126
121
|
test("correctly gets another subschema through a dependency", () => {
|
|
127
122
|
const subschema = getSubschema(
|
|
128
|
-
"/propertyPack/
|
|
123
|
+
"/propertyPack/ownership/ownershipsToBeTransferred/0/leaseholdInformation/leaseTerm/lengthOfLeaseInYears",
|
|
129
124
|
schemaId
|
|
130
125
|
);
|
|
131
126
|
expect(subschema.title).toBe("Length of lease (years)");
|
|
@@ -133,14 +128,14 @@ test("correctly gets another subschema through a dependency", () => {
|
|
|
133
128
|
|
|
134
129
|
test("correctly gets yet another subschema through a dependency", () => {
|
|
135
130
|
const subschema = getSubschema(
|
|
136
|
-
"/propertyPack/
|
|
131
|
+
"/propertyPack/ownership/ownershipsToBeTransferred/0/leaseholdInformation/groundRent/rentSubjectToIncrease/rentIncreaseCalculated"
|
|
137
132
|
);
|
|
138
133
|
expect(subschema.title).toBe("How is the increase calculated?");
|
|
139
134
|
});
|
|
140
135
|
|
|
141
136
|
test("correctly gets yet, yet another subschema through a dependency", () => {
|
|
142
137
|
const subschema = getSubschema(
|
|
143
|
-
"/propertyPack/
|
|
138
|
+
"/propertyPack/listingAndConservation/isConservationArea/yesNo"
|
|
144
139
|
);
|
|
145
140
|
expect(subschema.type).toBe("string");
|
|
146
141
|
expect(subschema.enum).toStrictEqual(["Yes", "No", "Not known"]);
|
|
@@ -148,28 +143,28 @@ test("correctly gets yet, yet another subschema through a dependency", () => {
|
|
|
148
143
|
|
|
149
144
|
test("correctly gets yet, yet, yet another subschema through a second item dependency", () => {
|
|
150
145
|
const subschema = getSubschema(
|
|
151
|
-
"/propertyPack/
|
|
146
|
+
"/propertyPack/environmentalIssues/flooding/historicalFlooding/typeOfFlooding"
|
|
152
147
|
);
|
|
153
148
|
expect(subschema.type).toBe("array");
|
|
154
149
|
});
|
|
155
150
|
|
|
156
151
|
test("correctly gets yes another subschema but through a non-baspi oneOf structure", () => {
|
|
157
152
|
const subschema = getSubschema(
|
|
158
|
-
"/propertyPack/titlesToBeSold/0/registerExtract/
|
|
153
|
+
"/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/restrictionDetails/restrictionEntry/chargeRestriction/entryDetails/entryText"
|
|
159
154
|
);
|
|
160
155
|
expect(subschema).toEqual({ type: "string" });
|
|
161
156
|
});
|
|
162
157
|
|
|
163
158
|
test("correctly gets yes another subschema but through a non-baspi oneOf structure with array option", () => {
|
|
164
159
|
const subschema = getSubschema(
|
|
165
|
-
"/propertyPack/titlesToBeSold/0/registerExtract/
|
|
160
|
+
"/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/restrictionDetails/restrictionEntry/0/chargeRestriction/entryDetails/entryText"
|
|
166
161
|
);
|
|
167
162
|
expect(subschema).toEqual({ type: "string" });
|
|
168
163
|
});
|
|
169
164
|
|
|
170
165
|
test("correctly gets an overlaid enum in a subschema", () => {
|
|
171
166
|
const subschema = getSubschema(
|
|
172
|
-
"/propertyPack/
|
|
167
|
+
"/propertyPack/electricity/mainsElectricity/yesNo",
|
|
173
168
|
schemaId,
|
|
174
169
|
["nts2023"]
|
|
175
170
|
);
|
|
@@ -178,7 +173,7 @@ test("correctly gets an overlaid enum in a subschema", () => {
|
|
|
178
173
|
|
|
179
174
|
test("correctly gets a subschema with multiple overlays", () => {
|
|
180
175
|
const subschema = getSubschema(
|
|
181
|
-
"/propertyPack/
|
|
176
|
+
"/propertyPack/parking/parkingArrangements",
|
|
182
177
|
schemaId,
|
|
183
178
|
["baspiV4", "ta6ed4"]
|
|
184
179
|
);
|
|
@@ -188,11 +183,11 @@ test("correctly gets a subschema with multiple overlays", () => {
|
|
|
188
183
|
|
|
189
184
|
test("correctly gets a subschema validator which is already cached", () => {
|
|
190
185
|
const validator = getSubschemaValidator(
|
|
191
|
-
"/propertyPack/
|
|
186
|
+
"/propertyPack/energyEfficiency/certificate"
|
|
192
187
|
);
|
|
193
188
|
expect(validator).not.toBeNull();
|
|
194
189
|
const anotherValidator = getSubschemaValidator(
|
|
195
|
-
"/propertyPack/
|
|
190
|
+
"/propertyPack/energyEfficiency/certificate"
|
|
196
191
|
);
|
|
197
192
|
expect(anotherValidator).not.toBeNull();
|
|
198
193
|
});
|
|
@@ -204,13 +199,32 @@ test("correctly gets a subschema validator for a TA6 overlay", () => {
|
|
|
204
199
|
"ta6ed4",
|
|
205
200
|
]);
|
|
206
201
|
let isValid = validator(data);
|
|
207
|
-
// console.log(validator.errors);
|
|
208
202
|
expect(isValid).toBe(true);
|
|
209
203
|
});
|
|
210
204
|
|
|
205
|
+
test("correctly gets a subschema validator for a TA7 overlay", () => {
|
|
206
|
+
const path = "/propertyPack";
|
|
207
|
+
const data = jp.get(exampleTransaction, path);
|
|
208
|
+
const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
|
|
209
|
+
"ta7ed3",
|
|
210
|
+
]);
|
|
211
|
+
let isValid = validator(data);
|
|
212
|
+
expect(isValid).toBe(false);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test("correctly gets a subschema validator for a TA10 overlay", () => {
|
|
216
|
+
const path = "/propertyPack";
|
|
217
|
+
const data = jp.get(exampleTransaction, path);
|
|
218
|
+
const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
|
|
219
|
+
"ta10ed3",
|
|
220
|
+
]);
|
|
221
|
+
let isValid = validator(data);
|
|
222
|
+
expect(isValid).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
|
|
211
225
|
test("correctly gets a subschema validator for a TA6 overlay which validates", () => {
|
|
212
226
|
const path =
|
|
213
|
-
"/propertyPack/
|
|
227
|
+
"/propertyPack/guaranteesWarrantiesAndIndemnityInsurances/subsidenceWork";
|
|
214
228
|
const data = { yesNo: "Yes" };
|
|
215
229
|
const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
|
|
216
230
|
"ta6ed4",
|
|
@@ -228,7 +242,7 @@ test("correctly gets a subschema validator for a TA6 overlay which validates wit
|
|
|
228
242
|
JSON.stringify(exampleTransaction)
|
|
229
243
|
);
|
|
230
244
|
const data = jp.get(exampleTransaction, path);
|
|
231
|
-
data.
|
|
245
|
+
data.uprn = undefined;
|
|
232
246
|
const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
|
|
233
247
|
"ta6ed4",
|
|
234
248
|
]);
|
|
@@ -242,7 +256,7 @@ test("correctly gets a subschema validator for a TA6 overlay which validates wit
|
|
|
242
256
|
JSON.stringify(exampleTransaction)
|
|
243
257
|
);
|
|
244
258
|
const data = jp.get(clonedExampleTransaction, path);
|
|
245
|
-
data.
|
|
259
|
+
data.smartHomeSystems = undefined;
|
|
246
260
|
const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
|
|
247
261
|
"ta6ed4",
|
|
248
262
|
]);
|
|
@@ -256,7 +270,7 @@ test("correctly gets a subschema validator for a TA6 overlay which fails to vali
|
|
|
256
270
|
JSON.stringify(exampleTransaction)
|
|
257
271
|
);
|
|
258
272
|
const data = jp.get(clonedExampleTransaction, path);
|
|
259
|
-
data.
|
|
273
|
+
data.waterAndDrainage = {};
|
|
260
274
|
const validator = getSubschemaValidator(path, exampleTransaction.$schema, [
|
|
261
275
|
"ta6ed4",
|
|
262
276
|
]);
|
|
@@ -291,7 +305,7 @@ test("correctly gets a subschema validator for an TA7 overlay", () => {
|
|
|
291
305
|
});
|
|
292
306
|
|
|
293
307
|
test("correctly gets a subschema validator which validates", () => {
|
|
294
|
-
const path = "/propertyPack/
|
|
308
|
+
const path = "/propertyPack/notices";
|
|
295
309
|
const validator = getSubschemaValidator(path);
|
|
296
310
|
const data = jp.get(exampleTransaction, path);
|
|
297
311
|
expect(data.neighbourDevelopment.yesNo).toBe("No");
|
|
@@ -306,23 +320,20 @@ test("correctly gets titles across schemas, arrays and non-existient title prope
|
|
|
306
320
|
expect(
|
|
307
321
|
getTitleAtPath(
|
|
308
322
|
v3TransactionSchema,
|
|
309
|
-
"/propertyPack/
|
|
323
|
+
"/propertyPack/ownership/ownershipsToBeTransferred/0/ownershipType"
|
|
310
324
|
)
|
|
311
325
|
).toBe("What type of ownership is the property?");
|
|
312
326
|
|
|
313
327
|
expect(
|
|
314
328
|
getTitleAtPath(
|
|
315
329
|
v3TransactionSchema,
|
|
316
|
-
"/propertyPack/
|
|
330
|
+
"/propertyPack/ownership/ownershipsToBeTransferred/0/leaseholdInformation/leaseTerm/lengthOfLeaseInYears"
|
|
317
331
|
)
|
|
318
332
|
).toBe("Length of lease (years)");
|
|
319
333
|
|
|
320
|
-
expect(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
"/propertyPack/materialFacts/invalidPath"
|
|
324
|
-
)
|
|
325
|
-
).toBe(undefined);
|
|
334
|
+
expect(getTitleAtPath(v3TransactionSchema, "/propertyPack/invalidPath")).toBe(
|
|
335
|
+
undefined
|
|
336
|
+
);
|
|
326
337
|
|
|
327
338
|
expect(
|
|
328
339
|
getTitleAtPath(
|
|
@@ -334,28 +345,28 @@ test("correctly gets titles across schemas, arrays and non-existient title prope
|
|
|
334
345
|
expect(
|
|
335
346
|
getTitleAtPath(
|
|
336
347
|
v3TransactionSchema,
|
|
337
|
-
"/propertyPack/titlesToBeSold/0/registerExtract/
|
|
348
|
+
"/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/propertyAddress"
|
|
338
349
|
)
|
|
339
350
|
).toBe("Property address");
|
|
340
351
|
|
|
341
352
|
expect(
|
|
342
353
|
getTitleAtPath(
|
|
343
354
|
v3TransactionSchema,
|
|
344
|
-
"/propertyPack/titlesToBeSold/0/registerExtract/
|
|
355
|
+
"/propertyPack/titlesToBeSold/0/registerExtract/ocSummaryData/invalidProp"
|
|
345
356
|
)
|
|
346
357
|
).toBe(undefined);
|
|
347
358
|
|
|
348
359
|
expect(
|
|
349
360
|
getTitleAtPath(
|
|
350
361
|
v3TransactionSchema,
|
|
351
|
-
"/propertyPack/
|
|
362
|
+
"/propertyPack/energyEfficiency/certificate/currentEnergyRating"
|
|
352
363
|
)
|
|
353
364
|
).toBe("Current energy efficiency rating");
|
|
354
365
|
|
|
355
366
|
expect(
|
|
356
367
|
getTitleAtPath(
|
|
357
368
|
v3TransactionSchema,
|
|
358
|
-
"/propertyPack/
|
|
369
|
+
"/propertyPack/occupiers/othersAged17OrOver/aged17OrOverNames"
|
|
359
370
|
)
|
|
360
371
|
).toBe("Please provide their full names and ages.");
|
|
361
372
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { validateVerifiedClaims } = require("../../../index.js");
|
|
2
2
|
|
|
3
|
-
const exampleVouch = require("../../examples/
|
|
4
|
-
const exampleDocumentedVouch = require("../../examples/
|
|
3
|
+
const exampleVouch = require("../../examples/v3/exampleVouch.json");
|
|
4
|
+
const exampleDocumentedVouch = require("../../examples/v3/exampleDocumentedVouch.json");
|
|
5
5
|
const v3SchemaId =
|
|
6
6
|
"https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json";
|
|
7
7
|
|
|
@@ -19,18 +19,18 @@ test("returns an array with an error stating if path is incorrect", () => {
|
|
|
19
19
|
const originalPath = Object.keys(clonedVouch.claims)[0];
|
|
20
20
|
const data = clonedVouch.claims[originalPath];
|
|
21
21
|
clonedVouch.claims = {
|
|
22
|
-
"/propertyPack/INVALID/
|
|
22
|
+
"/propertyPack/INVALID/councilTax": data,
|
|
23
23
|
};
|
|
24
24
|
// v3 schema, no overlay
|
|
25
25
|
expect(validateVerifiedClaims([clonedVouch], v3SchemaId, null)).toEqual([
|
|
26
|
-
"Path /propertyPack/INVALID/
|
|
26
|
+
"Path /propertyPack/INVALID/councilTax is not a valid PDTF schema path",
|
|
27
27
|
]);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
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
|
-
"/propertyPack/
|
|
33
|
+
"/propertyPack/delayFactors": {
|
|
34
34
|
hasDelayFactors: { yesNo: "Yes" },
|
|
35
35
|
},
|
|
36
36
|
};
|
|
@@ -56,7 +56,7 @@ test("returns errors if BASPI requirements are not met and BASPI overlay is spec
|
|
|
56
56
|
test("returns no errors if BASPI requirements are not met and null overlay is specified", () => {
|
|
57
57
|
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
58
58
|
clonedVouch.claims = {
|
|
59
|
-
"/propertyPack/
|
|
59
|
+
"/propertyPack/delayFactors": {
|
|
60
60
|
hasDelayFactors: { yesNo: "Yes" },
|
|
61
61
|
},
|
|
62
62
|
};
|
|
@@ -67,7 +67,7 @@ test("returns no errors if BASPI requirements are not met and null overlay is sp
|
|
|
67
67
|
test("returns errors for invalid fields even if null overlay is specified", () => {
|
|
68
68
|
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
69
69
|
clonedVouch.claims = {
|
|
70
|
-
"/propertyPack/
|
|
70
|
+
"/propertyPack/delayFactors": {
|
|
71
71
|
hasDelayFactors: { yesNo: "Maybe" },
|
|
72
72
|
},
|
|
73
73
|
};
|
|
@@ -78,7 +78,7 @@ test("returns errors for invalid fields even if null overlay is specified", () =
|
|
|
78
78
|
test("returns an array of errors for verified claim with multiple paths", () => {
|
|
79
79
|
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
80
80
|
clonedVouch.claims = {
|
|
81
|
-
"/propertyPack/
|
|
81
|
+
"/propertyPack/cousncilTaxBad": {
|
|
82
82
|
councilTaxBand: "D",
|
|
83
83
|
councilTaxAffectingAlterations: {
|
|
84
84
|
yesNo: "Yes",
|
|
@@ -86,7 +86,7 @@ test("returns an array of errors for verified claim with multiple paths", () =>
|
|
|
86
86
|
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
|
-
"/propertyPack/
|
|
89
|
+
"/propertyPack/councilTaxBadTwo": {
|
|
90
90
|
councilTaxBand: "D",
|
|
91
91
|
councilTaxAffectingAlterations: {
|
|
92
92
|
yesNo: "Yes",
|
|
@@ -96,8 +96,8 @@ test("returns an array of errors for verified claim with multiple paths", () =>
|
|
|
96
96
|
},
|
|
97
97
|
};
|
|
98
98
|
expect(validateVerifiedClaims([clonedVouch], v3SchemaId, null)).toEqual([
|
|
99
|
-
"Path /propertyPack/
|
|
100
|
-
"Path /propertyPack/
|
|
99
|
+
"Path /propertyPack/cousncilTaxBad is not a valid PDTF schema path",
|
|
100
|
+
"Path /propertyPack/councilTaxBadTwo is not a valid PDTF schema path",
|
|
101
101
|
]);
|
|
102
102
|
});
|
|
103
103
|
|
|
@@ -108,7 +108,7 @@ test("returns an empty array of errors for verified claim with multiple valid pa
|
|
|
108
108
|
null
|
|
109
109
|
);
|
|
110
110
|
clonedVouch.claims = {
|
|
111
|
-
"/propertyPack/
|
|
111
|
+
"/propertyPack/councilTax": {
|
|
112
112
|
councilTaxBand: "D",
|
|
113
113
|
councilTaxAffectingAlterations: {
|
|
114
114
|
yesNo: "Yes",
|
|
@@ -116,7 +116,7 @@ test("returns an empty array of errors for verified claim with multiple valid pa
|
|
|
116
116
|
"Extension added in 2005 to add bedroom with ensuite shower room. Certificate of Compliance issued 17th Feb 2006 and council tax updated",
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
|
-
"/propertyPack/
|
|
119
|
+
"/propertyPack/address": {
|
|
120
120
|
line1: "property.line1",
|
|
121
121
|
line2: "property.line2",
|
|
122
122
|
town: "property.city",
|
|
@@ -68,6 +68,14 @@ const extractOverlay = (sourceSchema, ref) => {
|
|
|
68
68
|
if (element[property]) {
|
|
69
69
|
jp.set(returnSchema, `${path}/${property}`, element[property]);
|
|
70
70
|
}
|
|
71
|
+
// also handle properties nested in items
|
|
72
|
+
if (element.items?.[property]) {
|
|
73
|
+
jp.set(
|
|
74
|
+
returnSchema,
|
|
75
|
+
`${path}/items/${property}`,
|
|
76
|
+
element.items[property]
|
|
77
|
+
);
|
|
78
|
+
}
|
|
71
79
|
});
|
|
72
80
|
|
|
73
81
|
const { discriminator } = element;
|
|
@@ -88,11 +96,6 @@ const extractOverlay = (sourceSchema, ref) => {
|
|
|
88
96
|
// if a refEnum use that
|
|
89
97
|
const refEnum = `${ref}Enum`;
|
|
90
98
|
if (discriminatorProperty[refEnum]) {
|
|
91
|
-
// console.log(
|
|
92
|
-
// "Found refEnum",
|
|
93
|
-
// discriminatorProperty[refEnum],
|
|
94
|
-
// path
|
|
95
|
-
// );
|
|
96
99
|
jp.set(
|
|
97
100
|
returnSchema,
|
|
98
101
|
discriminatorEnumPath,
|
|
@@ -100,7 +103,6 @@ const extractOverlay = (sourceSchema, ref) => {
|
|
|
100
103
|
);
|
|
101
104
|
} else {
|
|
102
105
|
// use the base enum
|
|
103
|
-
// console.log("Found base enum", discriminatorProperty.enum, path);
|
|
104
106
|
jp.set(
|
|
105
107
|
returnSchema,
|
|
106
108
|
discriminatorEnumPath,
|
|
@@ -122,6 +124,11 @@ const extractOverlay = (sourceSchema, ref) => {
|
|
|
122
124
|
jp.set(returnSchema, `${path}/title`, element[refTitle]);
|
|
123
125
|
}
|
|
124
126
|
|
|
127
|
+
const refDescription = `${ref}Description`;
|
|
128
|
+
if (element[refDescription]) {
|
|
129
|
+
jp.set(returnSchema, `${path}/description`, element[refDescription]);
|
|
130
|
+
}
|
|
131
|
+
|
|
125
132
|
const refEnum = `${ref}Enum`;
|
|
126
133
|
if (element[refEnum]) {
|
|
127
134
|
jp.set(returnSchema, `${path}/enum`, element[refEnum]);
|