@pdtf/schemas 2.0.0-0 → 2.0.0-1

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.
@@ -182,6 +182,7 @@
182
182
  "ownershipsToBeTransferred": {
183
183
  "baspiRef": "A1.3",
184
184
  "title": "Ownerships to be transferred on sale",
185
+ "minItems": 1,
185
186
  "items": {
186
187
  "baspiRef": "A1.3.0",
187
188
  "title": "Ownership to be transferred",
@@ -249,6 +250,10 @@
249
250
  "managedFreeholdOrCommonholdInformation": {
250
251
  "baspiRef": "A1.5",
251
252
  "title": "Managed freehold or commonhold information",
253
+ "required": [
254
+ "contactDetails",
255
+ "serviceCharge"
256
+ ],
252
257
  "properties": {
253
258
  "contactDetails": {
254
259
  "properties": {
@@ -305,7 +310,10 @@
305
310
  }
306
311
  }
307
312
  }
308
- }
313
+ },
314
+ "required": [
315
+ "managedFreeholdOrCommonholdInformation"
316
+ ]
309
317
  },
310
318
  {
311
319
  "properties": {
@@ -320,7 +328,7 @@
320
328
  "required": [
321
329
  "contactDetails",
322
330
  "groundRent",
323
- "ownershipAndManagement",
331
+ "transferAndRegistration",
324
332
  "serviceCharge",
325
333
  "general"
326
334
  ],
@@ -328,16 +336,28 @@
328
336
  "contactDetails": {
329
337
  "baspiRef": "A1.5.4",
330
338
  "title": "Contact Details",
339
+ "required": [
340
+ "contacts"
341
+ ],
331
342
  "properties": {
332
343
  "contacts": {
333
344
  "baspiRef": "A1.5.4.",
334
345
  "title": "Contacts",
335
346
  "description": "Complete the details for the relevant parties",
347
+ "required": [
348
+ "landlord",
349
+ "managingAgent"
350
+ ],
336
351
  "properties": {
337
352
  "landlord": {
338
353
  "baspiRef": "A1.5.4",
339
354
  "title": "Landlord",
340
355
  "description": "The landlord (or freeholder) may be, for example, a private individual, a housing association, or a management company owned by the residents",
356
+ "required": [
357
+ "nameOrOrganisation",
358
+ "address",
359
+ "emailAddress"
360
+ ],
341
361
  "properties": {
342
362
  "contact": {
343
363
  "baspiRef": "A1.5.4.1",
@@ -349,6 +369,10 @@
349
369
  "address": {
350
370
  "baspiRef": "A1.5.4.1.2",
351
371
  "title": "Address",
372
+ "required": [
373
+ "line1",
374
+ "postcode"
375
+ ],
352
376
  "properties": {
353
377
  "line1": {
354
378
  "baspiRef": "A1.5.4.1.2.1",
@@ -387,6 +411,11 @@
387
411
  "properties": {
388
412
  "contact": {
389
413
  "baspiRef": "A1.5.5.1",
414
+ "required": [
415
+ "nameOrOrganisation",
416
+ "address",
417
+ "emailAddress"
418
+ ],
390
419
  "properties": {
391
420
  "nameOrOrganisation": {
392
421
  "baspiRef": "A1.5.5.1.1",
@@ -395,6 +424,10 @@
395
424
  "address": {
396
425
  "baspiRef": "A1.5.5.1.2",
397
426
  "title": "Address",
427
+ "required": [
428
+ "line1",
429
+ "postcode"
430
+ ],
398
431
  "properties": {
399
432
  "line1": {
400
433
  "baspiRef": "A1.5.5.1.2.1",
@@ -425,12 +458,28 @@
425
458
  }
426
459
  }
427
460
  }
461
+ },
462
+ "residentTenantsAssociation": {
463
+ "properties": {
464
+ "contact": {
465
+ "required": [
466
+ "nameOrOrganisation",
467
+ "line1",
468
+ "postcode"
469
+ ]
470
+ }
471
+ }
428
472
  }
429
473
  }
430
474
  }
431
475
  }
432
476
  },
433
477
  "transferAndRegistration": {
478
+ "baspiRef": "A1.5.6",
479
+ "title": "Transfer and Registration",
480
+ "required": [
481
+ "requirementsToBeMemberOfManagementCompany"
482
+ ],
434
483
  "properties": {
435
484
  "requirementsToBeMemberOfManagementCompany": {
436
485
  "baspiRef": "A1.5.6",
@@ -494,7 +543,7 @@
494
543
  },
495
544
  "rentSubjectToIncrease": {
496
545
  "baspiRef": "A1.4.2.3",
497
- "title": "Is the rent subject to increase?",
546
+ "title": "Is the ground rent subject to increase?",
498
547
  "discriminator": {
499
548
  "propertyName": "yesNo"
500
549
  },
@@ -515,7 +564,7 @@
515
564
  "Yes"
516
565
  ]
517
566
  },
518
- "rentReviewed": {
567
+ "rentReviewFrequency": {
519
568
  "baspiRef": "A1.4.2.3.1",
520
569
  "title": "How often is the rent reviewed?"
521
570
  },
@@ -526,7 +575,7 @@
526
575
  }
527
576
  },
528
577
  "required": [
529
- "rentReviewed",
578
+ "rentReviewFrequency",
530
579
  "rentIncreaseCalculated"
531
580
  ]
532
581
  }
@@ -535,7 +584,11 @@
535
584
  "yesNo"
536
585
  ]
537
586
  }
538
- }
587
+ },
588
+ "required": [
589
+ "annualGroundRent",
590
+ "rentSubjectToIncrease"
591
+ ]
539
592
  }
540
593
  ],
541
594
  "required": [
@@ -621,8 +674,59 @@
621
674
  ]
622
675
  }
623
676
  }
677
+ },
678
+ "reserveFund": {
679
+ "baspiRef": "1.5.2.1",
680
+ "title": "Does a Reserve Fund apply to the Managed Area?",
681
+ "discriminator": {
682
+ "propertyName": "yesNo"
683
+ },
684
+ "oneOf": [
685
+ {
686
+ "properties": {
687
+ "yesNo": {
688
+ "enum": [
689
+ "No"
690
+ ]
691
+ }
692
+ }
693
+ },
694
+ {
695
+ "properties": {
696
+ "yesNo": {
697
+ "enum": [
698
+ "Yes"
699
+ ]
700
+ },
701
+ "details": {
702
+ "baspiRef": "1.5.2.1.2",
703
+ "title": "Provide details"
704
+ }
705
+ },
706
+ "required": [
707
+ "details"
708
+ ]
709
+ }
710
+ ],
711
+ "required": [
712
+ "yesNo"
713
+ ],
714
+ "properties": {
715
+ "yesNo": {
716
+ "baspiRef": "1.5.2.1.1",
717
+ "enum": [
718
+ "Yes",
719
+ "No"
720
+ ]
721
+ }
722
+ }
624
723
  }
625
- }
724
+ },
725
+ "required": [
726
+ "annualServiceCharge",
727
+ "largeAdditionalExpense",
728
+ "reserveFund"
729
+ ]
626
730
  }
