@pdtf/schemas 2.0.0-5 → 2.0.0-7

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 CHANGED
@@ -45,7 +45,7 @@ const validator = ajv.compile(transactionSchema);
45
45
 
46
46
  // v2, via accessor functions and overlays
47
47
  const combinedSchema = require("./src/schemas/v2/combined.json");
48
- const coreSchema = require("./src/schemas/v2/core.json");
48
+ const v2CoreSchema = require("./src/schemas/v2/pdtf-transaction.json");
49
49
 
50
50
  const baspiOverlay = require("./src/schemas/v2/overlays/baspi.json");
51
51
  // const ta6Overlay = require("./src/schemas/v2/overlays/ta6.json");
@@ -58,12 +58,13 @@ const baspiOverlay = require("./src/schemas/v2/overlays/baspi.json");
58
58
  // const rdsOverlay = require("./src/schemas/v2/overlays/rds.json");
59
59
  // const oc1Overlay = require("./src/schemas/v2/overlays/oc1.json");
60
60
 
61
- const overlays = { baspiV4: baspiOverlay };
61
+ const overlays = { baspiV4: baspiOverlay, null: {} };
62
62
 
63
63
  const transactionSchemas = {
64
64
  "https://trust.propdata.org.uk/schemas/v1/pdtf-transaction.json":
65
65
  transactionSchema,
66
- "https://trust.propdata.org.uk/schemas/v2/pdtf-transaction.json": coreSchema,
66
+ "https://trust.propdata.org.uk/schemas/v2/pdtf-transaction.json":
67
+ v2CoreSchema,
67
68
  };
68
69
 
