@pdtf/schemas 3.0.1-6 → 3.0.3-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/index.js +1 -0
- package/package.json +1 -1
- package/src/examples/v3/exampleTransaction.json +5 -1
- package/src/schemas/v3/combined.json +306 -29
- package/src/schemas/v3/overlays/nts.json +1 -0
- package/src/schemas/v3/overlays/ntsl.json +1641 -0
- package/src/schemas/v3/pdtf-transaction.json +40 -4
- package/src/schemas/v3/skeleton.json +6 -0
- package/src/tests/v3/transactionSchema.test.js +26 -0
- package/src/utils/extractOverlay.js +1 -8
|
@@ -19,8 +19,14 @@
|
|
|
19
19
|
"type": "string",
|
|
20
20
|
"enum": [
|
|
21
21
|
"active",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"For sale",
|
|
23
|
+
"Under offer",
|
|
24
|
+
"Sold subject to contract",
|
|
25
|
+
"Contracts exchanged",
|
|
26
|
+
"Completed",
|
|
27
|
+
"Cancelled",
|
|
28
|
+
"To let",
|
|
29
|
+
"Let agreed"
|
|
24
30
|
]
|
|
25
31
|
},
|
|
26
32
|
"participants": {
|
|
@@ -118,7 +124,9 @@
|
|
|
118
124
|
"Buyer's Agent",
|
|
119
125
|
"Surveyor",
|
|
120
126
|
"Mortgage Broker",
|
|
121
|
-
"Lender"
|
|
127
|
+
"Lender",
|
|
128
|
+
"Landlord",
|
|
129
|
+
"Tenant"
|
|
122
130
|
]
|
|
123
131
|
},
|
|
124
132
|
"externalIds": {
|
|
@@ -351,6 +359,35 @@
|
|
|
351
359
|
}
|
|
352
360
|
}
|
|
353
361
|
},
|
|
362
|
+
"lettingInformation": {
|
|
363
|
+
"title": "Letting information",
|
|
364
|
+
"type": "object",
|
|
365
|
+
"properties": {
|
|
366
|
+
"rent": {
|
|
367
|
+
"title": "Rent",
|
|
368
|
+
"type": "number",
|
|
369
|
+
"minimum": 1
|
|
370
|
+
},
|
|
371
|
+
"rentFrequency": {
|
|
372
|
+
"title": "Rent frequency",
|
|
373
|
+
"type": "string",
|
|
374
|
+
"enum": [
|
|
375
|
+
"Yearly",
|
|
376
|
+
"Quarterly",
|
|
377
|
+
"Monthly",
|
|
378
|
+
"Weekly"
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
"securityDeposit": {
|
|
382
|
+
"title": "Security deposit",
|
|
383
|
+
"type": "number"
|
|
384
|
+
},
|
|
385
|
+
"holdingDeposit": {
|
|
386
|
+
"title": "Security deposit",
|
|
387
|
+
"type": "number"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
354
391
|
"summaryDescription": {
|
|
355
392
|
"title": "Summary description",
|
|
356
393
|
"type": "string"
|
|
@@ -7697,7 +7734,6 @@
|
|
|
7697
7734
|
"items": {
|
|
7698
7735
|
"type": "string",
|
|
7699
7736
|
"enum": [
|
|
7700
|
-
"None",
|
|
7701
7737
|
"Level access",
|
|
7702
7738
|
"Ramped access",
|
|
7703
7739
|
"Lift access",
|
|
@@ -43,6 +43,32 @@ test("sample is valid NTS", () => {
|
|
|
43
43
|
expect(isValid).toBe(true);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
+
test("sample is not valid NTSL (lettings)", () => {
|
|
47
|
+
const validator = getValidator(schemaId, ["ntsl2023"]);
|
|
48
|
+
const isValid = validator(exampleTransaction);
|
|
49
|
+
expect(isValid).toBe(false);
|
|
50
|
+
expect(validator.errors[0].message).toBe(
|
|
51
|
+
"must have required property 'lettingInformation'"
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("sample is valid NTSL if we change it accordingly", () => {
|
|
56
|
+
const validator = getValidator(schemaId, ["ntsl2023"]);
|
|
57
|
+
const clonedExampleTransaction = JSON.parse(
|
|
58
|
+
JSON.stringify(exampleTransaction)
|
|
59
|
+
);
|
|
60
|
+
clonedExampleTransaction.propertyPack.lettingInformation = {
|
|
61
|
+
rent: 3500,
|
|
62
|
+
rentFrequency: "Monthly",
|
|
63
|
+
securityDeposit: 5000,
|
|
64
|
+
};
|
|
65
|
+
delete clonedExampleTransaction.propertyPack.priceInformation;
|
|
66
|
+
delete clonedExampleTransaction.propertyPack.ownership;
|
|
67
|
+
const isValid = validator(clonedExampleTransaction);
|
|
68
|
+
if (!isValid) console.log(validator.errors);
|
|
69
|
+
expect(isValid).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
|
|
46
72
|
test("invalid sample is invalid", () => {
|
|
47
73
|
const clonedExampleTransaction = JSON.parse(
|
|
48
74
|
JSON.stringify(exampleTransaction)
|
|
@@ -9,6 +9,7 @@ const combinedSchema = require("../schemas/v3/combined.json");
|
|
|
9
9
|
const extractFields = [
|
|
10
10
|
"baspi",
|
|
11
11
|
"nts",
|
|
12
|
+
"ntsl",
|
|
12
13
|
"ta6",
|
|
13
14
|
"ta7",
|
|
14
15
|
"ta10",
|
|
@@ -22,14 +23,6 @@ const extractFields = [
|
|
|
22
23
|
"oc1",
|
|
23
24
|
];
|
|
24
25
|
|
|
25
|
-
const overlayIncludeProperties = [
|
|
26
|
-
// "title",
|
|
27
|
-
// "description",
|
|
28
|
-
// "enum",
|
|
29
|
-
"discriminator",
|
|
30
|
-
// "minItems",
|
|
31
|
-
];
|
|
32
|
-
|
|
33
26
|
const flattenSkeleton = (schema) => {
|
|
34
27
|
if (!schema) return undefined;
|
|
35
28
|
let returnStructure = {};
|