@pdtf/schemas 0.5.14 → 0.5.15

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
@@ -38,8 +38,9 @@ const getSubschema = (path) => {
38
38
  if (pathArray.length < 1) {
39
39
  return propertyPackSchema;
40
40
  }
41
- return pathArray.reduce((propertyPackSchema, pathElement) => {
42
- return propertyPackSchema.properties[pathElement];
41
+ return pathArray.reduce((schema, pathElement) => {
42
+ if (schema.type === "array") return schema.items;
43
+ return schema.properties[pathElement];
43
44
  }, propertyPackSchema);
44
45
  };
45
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdtf/schemas",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -5,21 +5,21 @@
5
5
  "sellers": {
6
6
  "sellerInformation": [
7
7
  {
8
- "name": { "firstName": "John", "lastName": "Davies" },
8
+ "name": { "firstName": "Peter", "lastName": "Hetherington-Smythe" },
9
9
  "dateOfBirth": "1975-12-25",
10
10
  "mobileNumber": "07777 222333",
11
11
  "email": "john@theseller.com",
12
- "address": { "address1": "10 Downend Park", "postcode": "BS7 9PU" }
12
+ "address": { "address1": "47 Park Road", "postcode": "AL3 5AF" }
13
13
  }
14
14
  ]
15
15
  },
16
16
  "materialFacts": {
17
17
  "address": {
18
- "address1": "10 Downend Park",
18
+ "address1": "47 Park Road",
19
19
  "address2": "",
20
- "town": "BRISTOLS",
21
- "county": "Avon",
22
- "postcode": "BS7 9PU"
20
+ "town": "HARPENDEN",
21
+ "county": "Herts",
22
+ "postcode": "AL3 5AF"
23
23
  },
24
24
  "energyEfficiency": {
25
25
  "energyEfficiencyRating": "A"
@@ -372,6 +372,299 @@
372
372
  },
373
373
  "energyPerformanceCertificate": {
374
374
  "certificate": { "currentEnergyRating": "B" }
375
- }
375
+ },
376
+ "titlesToBeSold": [
377
+ {
378
+ "titleNumber": "HD221222",
379
+ "titleExtents": [
380
+ {
381
+ "type": "Feature",
382
+ "properties": {
383
+ "POLY_ID": 19851403,
384
+ "TITLE_NO": "HD221222",
385
+ "INSERT": "2016-02-05T13:36:55",
386
+ "UPDATE": "2016-02-05T13:36:55",
387
+ "REC_STATUS": "A"
388
+ },
389
+ "geometry": {
390
+ "type": "Polygon",
391
+ "coordinates": [
392
+ [
393
+ [-2.578781821932439, 51.48576411094672],
394
+ [-2.578669662492341, 51.48572105544199],
395
+ [-2.5786421470447154, 51.48570905261714],
396
+ [-2.5785524174118404, 51.48567442829361],
397
+ [-2.5785328794340825, 51.48566688186638],
398
+ [-2.5785279074169107, 51.4856723013566],
399
+ [-2.5784923376884157, 51.48570664492474],
400
+ [-2.5785118756765826, 51.48571419135863],
401
+ [-2.578603776881019, 51.48574970415372],
402
+ [-2.578629846557485, 51.48576126454427],
403
+ [-2.578738400129546, 51.48580388830907],
404
+ [-2.578781821932439, 51.48576411094672]
405
+ ]
406
+ ]
407
+ }
408
+ }
409
+ ],
410
+ "registerExtract": {
411
+ "OCSummaryData": {
412
+ "Title": {
413
+ "TitleNumber": "HD221222",
414
+ "ClassOfTitleCode": "10",
415
+ "TitleRegistrationDetails": {
416
+ "LatestEditionDate": "2020-11-24",
417
+ "RegistrationDate": "1991-11-11",
418
+ "DistrictName": "ST ALBANS",
419
+ "PostcodeZone": {
420
+ "Postcode": "AL3 5AF"
421
+ },
422
+ "LandRegistryOfficeName": "Leicester Office",
423
+ "AdministrativeArea": "HERTFORDSHIRE"
424
+ },
425
+ "CommonholdIndicator": "false"
426
+ },
427
+ "OfficialCopyDateTime": "2021-12-16T08:39:52",
428
+ "PropertyAddress": {
429
+ "PostcodeZone": {
430
+ "Postcode": "AL3 5AF"
431
+ },
432
+ "AddressLine": {
433
+ "Line": ["47 Park Road", "Harpenden"]
434
+ }
435
+ },
436
+ "Proprietorship": {
437
+ "RegisteredProprietorParty": [
438
+ {
439
+ "PrivateIndividual": {
440
+ "Name": {
441
+ "SurnameName": "Hetherington-Smythe",
442
+ "ForenamesName": "Peter Ronald"
443
+ }
444
+ },
445
+ "Address": {
446
+ "PostcodeZone": {
447
+ "Postcode": "AL3 5AF"
448
+ },
449
+ "AddressLine": {
450
+ "Line": ["47 Park Road", "Harpenden"]
451
+ }
452
+ }
453
+ },
454
+ {
455
+ "Address": {
456
+ "AddressLine": {
457
+ "Line": ["47 Park Road", "Harpenden"]
458
+ },
459
+ "PostcodeZone": {
460
+ "Postcode": "AL3 5AF"
461
+ }
462
+ },
463
+ "PrivateIndividual": {
464
+ "Name": {
465
+ "ForenamesName": "Clarissa Jane",
466
+ "SurnameName": "Hetherington-Smythe"
467
+ }
468
+ }
469
+ }
470
+ ],
471
+ "CurrentProprietorshipDate": "2020-11-24"
472
+ },
473
+ "EditionDate": "2020-11-24",
474
+ "DocumentDetails": {
475
+ "Document": {
476
+ "EntryNumber": ["B3", "C2", "C3", "C4"],
477
+ "PlanOnlyIndicator": "false",
478
+ "RegisterDescription": "Charge",
479
+ "DocumentType": "50",
480
+ "DocumentDate": "2020-11-03"
481
+ }
482
+ },
483
+ "RestrictionDetails": {
484
+ "RestrictionEntry": {
485
+ "ChargeRestriction": {
486
+ "ChargeID": "1",
487
+ "EntryDetails": {
488
+ "EntryNumber": "3",
489
+ "Infills": {
490
+ "ChargeDate": "2020-11-03",
491
+ "ChargeParty": "Barclays Bank UK PLC"
492
+ },
493
+ "SubRegisterCode": "B",
494
+ "EntryText": "RESTRICTION: No disposition of the registered estate by the proprietor of the registered estate is to be registered without a written consent signed by the proprietor for the time being of the Charge dated 3 November 2020 in favour of Barclays Bank UK PLC referred to in the Charges Register."
495
+ },
496
+ "RestrictionTypeCode": "30"
497
+ }
498
+ }
499
+ },
500
+ "PricePaidEntry": {
501
+ "EntryDetails": {
502
+ "EntryText": "The price stated to have been paid on 3 November 2020 was £1,100,000.",
503
+ "SubRegisterCode": "B",
504
+ "EntryNumber": "2",
505
+ "Infills": {
506
+ "Date": "2020-11-03",
507
+ "Amount": "£1,260,000"
508
+ },
509
+ "RegistrationDate": "2020-11-24"
510
+ }
511
+ },
512
+ "Charge": {
513
+ "ChargeEntry": {
514
+ "RegisteredCharge": {
515
+ "EntryDetails": {
516
+ "SubRegisterCode": "C",
517
+ "RegistrationDate": "2020-11-24",
518
+ "EntryText": "REGISTERED CHARGE dated 3 November 2020.",
519
+ "Infills": {
520
+ "ChargeDate": "2020-11-03"
521
+ },
522
+ "EntryNumber": "2"
523
+ }
524
+ },
525
+ "ChargeDate": "2020-11-03",
526
+ "ChargeID": "1",
527
+ "ChargeProprietor": {
528
+ "ChargeeParty": {
529
+ "Organization": {
530
+ "Name": "Barclays Bank UK PLC"
531
+ },
532
+ "Address": {
533
+ "AddressLine": {
534
+ "Line": ["P.O. Box 187", "Leeds"]
535
+ },
536
+ "PostcodeZone": {
537
+ "Postcode": "LS11 1AN"
538
+ }
539
+ }
540
+ },
541
+ "EntryDetails": {
542
+ "SubRegisterCode": "C",
543
+ "RegistrationDate": "2020-11-24",
544
+ "EntryNumber": "3",
545
+ "EntryText": "Proprietor: BARCLAYS BANK UK PLC (Co. Regn. No. 9740322) of P.O. Box 187, Leeds LS11 1AN."
546
+ }
547
+ }
548
+ }
549
+ },
550
+ "RegisterEntryIndicators": {
551
+ "UnidentifiedEntryIndicator": "false",
552
+ "SubChargeIndicator": "false",
553
+ "DiscountChargeIndicator": "false",
554
+ "ChargeIndicator": "true",
555
+ "PropertyDescriptionNotesIndicator": "false",
556
+ "ChargeRelatedRestrictionIndicator": "false",
557
+ "BankruptcyIndicator": "false",
558
+ "MultipleChargeIndicator": "false",
559
+ "HomeRightsChangeOfAddressIndicator": "false",
560
+ "CCBIIndicator": "false",
561
+ "AgreedNoticeIndicator": "false",
562
+ "VendorsLienIndicator": "false",
563
+ "RightOfPreEmptionIndicator": "false",
564
+ "CreditorsNoticeIndicator": "false",
565
+ "CautionIndicator": "false",
566
+ "ChargeRestrictionIndicator": "true",
567
+ "ScheduleOfLeasesIndicator": "false",
568
+ "UnilateralNoticeIndicator": "false",
569
+ "DeathOfProprietorIndicator": "false",
570
+ "RentChargeIndicator": "false",
571
+ "EquitableChargeIndicator": "false",
572
+ "ChargeeIndicator": "true",
573
+ "DeedOfPostponementIndicator": "false",
574
+ "NonChargeRestrictionIndicator": "false",
575
+ "GreenOutEntryIndicator": "false",
576
+ "UnilateralNoticeBeneficiaryIndicator": "false",
577
+ "NotedChargeIndicator": "false",
578
+ "PricePaidIndicator": "true",
579
+ "HomeRightsIndicator": "false",
580
+ "LeaseHoldTitleIndicator": "false"
581
+ }
582
+ },
583
+ "OCRegisterData": {
584
+ "ChargesRegister": {
585
+ "RegisterEntry": [
586
+ {
587
+ "EntryNumber": "1",
588
+ "EntryType": "Restrictive Covenants/Stipulations - Deed",
589
+ "EntryText": [
590
+ "A Conveyance of the land in this title dated 7 June 1946 made between (1) Jesse Catton (Vendor) and (2) Henry Dick Goodman Cunnold (Purchaser) contains the following covenants:-",
591
+ "\"THE Purchaser for himself his successors in title and assigns and to the intent that this covenant will run with the land but not so that the Purchaser is liable after he has parted with the same hereby covenants with the Vendor and his successors in title that he the Purchaser and his successors in title will observe and perform the covenants contained in the Schedule hereto.",
592
+ "THE SCHEDULE before referred to",
593
+ "(1) For ever to maintain a proper fence on the side of the boundary of the land marked !\"T\" within the boundary on the said plan.",
594
+ "(2) To observe a building line of fifteen feet from the boundary of the land fronting Park Road",
595
+ "(3) That the house or any buildings erected on the said land shall not at any time be used for the purpose of any trade manufacture or business of any description or as an asylum hospital or other institution but are to be used only as a private dwellinghouse or professional residence of a Physician Surgeon or Solicitor.",
596
+ "(4) That only one such dwellinghouse shall be on the said piece of land.\"",
597
+ "NOTE: The North Eastern boundary of the land in this title is marked \"T\""
598
+ ],
599
+ "EntryDate": "1991-11-11"
600
+ },
601
+ {
602
+ "EntryText": "REGISTERED CHARGE dated 3 November 2020.",
603
+ "EntryType": "Registered Charges",
604
+ "EntryDate": "2020-11-24",
605
+ "EntryNumber": "2"
606
+ },
607
+ {
608
+ "EntryNumber": "3",
609
+ "EntryDate": "2020-11-24",
610
+ "EntryType": "Chargee",
611
+ "EntryText": "Proprietor: BARCLAYS BANK UK PLC (Co. Regn. No. 9740322) of P.O. Box 187, Leeds LS11 1AN."
612
+ },
613
+ {
614
+ "EntryType": "Obligation",
615
+ "EntryDate": "2020-11-24",
616
+ "EntryNumber": "4",
617
+ "EntryText": "The proprietor of the Charge dated 3 November 2020 referred to above is under an obligation to make further advances. These advances will have priority to the extent afforded by section 49(3) Land Registration Act 2002."
618
+ }
619
+ ]
620
+ },
621
+ "PropertyRegister": {
622
+ "DistrictDetails": {
623
+ "EntryText": "HERTFORDSHIRE : ST ALBANS"
624
+ },
625
+ "RegisterEntry": [
626
+ {
627
+ "EntryType": "Property Description",
628
+ "EntryNumber": "1",
629
+ "EntryText": "The Freehold land shown edged with red on the plan of the above Title filed at the Registry and being 47 Park Road, Harpenden (AL3 5AF).",
630
+ "EntryDate": "1991-11-11"
631
+ },
632
+ {
633
+ "EntryNumber": "2",
634
+ "EntryText": [
635
+ "The Conveyance dated 7 June 1946 referred to in the Charges Register contains the following provision:-",
636
+ "\"IT IS hereby declared that the Purchaser shall not be entitled to any right of light or air which will restrict the free use of the adjoining property of the Vendor for building or other purpose.\""
637
+ ],
638
+ "EntryDate": "1991-11-11",
639
+ "EntryType": "Provisions"
640
+ }
641
+ ]
642
+ },
643
+ "ProprietorshipRegister": {
644
+ "RegisterEntry": [
645
+ {
646
+ "EntryDate": "2020-11-24",
647
+ "EntryText": "PROPRIETOR: PETER RONALD HETHERINGTON-SMYTH and CLARISSA JANE HETHERINGTON-SMYTH of 47 Park Mount, Harpenden AL3 5AF.",
648
+ "EntryType": "Proprietor",
649
+ "EntryNumber": "1"
650
+ },
651
+ {
652
+ "EntryText": "The price stated to have been paid on 3 November 2020 was £1,260,000.",
653
+ "EntryType": "Price Paid",
654
+ "EntryDate": "2020-11-24",
655
+ "EntryNumber": "2"
656
+ },
657
+ {
658
+ "EntryNumber": "3",
659
+ "EntryDate": "2020-11-24",
660
+ "EntryType": "Charge Restriction - B Register",
661
+ "EntryText": "RESTRICTION: No disposition of the registered estate by the proprietor of the registered estate is to be registered without a written consent signed by the proprietor for the time being of the Charge dated 3 November 2020 in favour of Barclays Bank UK PLC referred to in the Charges Register."
662
+ }
663
+ ]
664
+ }
665
+ }
666
+ }
667
+ }
668
+ ]
376
669
  }
377
670
  }