69
70
  const combineMerge = (target, source, options) => {
@@ -139,8 +140,8 @@ const isPathValid = (path, schemaId, overlay) => {
139
140
 
140
141
  const getSubschemaValidator = (path, schemaId, overlay) => {
141
142
  const subSchema = getSubschema(path, schemaId, overlay);
142
- // see if we can retrieve the schema by path
143
- const cacheKey = `${path}-${schemaId}`;
143
+ // see if we can retrieve the schema by path, schemaId and overlay
144
+ const cacheKey = `${path}-${schemaId}-${overlay}`;
144
145
  let validator = ajv.getSchema(cacheKey);
145
146
  // retrieve whole schema by $id if available
146
147
  if (!validator && subSchema.$id) validator = ajv.getSchema(cacheKey);
@@ -195,7 +196,7 @@ const getTitleAtPath = (schema, path, rootPath = path) => {
195
196
  }
196
197
  };
197
198
 
198
- const validateVerifiedClaims = (verifiedClaims) => {
199
+ const validateVerifiedClaims = (verifiedClaims, schemaId, overlay) => {
199
200
  const validatorVClaims = ajv.compile(verifiedClaimsSchema);
200
201
 
201
202
  const validationErrorsArr = [];
@@ -213,11 +214,10 @@ const validateVerifiedClaims = (verifiedClaims) => {
213
214
 
214
215
  verifiedClaimsArray.forEach((claim) => {
215
216
  const paths = Object.keys(claim.claims);
216
-
217
217
  for (const path of paths) {
218
- const validPath = isPathValid(path);
218
+ const validPath = isPathValid(path, schemaId, overlay);
219
219
  if (validPath) {
220
- const subValidator = getSubschemaValidator(path);
220
+ const subValidator = getSubschemaValidator(path, schemaId, overlay);
221
221
  const isValid = subValidator(claim.claims[path]);
222
222
  if (!isValid) {
223
223
  validationErrorsArr.push(...subValidator.errors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdtf/schemas",
3
- "version": "2.0.0-5",
3
+ "version": "2.0.0-7",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -331,7 +331,7 @@
331
331
  "hasDelayFactors": {
332
332
  "baspiRef": "A1.2.1",
333
333
  "title": "Are you aware of any factors which might delay or complicate the sale?",
334
- "description": "E.g. family split, pending application for grant of probate, absent seller or unregistered title? If yes, provide details and likely timescale for delay (if known)",
334
+ "description": "E.g. family split, pending application for grant of probate, absent seller or unregistered title?",
335
335
  "type": "object",
336
336
  "properties": {
337
337
  "yesNo": {
@@ -360,7 +360,7 @@
360
360
  },
361
361
  "details": {
362
362
  "baspiRef": "A1.2.2",
363
- "title": "Details",
363
+ "title": "Provide details and likely timescale for delay (if known)",
364
364
  "type": "string",
365
365
  "minLength": 1
366
366
  },
@@ -434,6 +434,7 @@
434
434
  "type": "object",
435
435
  "properties": {
436
436
  "yesNo": {
437
+ "baspiRef": "A1.3.0.2.1",
437
438
  "type": "string",
438
439
  "title": "",
439
440
  "enum": ["Yes", "No"]
@@ -458,7 +459,7 @@
458
459
  },
459
460
  "details": {
460
461
  "baspiRef": "A1.3.0.2.2",
461
- "title": "describe the share for sale (e.g. Ground floor flat only)",
462
+ "title": "Describe the share for sale (e.g. Ground floor flat only)",
462
463
  "type": "string",
463
464
  "minLength": 1
464
465
  }
@@ -549,6 +550,10 @@
549
550
  "fme1Required": [
550
551
  "line1",
551
552
  "postcode"
553
+ ],
554
+ "baspiRequired": [
555
+ "line1",
556
+ "postcode"
552
557
  ]
553
558
  },
554
559
  "telephone": {
@@ -568,6 +573,12 @@
568
573
  "postcode",
569
574
  "telephone",
570
575
  "emailAddress"
576
+ ],
577
+ "baspiRequired": [
578
+ "nameOrOrganisation",
579
+ "line1",
580
+ "postcode",
581
+ "emailAddress"
571
582
  ]
572
583
  },
573
584
  "bankDetails": {
@@ -720,45 +731,38 @@
720
731
  "properties": {
721
732
  "nameOrOrganisation": {
722
733
  "baspiRef": "A1.5.5.1.1",
723
-
724
734
  "title": "Name or organisation",
725
735
  "type": "string",
726
736
  "minLength": 1
727
737
  },
728
738
  "address": {
729
739
  "baspiRef": "A1.5.5.1.2",
730
-
731
740
  "title": "Address",
732
741
  "type": "object",
733
742
  "properties": {
734
743
  "line1": {
735
744
  "baspiRef": "A1.5.5.1.2.1",
736
-
737
745
  "title": "Address line 1",
738
746
  "type": "string",
739
747
  "minLength": 1
740
748
  },
741
749
  "line2": {
742
750
  "baspiRef": "A1.5.5.1.2.2",
743
-
744
751
  "title": "Address line 2",
745
752
  "type": "string"
746
753
  },
747
754
  "line3": {
748
755
  "baspiRef": "A1.5.5.1.2.3",
749
-
750
756
  "title": "Address line 3",
751
757
  "type": "string"
752
758
  },
753
759
  "town": {
754
760
  "baspiRef": "A1.5.5.1.2.4",
755
-
756
761
  "title": "Town",
757
762
  "type": "string"
758
763
  },
759
764
  "postcode": {
760
765
  "baspiRef": "A1.5.5.1.2.5",
761
-
762
766
  "title": "Postcode",
763
767
  "type": "string",
764
768
  "minLength": 1
@@ -767,6 +771,10 @@
767
771
  "fme1Required": [
768
772
  "line1",
769
773
  "postcode"
774
+ ],
775
+ "baspiRequired": [
776
+ "line1",
777
+ "postcode"
770
778
  ]
771
779
  },
772
780
  "telephone": {
@@ -787,6 +795,13 @@
787
795
  "postcode",
788
796
  "telephone",
789
797
  "emailAddress"
798
+ ],
799
+ "baspiRequired": [
800
+ "nameOrOrganisation",
801
+ "line1",
802
+ "postcode",
803
+ "telephone",
804
+ "emailAddress"
790
805
  ]
791
806
  },
792
807
  "appointedBy": {
@@ -1233,7 +1248,7 @@
1233
1248
  "const": "Yes"
1234
1249
  },
1235
1250
  "details": {
1236
- "title": "If Yes, please detail required additional information to be included with the notice of disposition",
1251
+ "title": "Please detail required additional information to be included with the notice of disposition",
1237
1252
  "type": "string",
1238
1253
  "minLength": 1
1239
1254
  }
@@ -3825,7 +3840,7 @@
3825
3840
  "const": "Yes"
3826
3841
  },
3827
3842
  "details": {
3828
- "title": "If Yes, please detail required additional information to be included with the notice of disposition",
3843
+ "title": "Please detail required additional information to be included with the notice of disposition",
3829
3844
  "type": "string",
3830
3845
  "minLength": 1
3831
3846
  }
@@ -4185,7 +4200,7 @@
4185
4200
  "enum": ["Yes"]
4186
4201
  },
4187
4202
  "details": {
4188
- "title": "If Yes, please supply a copy or, if not in writing, please give details:",
4203
+ "title": "Please supply a copy or, if not in writing, please give details:",
4189
4204
  "type": "string",
4190
4205
  "minLength": 1
4191
4206
  }
@@ -4462,7 +4477,7 @@
4462
4477
  },
4463
4478
  "headLeaseholderControlled": {
4464
4479
  "ta7Ref": "1.2d",
4465
- "title": "If Yes, is the head leaseholder a person or company that is controlled by the tenants?",
4480
+ "title": "Is the head leaseholder a person or company that is controlled by the tenants?",
4466
4481
  "type": "string",
4467
4482
  "enum": ["Yes", "No"]
4468
4483
  }
@@ -4620,7 +4635,7 @@
4620
4635
  },
4621
4636
  "problemInServiceChargeLevel": {
4622
4637
  "ta7Ref": "5.6",
4623
- "title": "Does the seller know of any problems in the last three years regarding the level of service charges or with the management? If Yes, please give details:",
4638
+ "title": "Does the seller know of any problems in the last three years regarding the level of service charges or with the management?",
4624
4639
  "type": "object",
4625
4640
  "properties": {
4626
4641
  "yesNo": {
@@ -4647,7 +4662,7 @@
4647
4662
  "enum": ["Yes"]
4648
4663
  },
4649
4664
  "details": {
4650
- "title": "Details",
4665
+ "title": "Please give details:",
4651
4666
  "type": "string"
4652
4667
  }
4653
4668
  },
@@ -4657,7 +4672,7 @@
4657
4672
  },
4658
4673
  "serviceChargeChallenged": {
4659
4674
  "ta7Ref": "5.7",
4660
- "title": "Has the seller challenged the service charge or any expense in the last three years? If Yes, please give details:",
4675
+ "title": "Has the seller challenged the service charge or any expense in the last three years?",
4661
4676
  "type": "object",
4662
4677
  "properties": {
4663
4678
  "yesNo": {
@@ -4684,7 +4699,7 @@
4684
4699
  "enum": ["Yes"]
4685
4700
  },
4686
4701
  "details": {
4687
- "title": "Details",
4702
+ "title": "Please give details",
4688
4703
  "type": "string"
4689
4704
  }
4690
4705
  },
@@ -4700,7 +4715,7 @@
4700
4715
  },
4701
4716
  "difficultyInCollectingServiceCharge": {
4702
4717
  "ta7Ref": "5.9",
4703
- "title": "Is the seller aware of any difficulties encountered in collecting the service charges from other flat owners? If Yes, please give details:",
4718
+ "title": "Is the seller aware of any difficulties encountered in collecting the service charges from other flat owners?",
4704
4719
  "type": "object",
4705
4720
  "properties": {
4706
4721
  "yesNo": {
@@ -4727,7 +4742,7 @@
4727
4742
  "enum": ["Yes"]
4728
4743
  },
4729
4744
  "details": {
4730
- "title": "Details",
4745
+ "title": "Please give details:",
4731
4746
  "type": "string"
4732
4747
  }
4733
4748
  },
@@ -4737,7 +4752,7 @@
4737
4752
  },
4738
4753
  "serviceChargeOwed": {
4739
4754
  "ta7Ref": "5.10",
4740
- "title": "Does the seller owe any service charges, rent, insurance premium or other financial contribution? If Yes, please give details:",
4755
+ "title": "Does the seller owe any service charges, rent, insurance premium or other financial contribution?",
4741
4756
  "type": "object",
4742
4757
  "properties": {
4743
4758
  "yesNo": {
@@ -4764,7 +4779,7 @@
4764
4779
  "enum": ["Yes"]
4765
4780
  },
4766
4781
  "details": {
4767
- "title": "Details",
4782
+ "title": "Please give details",
4768
4783
  "type": "string"
4769
4784
  }
4770
4785
  },
@@ -4924,7 +4939,6 @@
4924
4939
  "properties": {
4925
4940
  "yesNo": {
4926
4941
  "baspiRef": "1.5.2.1.1",
4927
-
4928
4942
  "type": "string",
4929
4943
  "title": "",
4930
4944
  "enum": ["Yes", "No"]
@@ -5867,7 +5881,7 @@
5867
5881
  "properties": {
5868
5882
  "sellerReceivedComplaint": {
5869
5883
  "ta7Ref": "8.1",
5870
- "title": "Has the seller received any complaint from the landlord, the management company or any neighbour about anything the seller has or has not done? If Yes, please give details",
5884
+ "title": "Has the seller received any complaint from the landlord, the management company or any neighbour about anything the seller has or has not done?",
5871
5885
  "type": "object",
5872
5886
  "properties": {
5873
5887
  "yesNo": {
@@ -5894,7 +5908,7 @@
5894
5908
  "enum": ["Yes"]
5895
5909
  },
5896
5910
  "details": {
5897
- "title": "Provide details",
5911
+ "title": "Please give details",
5898
5912
  "type": "string",
5899
5913
  "minLength": 1
5900
5914
  }
@@ -5905,7 +5919,7 @@
5905
5919
  },
5906
5920
  "sellerSentComplaint": {
5907
5921
  "ta7Ref": "8.2",
5908
- "title": "Has the seller complained or had cause to complain to or about the landlord, the management company, or any neighbour? If Yes, please give details:",
5922
+ "title": "Has the seller complained or had cause to complain to or about the landlord, the management company, or any neighbour?",
5909
5923
  "type": "object",
5910
5924
  "properties": {
5911
5925
  "yesNo": {
@@ -5932,7 +5946,7 @@
5932
5946
  "enum": ["Yes"]
5933
5947
  },
5934
5948
  "details": {
5935
- "title": "Provide details",
5949
+ "title": "Please give details",
5936
5950
  "type": "string",
5937
5951
  "minLength": 1
5938
5952
  }
@@ -8756,7 +8770,6 @@
8756
8770
  "rdsRef": "WorksAlterationsChanges/isIncomplete",
8757
8771
  "ta6Ref": "4.3",
8758
8772
  "title": "Are any of the works listed above unfinished?",
8759
- "description": "If yes, please provide details and explain why.",
8760
8773
  "type": "object",
8761
8774
  "properties": {
8762
8775
  "yesNo": {
@@ -8785,7 +8798,7 @@
8785
8798
  },
8786
8799
  "details": {
8787
8800
  "baspiRef": "A3.6.2",
8788
- "title": "Details",
8801
+ "title": "Please provide details and explain why",
8789
8802
  "type": "string",
8790
8803
  "minLength": 1
8791
8804
  },
@@ -9233,7 +9246,7 @@
9233
9246
  "baspiRef": "A4.7",
9234
9247
  "rdsRef": "Property/Flags,Notifications",
9235
9248
  "ta6Ref": "3.1",
9236
- "title": "Any other type of notice",
9249
+ "title": "Any other type of notice?",
9237
9250
  "type": "object",
9238
9251
  "properties": {
9239
9252
  "yesNo": {
@@ -9370,7 +9383,7 @@
9370
9383
  },
9371
9384
  "details": {
9372
9385
  "baspiRef": "A5.2.2",
9373
- "title": "Details",
9386
+ "title": "Please state whether there is a management plan in place and attach a copy",
9374
9387
  "type": "string",
9375
9388
  "minLength": 1
9376
9389
  },
@@ -9383,15 +9396,13 @@
9383
9396
  },
9384
9397
  "baspiRequired": ["details", "attachments"]
9385
9398
  }
9386
- ],
9387
- "description": "If yes, please state whether there is a management plan in place and attach a copy"
9399
+ ]
9388
9400
  },
9389
9401
  "japaneseKnotweed": {
9390
9402
  "baspiRef": "A5.3",
9391
9403
  "rdsRef": "Property/Flags,BuildingSections/EnvironmentalIssues,Use/EnvironmentalIssues",
9392
9404
  "ta6Ref": "7.8",
9393
9405
  "title": "To your knowledge, is the property or neighbouring land, affected by Japanese knotweed or other invasive species?",
9394
- "description": "If so ",
9395
9406
  "type": "object",
9396
9407
  "properties": {
9397
9408
  "yesNo": {
@@ -10647,6 +10658,7 @@
10647
10658
  "enum": ["Yes"]
10648
10659
  },
10649
10660
  "numberOfPropertiesSharing": {
10661
+ "baspiRef": "A7.1.1.1",
10650
10662
  "ta6Ref": "A7.1.1.2",
10651
10663
  "title": "How many other properties?",
10652
10664
  "type": "integer"
@@ -10860,7 +10872,6 @@
10860
10872
  }
10861
10873
  }
10862
10874
  },
10863
-
10864
10875
  "greenDealLoan": {
10865
10876
  "baspiRef": "A7.3",
10866
10877
  "rdsRef": "RightsHolders/Loans,RightsHolders/OtherDocumentation",
@@ -10872,7 +10883,6 @@
10872
10883
  "baspiRef": "A7.3",
10873
10884
  "ta6Ref": "7.7",
10874
10885
  "title": "Is this property subject to a Green Deal loan or other financed home improvement scheme?",
10875
- "description": "If yes, please provide details below including any outstanding payments for the renewable devices and any feed-in tariffs and a copy of your last electricity bill",
10876
10886
  "type": "object",
10877
10887
  "properties": {
10878
10888
  "yesNo": {
@@ -10901,7 +10911,7 @@
10901
10911
  },
10902
10912
  "details": {
10903
10913
  "baspiRef": "A7.3.2",
10904
- "title": "Details",
10914
+ "title": "Please provide details below including any outstanding payments for the renewable devices and any feed-in tariffs and a copy of your last electricity bill",
10905
10915
  "type": "string",
10906
10916
  "minLength": 1
10907
10917
  },
@@ -11050,8 +11060,7 @@
11050
11060
  },
11051
11061
  "baspiRequired": ["attachments"]
11052
11062
  }
11053
- ],
11054
- "description": "If yes, "
11063
+ ]
11055
11064
  },
11056
11065
  "heatingLastServicedDate": {
11057
11066
  "baspiRef": "A7.4.2.1",
@@ -11540,8 +11549,7 @@
11540
11549
  },
11541
11550
  "baspiRequired": ["details", "attachments"]
11542
11551
  }
11543
- ],
11544
- "description": "If yes,"
11552
+ ]
11545
11553
  },
11546
11554
  "accessRestrictionAttempts": {
11547
11555
  "baspiRef": "A10.3",
@@ -12707,13 +12715,11 @@
12707
12715
  "areBoundariesUniform": {
12708
12716
  "baspiRef": "B2.1.0.1",
12709
12717
  "TA6Ref": "1.2",
12710
- "title": "Are the boundaries uniform?",
12711
- "type": "string",
12712
12718
  "title": "",
12719
+ "type": "string",
12713
12720
  "enum": ["Yes", "No", "N/A"]
12714
12721
  }
12715
12722
  },
12716
-
12717
12723
  "discriminator": {
12718
12724
  "propertyName": "areBoundariesUniform"
12719
12725
  },
@@ -14198,7 +14204,6 @@
14198
14204
  },
14199
14205
  "baspiRequired": ["details"]
14200
14206
  },
14201
-
14202
14207
  {
14203
14208
  "properties": {
14204
14209
  "soldWithVacantPossession": {
@@ -14516,7 +14521,7 @@
14516
14521
  },
14517
14522
  "confirmInformationIsAccurate": {
14518
14523
  "baspiRef": "B8.2",
14519
- "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",
14524
+ "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",
14520
14525
  "type": "boolean"
14521
14526
  }
14522
14527
  }
@@ -23947,7 +23952,7 @@
23947
23952
  },
23948
23953
  "suDsFeaturesWithinTheBoundaryOfTheProperty": {
23949
23954
  "con29RRef": "3.3(b)",
23950
- "title": "Are there SuDS features within the boundary of the property? If yes, is the owner responsible for maintenance?",
23955
+ "title": "Are there SuDS features within the boundary of the property?",
23951
23956
  "type": "object",
23952
23957
  "properties": {
23953
23958
  "yesNo": {
@@ -23974,7 +23979,7 @@
23974
23979
  "enum": ["Yes"]
23975
23980
  },
23976
23981
  "details": {
23977
- "title": "Details",
23982
+ "title": "Is the owner responsible for maintenance?",
23978
23983
  "type": "string",
23979
23984
  "minLength": 1
23980
23985
  }