627
731
  ],
628
732
  "required": [
@@ -661,7 +765,7 @@
661
765
  "properties": {
662
766
  "leaseholdType": {
663
767
  "enum": [
664
- "Shared Ownership"
768
+ "Shared ownership"
665
769
  ]
666
770
  },
667
771
  "sharedOwnershipPercentage": {
@@ -699,7 +803,7 @@
699
803
  "description": "‘Flat’ includes maisonette and apartment.",
700
804
  "enum": [
701
805
  "Flat",
702
- "Shared Ownership",
806
+ "Shared ownership",
703
807
  "Long leasehold house"
704
808
  ]
705
809
  }
@@ -722,7 +826,10 @@
722
826
  }
723
827
  }
724
828
  }
725
- }
829
+ },
830
+ "required": [
831
+ "leaseholdInformation"
832
+ ]
726
833
  },
727
834
  {
728
835
  "properties": {
@@ -6775,6 +6882,7 @@
6775
6882
  "namesOfLegalOwners": {
6776
6883
  "baspiRef": "B1.1",
6777
6884
  "title": "Names of all legal owners",
6885
+ "minItems": 1,
6778
6886
  "items": {
6779
6887
  "baspiRef": "B1.1",
6780
6888
  "title": "Legal owner",
@@ -8322,7 +8430,7 @@
8322
8430
  "titleDefectInsurance": {
8323
8431
  "baspiRef": "B5.3",
8324
8432
  "title": "Do you have any title defect insurance policies?",
8325
- "description": " e.g. for breach of planning permission, buildings regulations, restrictions, chancel repair etc",
8433
+ "description": "e.g. for breach of planning permission, buildings regulations, restrictions, chancel repair etc",
8326
8434
  "discriminator": {
8327
8435
  "propertyName": "yesNo"
8328
8436
  },
@@ -46,7 +46,7 @@
46
46
  "contact": {
47
47
  "required": [
48
48
  "nameOrOrganisation",
49
- "addressLine1",
49
+ "line1",
50
50
  "postcode",
51
51
  "telephone",
52
52
  "emailAddress"
@@ -69,7 +69,7 @@
69
69
  "contact": {
70
70
  "required": [
71
71
  "nameOrOrganisation",
72
- "addressLine1",
72
+ "line1",
73
73
  "postcode",
74
74
  "telephone",
75
75
  "emailAddress"
@@ -92,7 +92,7 @@
92
92
  "contact": {
93
93
  "required": [
94
94
  "nameOrOrganisation",
95
- "addressLine1",
95
+ "line1",
96
96
  "postcode",
97
97
  "telephone",
98
98
  "emailAddress"
@@ -115,7 +115,7 @@
115
115
  "contact": {
116
116
  "required": [
117
117
  "nameOrOrganisation",
118
- "addressLine1",
118
+ "line1",
119
119
  "postcode",
120
120
  "telephone",
121
121
  "emailAddress"
@@ -208,7 +208,7 @@
208
208
  "contact": {
209
209
  "required": [
210
210
  "nameOrOrganisation",
211
- "addressLine1",
211
+ "line1",
212
212
  "postcode",
213
213
  "telephone",
214
214
  "emailAddress"
@@ -49,15 +49,14 @@
49
49
  "lpe1Ref": "1.1",
50
50
  "title": "Landlord",
51
51
  "description": "The landlord (or freeholder) may be, for example, a private individual, a housing association, or a management company owned by the residents",
52
+ "required": [
53
+ "nameOrOrganisation",
54
+ "address",
55
+ "telephone",
56
+ "emailAddress"
57
+ ],
52
58
  "properties": {
53
59
  "contact": {
54
- "required": [
55
- "nameOrOrganisation",
56
- "addressLine1",
57
- "postcode",
58
- "telephone",
59
- "emailAddress"
60
- ],
61
60
  "properties": {
62
61
  "address": {
63
62
  "required": [
@@ -74,8 +73,7 @@
74
73
  "contact": {
75
74
  "required": [
76
75
  "nameOrOrganisation",
77
- "addressLine1",
78
- "postcode",
76
+ "address",
79
77
  "telephone",
80
78
  "emailAddress"
81
79
  ],
@@ -97,8 +95,7 @@
97
95
  "contact": {
98
96
  "required": [
99
97
  "nameOrOrganisation",
100
- "addressLine1",
101
- "postcode",
98
+ "address",
102
99
  "telephone",
103
100
  "emailAddress"
104
101
  ],
@@ -121,8 +118,7 @@
121
118
  "contact": {
122
119
  "required": [
123
120
  "nameOrOrganisation",
124
- "addressLine1",
125
- "postcode",
121
+ "address",
126
122
  "telephone",
127
123
  "emailAddress"
128
124
  ],
@@ -144,7 +140,7 @@
144
140
  "contact": {
145
141
  "required": [
146
142
  "nameOrOrganisation",
147
- "addressLine1",
143
+ "line1",
148
144
  "postcode",
149
145
  "telephone",
150
146
  "emailAddress"
@@ -167,7 +163,7 @@
167
163
  "contact": {
168
164
  "required": [
169
165
  "nameOrOrganisation",
170
- "addressLine1",
166
+ "line1",
171
167
  "postcode",
172
168
  "telephone",
173
169
  "emailAddress"
@@ -214,7 +210,7 @@
214
210
  "title": "Please provide contact details of the Lessee in charge",
215
211
  "required": [
216
212
  "nameOrOrganisation",
217
- "addressLine1",
213
+ "line1",
218
214
  "postcode",
219
215
  "telephone",
220
216
  "emailAddress"
@@ -306,7 +302,7 @@
306
302
  "contact": {
307
303
  "required": [
308
304
  "nameOrOrganisation",
309
- "addressLine1",
305
+ "line1",
310
306
  "postcode",
311
307
  "telephone",
312
308
  "emailAddress"
@@ -399,7 +395,7 @@
399
395
  "contact": {
400
396
  "required": [
401
397
  "nameOrOrganisation",
402
- "addressLine1",
398
+ "line1",
403
399
  "postcode",
404
400
  "telephone",
405
401
  "emailAddress"
@@ -716,7 +712,7 @@
716
712
  null,
717
713
  {
718
714
  "required": [
719
- "rentReviewed",
715
+ "rentReviewFrequency",
720
716
  "rentIncreaseCalculated"
721
717
  ]
722
718
  }
@@ -770,8 +766,7 @@
770
766
  "groundRentFrequency",
771
767
  "rentSubjectToIncrease",
772
768
  "groundRentPaidUpToDate",
773
- "lastDemandPeriod",
774
- "requirementsToBeMemberOfManagementCompany"
769
+ "lastDemandPeriod"
775
770
  ]
776
771
  }
777
772
  ],
@@ -955,7 +950,7 @@
955
950
  },
956
951
  "excessPaymentAnticipated": {
957
952
  "lpe1Ref": "4.3",
958
- "title": " Is any excess payment anticipated for the Property at the end of the financial year?",
953
+ "title": "Is any excess payment anticipated for the Property at the end of the financial year?",
959
954
  "discriminator": {
960
955
  "propertyName": "yesNo"
961
956
  },
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "rentSubjectToIncrease": {
54
54
  "ntsRef": "A1.5",
55
- "title": "Is the rent subject to increase?",
55
+ "title": "Is the ground rent subject to increase?",
56
56
  "discriminator": {
57
57
  "propertyName": "yesNo"
58
58
  },
@@ -2925,7 +2925,8 @@
2925
2925
  "properties": {
2926
2926
  "namesOfLegalOwners": {
2927
2927
  "rdsRef": "RightsHolders",
2928
- "title": "Names of all legal owners"
2928
+ "title": "Names of all legal owners",
2929
+ "minItems": 1
2929
2930
  }
2930
2931
  }
2931
2932
  },
@@ -3557,7 +3558,7 @@
3557
3558
  "titleDefectInsurance": {
3558
3559
  "rdsRef": "Certificates",
3559
3560
  "title": "Do you have any title defect insurance policies?",
3560
- "description": " e.g. for breach of planning permission, buildings regulations, restrictions, chancel repair etc",
3561
+ "description": "e.g. for breach of planning permission, buildings regulations, restrictions, chancel repair etc",
3561
3562
  "discriminator": {
3562
3563
  "propertyName": "yesNo"
3563
3564
  },
@@ -13,6 +13,7 @@
13
13
  "ownershipsToBeTransferred": {
14
14
  "ta7Ref": "1",
15
15
  "title": "Ownerships to be transferred on sale",
16
+ "minItems": 1,
16
17
  "items": {
17
18
  "properties": {
18
19
  "ownershipType": {
@@ -210,7 +211,7 @@
210
211
  },
211
212
  "rentSubjectToIncrease": {
212
213
  "ta7Ref": "1.2c",
213
- "title": "Is the rent subject to increase?",
214
+ "title": "Is the ground rent subject to increase?",
214
215
  "discriminator": {
215
216
  "propertyName": "yesNo"
216
217
  },
@@ -231,7 +232,7 @@
231
232
  "Yes"
232
233
  ]
233
234
  },
234
- "rentReviewed": {
235
+ "rentReviewFrequency": {
235
236
  "ta7Ref": "1.2d",
236
237
  "title": "How often is the rent reviewed?"
237
238
  },
@@ -639,7 +640,7 @@
639
640
  "description": "‘Flat’ includes maisonette and apartment.",
640
641
  "enum": [
641
642
  "Flat",
642
- "Shared Ownership",
643
+ "Shared ownership",
643
644
  "Long leasehold house"
644
645
  ]
645
646
  }
@@ -26,8 +26,23 @@ const overlayIncludeProperties = [
26
26
  "description",
27
27
  "enum",
28
28
  "discriminator",
29
+ "minItems",
29
30
  ];
30
31
 
32
+ const combineMerge = (target, source, options) => {
33
+ const destination = target.slice();
34
+ source.forEach((item, index) => {
35
+ if (typeof destination[index] === "undefined") {
36
+ destination[index] = options.cloneUnlessOtherwiseSpecified(item, options);
37
+ } else if (options.isMergeableObject(item)) {
38
+ destination[index] = merge(target[index], item, options);
39
+ } else if (target.indexOf(item) === -1) {
40
+ destination.push(item);
41
+ }
42
+ });
43
+ return destination;
44
+ };
45
+
31
46
  const extractOverlay = (sourceSchema, ref) => {
32
47
  const refName = `${ref}Ref`;
33
48
  const refRequired = `${ref}Required`;
@@ -75,6 +90,8 @@ const deleteProperties = (sourceSchema, propertyNames) => {
75
90
  return sourceSchema;
76
91
  };
77
92
 
93
+ const overlays = {};
94
+
78
95
  extractFields.forEach((key) => {
79
96
  let overlay = extractOverlay(combinedSchema, key, [
80
97
  "title",
@@ -82,6 +99,7 @@ extractFields.forEach((key) => {
82
99
  "enum",
83
100
  "discriminator",
84
101
  ]);
102
+ overlays[key] = overlay;
85
103
  const fileName = `../schemas/v2/overlays/${key}.json`;
86
104
  fs.writeFileSync(fileName, JSON.stringify(overlay, null, 2));
87
105
  console.log(`Overlay ${key} written to ${fileName}`);
@@ -98,3 +116,13 @@ fs.writeFileSync(
98
116
  JSON.stringify(coreSchema, null, 2)
99
117
  );
100
118
  console.log("Core schema written to ../schemas/v2/core.json");
119
+ console.log(overlays.baspi);
120
+ const mergedSchema = merge(overlays.baspi, coreSchema, {
121
+ arrayMerge: combineMerge,
122
+ });
123
+
124
+ fs.writeFileSync(
125
+ "../schemas/v2/merged.json",
126
+ JSON.stringify(mergedSchema, null, 2)
127
+ );
128
+ console.log("Merged schema written to ../schemas/v2/merged.json");