@@ -102,40 +102,6 @@
102
102
  "title": "Title Number",
103
103
  "type": "string"
104
104
  },
105
- "classTitleCode": {
106
- "RDSRef": "",
107
- "title": "Class of Title",
108
- "type": "string",
109
- "enum": [
110
- "AF",
111
- "QF",
112
- "PF",
113
- "AL",
114
- "GL",
115
- "QL",
116
- "PL",
117
- "SF",
118
- "CF",
119
- "SL",
120
- "CL",
121
- "AR",
122
- "PR",
123
- "QR",
124
- "CN"
125
- ]
126
- },
127
- "estateInterestCode": {
128
- "RDSRef": "",
129
- "title": "Estate Interest",
130
- "type": "string",
131
- "enum": ["EL", "FA", "FC", "MA", "PG", "RC", "RP", "RT"]
132
- },
133
- "registeredStatus": {
134
- "RDSRef": "",
135
- "title": "Registered Status",
136
- "type": "string",
137
- "enum": ["", "Pending"]
138
- },
139
105
  "titleExtents": {
140
106
  "RDSRef": "",
141
107
  "title": "Title Extents",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://homebuyingandsellinggroup.co.uk/schemas/title-deed.json",
4
- "title": "Property Data Trust Framework HMLR Register Extract representation",
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": {
7
7
  "BinaryObjectType": {
@@ -107,7 +107,7 @@
107
107
  "130"
108
108
  ]
109
109
  },
