@pdtf/schemas 0.6.2 → 0.6.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/_config.yml +1 -0
- package/index.js +6 -4
- package/package.json +1 -1
- package/src/schemas/baspi-a-material-facts.json +1 -1
- package/src/schemas/baspi-b-legal-information.json +1 -1
- package/src/schemas/energy-performance-certificate.json +1 -1
- package/src/schemas/pdtf-transaction.json +5 -5
- package/src/schemas/pdtf-verified-claims.json +2 -2
- package/src/schemas/title-deed.json +1 -1
- package/src/tests/pdtfVerifiedClaims.test.js +14 -0
package/_config.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
theme: jekyll-theme-minimal
|
package/index.js
CHANGED
|
@@ -11,14 +11,15 @@ const geoJson = require("./src/schemas/GeoJSON.json");
|
|
|
11
11
|
const verifiedClaimsSchema = require("./src/schemas/pdtf-verified-claims.json");
|
|
12
12
|
|
|
13
13
|
const subSchemas = {
|
|
14
|
-
"https://
|
|
14
|
+
"https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-a-material-facts.json":
|
|
15
15
|
baspiMaterialFacts,
|
|
16
|
-
"https://
|
|
16
|
+
"https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-b-legal-information.json":
|
|
17
17
|
baspiLegalInformation,
|
|
18
|
-
"https://
|
|
18
|
+
"https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/energy-performance-certificate.json":
|
|
19
19
|
energyPerformanceCertificate,
|
|
20
20
|
"https://geojson.org/schema/GeoJSON.json": geoJson,
|
|
21
|
-
"https://
|
|
21
|
+
"https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/title-deed.json":
|
|
22
|
+
titleDeed,
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
const transactionSchema = dereference(pdtfTransaction, (id) => subSchemas[id]);
|
|
@@ -51,6 +52,7 @@ const isPathValid = (path) => {
|
|
|
51
52
|
return false;
|
|
52
53
|
}
|
|
53
54
|
};
|
|
55
|
+
|
|
54
56
|
const getSubschemaValidator = (path) => {
|
|
55
57
|
const subSchema = getSubschema(path);
|
|
56
58
|
let validator = ajv.getSchema(path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-a-material-facts.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "Material facts at the point of marketing",
|
|
6
6
|
"description": "BASPI v2.0 Part A - Disclosure of material facts at the point of marketing, supporting mapping to BASPI, Law Society and RICS Data Schema elements.",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-b-legal-information.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "Additional information required for the legal process",
|
|
6
6
|
"description": "A schema defining Part B of BASPI v2.0 spporting mapping to BASPI, Law Society and RICS Data Schema elements.",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/pdtf-transaction.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "Property Data Trust Framework Transaction Schema",
|
|
6
6
|
"description": "A schema defining the PDTF transaction data structure, supporting mapping to BASPI, Law Society and RICS Data Schema elements.",
|
|
@@ -98,10 +98,10 @@
|
|
|
98
98
|
"type": "object",
|
|
99
99
|
"properties": {
|
|
100
100
|
"materialFacts": {
|
|
101
|
-
"$ref": "https://
|
|
101
|
+
"$ref": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-a-material-facts.json"
|
|
102
102
|
},
|
|
103
103
|
"additionalLegalInfo": {
|
|
104
|
-
"$ref": "https://
|
|
104
|
+
"$ref": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-b-legal-information.json"
|
|
105
105
|
},
|
|
106
106
|
"titlesToBeSold": {
|
|
107
107
|
"RDSRef": "",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
},
|
|
128
128
|
"registerExtract": {
|
|
129
129
|
"title": "HMLR Register Extract",
|
|
130
|
-
"$ref": "https://
|
|
130
|
+
"$ref": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/title-deed.json"
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"energyPerformanceCertificate": {
|
|
136
136
|
"RDSRef": "",
|
|
137
137
|
"title": "Energy Performance Certificate",
|
|
138
|
-
"$ref": "https://
|
|
138
|
+
"$ref": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/energy-performance-certificate.json"
|
|
139
139
|
},
|
|
140
140
|
"risks": {
|
|
141
141
|
"RDSRef": "",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/pdtf-verified-claims.json",
|
|
4
4
|
"definitions": {
|
|
5
5
|
"date_type": {
|
|
6
6
|
"type": "string",
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
"claims": {
|
|
388
388
|
"type": "object",
|
|
389
389
|
"patternProperties": {
|
|
390
|
-
"^(/|([a-zA-Z0-9/-]+)+$)": {
|
|
390
|
+
"^(/|([a-zA-Z0-9/-]+)+$)": {}
|
|
391
391
|
},
|
|
392
392
|
"minProperties": 1,
|
|
393
393
|
"additionalProperties": false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/title-deed.json",
|
|
4
4
|
"title": "HMLR Official Copy Register Extract",
|
|
5
5
|
"description": "A schema mirroring the V2_1 XML version of the HMLR Register Extract web service.",
|
|
6
6
|
"definitions": {
|
|
@@ -29,6 +29,20 @@ test("valid documented vouch sample is valid", () => {
|
|
|
29
29
|
expect(isValid).toBe(true);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
test("sample with primitive claims value is valid", () => {
|
|
33
|
+
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
34
|
+
clonedVouch.claims = { "/propertyPack/uprn": 123456 };
|
|
35
|
+
const isValid = validator({ verified_claims: clonedVouch });
|
|
36
|
+
expect(isValid).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("sample with undefined claims value is also valid, but this would fail when the payload is validated", () => {
|
|
40
|
+
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
41
|
+
clonedVouch.claims = { "/propertyPack/uprn": undefined };
|
|
42
|
+
const isValid = validator({ verified_claims: clonedVouch });
|
|
43
|
+
expect(isValid).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
32
46
|
test("claim with missing claims is invalid", () => {
|
|
33
47
|
const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
|
|
34
48
|
delete clonedVouch.claims;
|