110
- "Infills": { "$ref": "#/definitions/Q1InfillDetailsType" }
110
+ "Infills": { "type": "object" }
111
111
  }
112
112
  },
113
113
  "Q1PricePaidEntryType": {
@@ -131,11 +131,6 @@
131
131
  "AddressLineType": {
132
132
  "type": "object",
133
133
  "properties": {
134
- "IndexNumeric": {
135
- "type": "array",
136
- "items": { "type": "number" },
137
- "minItems": 0
138
- },
139
134
  "Line": {
140
135
  "type": "array",
141
136
  "items": { "type": "string" },
@@ -152,27 +147,22 @@
152
147
  }
153
148
  },
154
149
  "ClassOfTitleCodeType": {
155
- "type": "object",
156
- "properties": {
157
- "Value": {
158
- "type": "string",
159
- "enum": [
160
- "10",
161
- "20",
162
- "30",
163
- "40",
164
- "50",
165
- "60",
166
- "70",
167
- "80",
168
- "90",
169
- "100",
170
- "110",
171
- "120",
172
- "130"
173
- ]
174
- }
175
- }
150
+ "type": "string",
151
+ "enum": [
152
+ "10",
153
+ "20",
154
+ "30",
155
+ "40",
156
+ "50",
157
+ "60",
158
+ "70",
159
+ "80",
160
+ "90",
161
+ "100",
162
+ "110",
163
+ "120",
164
+ "130"
165
+ ]
176
166
  },
177
167
  "IndicatorType": {
178
168
  "type": "string",
@@ -198,11 +188,7 @@
198
188
  "$ref": "#/definitions/LandRegistryOfficeNameTextType"
199
189
  },
200
190
  "LatestEditionDate": { "type": "string", "format": "date" },
201
- "PostcodeZone": {
202
- "type": "array",
203
- "items": { "$ref": "#/definitions/Q1PostcodeZoneType" },
204
- "minItems": 0
205
- },
191
+ "PostcodeZone": { "$ref": "#/definitions/Q1PostcodeZoneType" },
206
192
  "RegistrationDate": { "type": "string", "format": "date" }
207
193
  }
208
194
  },
@@ -316,9 +302,14 @@
316
302
  "properties": {
317
303
  "Name": { "$ref": "#/definitions/Q1NameType" },
318
304
  "Alias": {
319
- "type": "array",
320
- "items": { "$ref": "#/definitions/Q1NameType" },
321
- "minItems": 0
305
+ "oneOf": [
306
+ {
307
+ "type": "array",
308
+ "items": { "$ref": "#/definitions/Q1NameType" },
309
+ "minItems": 0
310
+ },
311
+ { "$ref": "#/definitions/Q1NameType" }
312
+ ]
322
313
  }
323
314
  }
324
315
  },
@@ -345,31 +336,32 @@
345
336
  "required": ["CharityName", "CharityType"],
346
337
  "properties": {
347
338
  "CharityName": {
348
- "type": "array",
349
- "items": { "type": "string" },
350
- "minItems": 1
339
+ "oneOf": [
340
+ { "type": "array", "items": { "type": "string" }, "minItems": 1 },
341
+ { "type": "string" }
342
+ ]
351
343
  },
352
344
  "CharityAddress": {
353
- "type": "array",
354
- "items": { "$ref": "#/definitions/Q1AddressType" },
355
- "minItems": 0
345
+ "oneOf": [
346
+ {
347
+ "type": "array",
348
+ "items": { "$ref": "#/definitions/Q1AddressType" },
349
+ "minItems": 0
350
+ },
351
+ { "$ref": "#/definitions/Q1AddressType" }
352
+ ]
356
353
  },
357
354
  "CharityType": { "$ref": "#/definitions/CharityCodeType" }
358
355
  }
359
356
  },
360
357
  "Q1PartyType": {
361
358
  "type": "object",
362
- "required": ["PrivateIndividual", "Organization"],
363
359
  "properties": {
364
360
  "PrivateIndividual": {
365
361
  "$ref": "#/definitions/Q1PrivateIndividualType"
366
362
  },
367
363
  "Organization": { "$ref": "#/definitions/Q1OrganizationType" },
368
- "Address": {
369
- "type": "array",
370
- "items": { "$ref": "#/definitions/Q1AddressType" },
371
- "minItems": 0
372
- },
364
+ "Address": { "$ref": "#/definitions/Q1AddressType" },
373
365
  "CharityDetails": { "$ref": "#/definitions/Q1CharityDetailsType" },
374
366
  "TradingName": { "type": "string" },
375
367
  "PartyNumber": { "type": "string" },
@@ -378,18 +370,27 @@
378
370
  },
379
371
  "Q1ProprietorshipType": {
380
372
  "type": "object",
381
- "required": ["CautionerParty", "RegisteredProprietorParty"],
382
373
  "properties": {
383
374
  "CurrentProprietorshipDate": { "type": "string", "format": "date" },
384
375
  "CautionerParty": {
385
- "type": "array",
386
- "items": { "$ref": "#/definitions/Q1PartyType" },
387
- "minItems": 1
376
+ "oneOf": [
377
+ {
378
+ "type": "array",
379
+ "items": { "$ref": "#/definitions/Q1PartyType" },
380
+ "minItems": 1
381
+ },
382
+ { "$ref": "#/definitions/Q1PartyType" }
383
+ ]
388
384
  },
389
385
  "RegisteredProprietorParty": {
390
- "type": "array",
391
- "items": { "$ref": "#/definitions/Q1PartyType" },
392
- "minItems": 1
386
+ "oneOf": [
387
+ {
388
+ "type": "array",
389
+ "items": { "$ref": "#/definitions/Q1PartyType" },
390
+ "minItems": 1
391
+ },
392
+ { "$ref": "#/definitions/Q1PartyType" }
393
+ ]
393
394
  }
394
395
  }
395
396
  },
@@ -449,9 +450,14 @@
449
450
  "required": ["RestrictionEntry"],
450
451
  "properties": {
451
452
  "RestrictionEntry": {
452
- "type": "array",
453
- "items": { "$ref": "#/definitions/Q1RestrictionEntryType" },
454
- "minItems": 1
453
+ "oneOf": [
454
+ {
455
+ "type": "array",
456
+ "items": { "$ref": "#/definitions/Q1RestrictionEntryType" },
457
+ "minItems": 1
458
+ },
459
+ { "$ref": "#/definitions/Q1RestrictionEntryType" }
460
+ ]
455
461
  }
456
462
  }
457
463
  },
@@ -468,9 +474,14 @@
468
474
  "required": ["ChargeeParty", "EntryDetails"],
469
475
  "properties": {
470
476
  "ChargeeParty": {
471
- "type": "array",
472
- "items": { "$ref": "#/definitions/Q1PartyType" },
473
- "minItems": 1
477
+ "oneOf": [
478
+ {
479
+ "type": "array",
480
+ "items": { "$ref": "#/definitions/Q1PartyType" },
481
+ "minItems": 1
482
+ },
483
+ { "$ref": "#/definitions/Q1PartyType" }
484
+ ]
474
485
  },
475
486
  "EntryDetails": { "$ref": "#/definitions/Q1EntryDetailsType" }
476
487
  }
@@ -493,9 +504,14 @@
493
504
  "RegisteredCharge": { "$ref": "#/definitions/Q1ChargeType" },
494
505
  "ChargeProprietor": { "$ref": "#/definitions/Q1ChargeProprietorType" },
495
506
  "SubCharge": {
496
- "type": "array",
497
- "items": { "$ref": "#/definitions/Q1SubChargeDetailsType" },
498
- "minItems": 0
507
+ "oneOf": [
508
+ {
509
+ "type": "array",
510
+ "items": { "$ref": "#/definitions/Q1SubChargeDetailsType" },
511
+ "minItems": 0
512
+ },
513
+ { "$ref": "#/definitions/Q1SubChargeDetailsType" }
514
+ ]
499
515
  }
500
516
  }
501
517
  },
@@ -504,9 +520,14 @@
504
520
  "required": ["ChargeEntry"],
505
521
  "properties": {
506
522
  "ChargeEntry": {
507
- "type": "array",
508
- "items": { "$ref": "#/definitions/Q1ChargeDetailsType" },
509
- "minItems": 1
523
+ "oneOf": [
524
+ {
525
+ "type": "array",
526
+ "items": { "$ref": "#/definitions/Q1ChargeDetailsType" },
527
+ "minItems": 1
528
+ },
529
+ { "$ref": "#/definitions/Q1ChargeDetailsType" }
530
+ ]
510
531
  }
511
532
  }
512
533
  },
@@ -526,9 +547,14 @@
526
547
  "required": ["AgreedNoticeEntry"],
527
548
  "properties": {
528
549
  "AgreedNoticeEntry": {
529
- "type": "array",
530
- "items": { "$ref": "#/definitions/Q1AgreedNoticeType" },
531
- "minItems": 1
550
+ "oneOf": [
551
+ {
552
+ "type": "array",
553
+ "items": { "$ref": "#/definitions/Q1AgreedNoticeType" },
554
+ "minItems": 1
555
+ },
556
+ { "$ref": "#/definitions/Q1AgreedNoticeType" }
557
+ ]
532
558
  }
533
559
  }
534
560
  },
@@ -537,9 +563,14 @@
537
563
  "required": ["EntryDetails"],
538
564
  "properties": {
539
565
  "EntryDetails": {
540
- "type": "array",
541
- "items": { "$ref": "#/definitions/Q1EntryDetailsType" },
542
- "minItems": 1
566
+ "oneOf": [
567
+ {
568
+ "type": "array",
569
+ "items": { "$ref": "#/definitions/Q1EntryDetailsType" },
570
+ "minItems": 1
571
+ },
572
+ { "$ref": "#/definitions/Q1EntryDetailsType" }
573
+ ]
543
574
  }
544
575
  }
545
576
  },
@@ -561,9 +592,14 @@
561
592
  "required": ["HomeRightsEntry"],
562
593
  "properties": {
563
594
  "HomeRightsEntry": {
564
- "type": "array",
565
- "items": { "$ref": "#/definitions/Q1HomeRightsType" },
566
- "minItems": 1
595
+ "oneOf": [
596
+ {
597
+ "type": "array",
598
+ "items": { "$ref": "#/definitions/Q1HomeRightsType" },
599
+ "minItems": 1
600
+ },
601
+ { "$ref": "#/definitions/Q1HomeRightsType" }
602
+ ]
567
603
  }
568
604
  }
569
605
  },
@@ -601,9 +637,10 @@
601
637
  },
602
638
  "DocumentDate": { "type": "string" },
603
639
  "EntryNumber": {
604
- "type": "array",
605
- "items": { "type": "string" },
606
- "minItems": 1
640
+ "oneOf": [
641
+ { "type": "array", "items": { "type": "string" }, "minItems": 1 },
642
+ { "type": "string" }
643
+ ]
607
644
  },
608
645
  "PlanOnlyIndicator": { "$ref": "#/definitions/IndicatorType" },
609
646
  "FiledUnder": { "type": "string" },
@@ -615,9 +652,14 @@
615
652
  "required": ["Document"],
616
653
  "properties": {
617
654
  "Document": {
618
- "type": "array",
619
- "items": { "$ref": "#/definitions/Q1DocumentEntryType" },
620
- "minItems": 1
655
+ "oneOf": [
656
+ {
657
+ "type": "array",
658
+ "items": { "$ref": "#/definitions/Q1DocumentEntryType" },
659
+ "minItems": 1
660
+ },
661
+ { "$ref": "#/definitions/Q1DocumentEntryType" }
662
+ ]
621
663
  }
622
664
  }
623
665
  },
@@ -636,9 +678,16 @@
636
678
  "required": ["UnilateralNoticeEntry"],
637
679
  "properties": {
638
680
  "UnilateralNoticeEntry": {
639
- "type": "array",
640
- "items": { "$ref": "#/definitions/Q1UnilateralNoticeDetailsType" },
641
- "minItems": 1
681
+ "oneOf": [
682
+ {
683
+ "type": "array",
684
+ "items": {
685
+ "$ref": "#/definitions/Q1UnilateralNoticeDetailsType"
686
+ },
687
+ "minItems": 1
688
+ },
689
+ { "$ref": "#/definitions/Q1UnilateralNoticeDetailsType" }
690
+ ]
642
691
  }
643
692
  }
644
693
  },
@@ -656,11 +705,7 @@
656
705
  "OfficialCopyDateTime": { "type": "string", "format": "date-time" },
657
706
  "EditionDate": { "type": "string", "format": "date" },
658
707
  "PricePaidEntry": { "$ref": "#/definitions/Q1PricePaidEntryType" },
659
- "PropertyAddress": {
660
- "type": "array",
661
- "items": { "$ref": "#/definitions/Q1AddressType" },
662
- "minItems": 1
663
- },
708
+ "PropertyAddress": { "$ref": "#/definitions/Q1AddressType" },
664
709
  "Title": { "$ref": "#/definitions/Q1TitleType" },
665
710
  "RegisterEntryIndicators": {
666
711
  "$ref": "#/definitions/Q1RegisterEntryIndicatorsType"
@@ -697,9 +742,10 @@
697
742
  "type": "object",
698
743
  "properties": {
699
744
  "EntryText": {
700
- "type": "array",
701
- "items": { "type": "string" },
702
- "minItems": 0
745
+ "oneOf": [
746
+ { "type": "array", "items": { "type": "string" }, "minItems": 0 },
747
+ { "type": "string" }
748
+ ]
703
749
  }
704
750
  }
705
751
  },
@@ -711,9 +757,10 @@
711
757
  "EntryDate": { "type": "string" },
712
758
  "EntryType": { "type": "string" },
713
759
  "EntryText": {
714
- "type": "array",
715
- "items": { "type": "string" },
716
- "minItems": 1
760
+ "oneOf": [
761
+ { "type": "array", "items": { "type": "string" }, "minItems": 1 },
762
+ { "type": "string" }
763
+ ]
717
764
  }
718
765
  }
719
766
  },
@@ -723,9 +770,14 @@
723
770
  "properties": {
724
771
  "ScheduleType": { "type": "string" },
725
772
  "ScheduleEntry": {
726
- "type": "array",
727
- "items": { "$ref": "#/definitions/Q1RegisterEntryType" },
728
- "minItems": 1
773
+ "oneOf": [
774
+ {
775
+ "type": "array",
776
+ "items": { "$ref": "#/definitions/Q1RegisterEntryType" },
777
+ "minItems": 1
778
+ },
779
+ { "$ref": "#/definitions/Q1RegisterEntryType" }
780
+ ]
729
781
  }
730
782
  }
731
783
  },
@@ -735,14 +787,24 @@
735
787
  "properties": {
736
788
  "DistrictDetails": { "$ref": "#/definitions/Q1DistrictDetailsType" },
737
789
  "RegisterEntry": {
738
- "type": "array",
739
- "items": { "$ref": "#/definitions/Q1RegisterEntryType" },
740
- "minItems": 1
790
+ "oneOf": [
791
+ {
792
+ "type": "array",
793
+ "items": { "$ref": "#/definitions/Q1RegisterEntryType" },
794
+ "minItems": 1
795
+ },
796
+ { "$ref": "#/definitions/Q1RegisterEntryType" }
797
+ ]
741
798
  },
742
799
  "Schedule": {
743
- "type": "array",
744
- "items": { "$ref": "#/definitions/Q1ScheduleType" },
745
- "minItems": 0
800
+ "oneOf": [
801
+ {
802
+ "type": "array",
803
+ "items": { "$ref": "#/definitions/Q1ScheduleType" },
804
+ "minItems": 0
805
+ },
806
+ { "$ref": "#/definitions/Q1ScheduleType" }
807
+ ]
746
808
  }
747
809
  }
748
810
  },
@@ -765,6 +827,7 @@
765
827
  }
766
828
  },
767
829
  "type": "object",
830
+ "required": ["OCSummaryData", "OCRegisterData"],
768
831
  "properties": {
769
832
  "OCSummaryData": {
770
833
  "title": "Official Copy Summary Data",
@@ -1,9 +1,6 @@
1
- const jp = require("jsonpointer");
2
1
  const Ajv = require("ajv");
3
2
  const addFormats = require("ajv-formats");
4
3
 
5
- const { getSubschemaValidator, getTitleAtPath } = require("../../index.js");
6
-
7
4
  const verifiedClaimsSchema = require("../schemas/pdtf-verified-claims.json");
8
5
  const exampleElectronicRecord = require("../examples/exampleElectronicRecord.json");
9
6
  const exampleVouch = require("../examples/exampleVouch.json");
@@ -11,7 +8,7 @@ const exampleDocumentedVouch = require("../examples/exampleDocumentedVouch.json"
11
8
 
12
9
  const ajv = new Ajv({
13
10
  allErrors: true,
14
- strictSchema: false
11
+ strictSchema: false,
15
12
  });
16
13
  addFormats(ajv);
17
14
 
@@ -39,7 +36,7 @@ test("claim with missing claims is invalid", () => {
39
36
  expect(isValid).toBe(false);
40
37
  });
41
38
 
42
- test.only("claim with invalid claims path is invalid", () => {
39
+ test("claim with invalid claims path is invalid", () => {
43
40
  const clonedVouch = JSON.parse(JSON.stringify(exampleVouch));
44
41
  const originalPath = Object.keys(clonedVouch.claims)[0];
45
42
  const data = clonedVouch.claims[originalPath];
@@ -15,6 +15,7 @@ test("exports a property pack schema", () => {
15
15
 
16
16
  test("sample is valid", () => {
17
17
  const isValid = validator(examplePropertyPack);
18
+ if (!isValid) console.log(validator.errors);
18
19
  expect(isValid).toBe(true);
19
20
  });
20
21
 
@@ -47,6 +48,20 @@ test("correctly gets a subschema", () => {
47
48
  expect(subschema.title).toBe("Notices which Affect the Property");
48
49
  });
49
50
 
51
+ test("correctly gets a subschema through an arrays element", () => {
52
+ const subschema = getSubschema(
53
+ "/propertyPack/titlesToBeSold/0/registerExtract"
54
+ );
55
+ expect(subschema.title).toBe("HMLR Official Copy Register Extract");
56
+ });
57
+
58
+ test("correctly gets another subschema through an arrays element", () => {
59
+ const subschema = getSubschema(
60
+ "/propertyPack/sellers/sellerInformation/0/name/firstName"
61
+ );
62
+ expect(subschema.title).toBe("First name");
63
+ });
64
+
50
65
  test("correctly gets a subschema validator which is already cached", () => {
51
66
  const validator = getSubschemaValidator(
52
67
  "/propertyPack/energyPerformanceCertificate"
@@ -58,7 +73,7 @@ test("correctly gets a subschema validator which is already cached", () => {
58
73
  expect(anotherValidator).not.toBeNull();
59
74
  });
60
75
 
61
- test("correctly gets a working subschema validator", () => {
76
+ test("correctly gets a subschema validator which validates", () => {
62
77
  const path = "/propertyPack/materialFacts/notices";
63
78
  const validator = getSubschemaValidator(path);
64
79
  const data = jp.get(examplePropertyPack, path);
@@ -102,7 +117,7 @@ test("correctly gets titles across schemas, arrays and non-existient title prope
102
117
  propertyPackSchema,
103
118
  "/propertyPack/titlesToBeSold/0/registerExtract"
104
119
  )
105
- ).toBe("Property Data Trust Framework HMLR Register Extract representation");
120
+ ).toBe("HMLR Official Copy Register Extract");
106
121
  expect(
107
122
  getTitleAtPath(
108
123
  propertyPackSchema,