@pdtf/schemas 3.6.0-dev.3 → 3.6.0-dev.30

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.
Files changed (192) hide show
  1. package/docs/ta6-certificate-permit-contract.md +51 -0
  2. package/docs/v4-mapping-and-recomposition.md +419 -0
  3. package/index.js +210 -0
  4. package/package.json +10 -1
  5. package/src/schemas/v3/combined.json +2261 -657
  6. package/src/schemas/v3/compactSkeleton.txt +120 -51
  7. package/src/schemas/v3/overlays/baspi4.json +54 -74
  8. package/src/schemas/v3/overlays/baspi5.json +54 -74
  9. package/src/schemas/v3/overlays/extensions/ac.json +2 -1
  10. package/src/schemas/v3/overlays/extensions/dk.json +3 -2
  11. package/src/schemas/v3/overlays/extensions/fd.json +2 -1
  12. package/src/schemas/v3/overlays/extensions/ic.json +44 -9
  13. package/src/schemas/v3/overlays/extensions/lc.json +3 -2
  14. package/src/schemas/v3/overlays/extensions/mi.json +2 -1
  15. package/src/schemas/v3/overlays/extensions/nd.json +3 -2
  16. package/src/schemas/v3/overlays/extensions/pc.json +3 -2
  17. package/src/schemas/v3/overlays/extensions/ph.json +2 -1
  18. package/src/schemas/v3/overlays/extensions/rw.json +4 -3
  19. package/src/schemas/v3/overlays/extensions/sc.json +8 -4
  20. package/src/schemas/v3/overlays/extensions/sd.json +3 -2
  21. package/src/schemas/v3/overlays/extensions/tr.json +3 -2
  22. package/src/schemas/v3/overlays/extensions/wg.json +2 -1
  23. package/src/schemas/v3/overlays/llc1.json +1 -2
  24. package/src/schemas/v3/overlays/lpe1.json +3 -2
  25. package/src/schemas/v3/overlays/nts.json +7 -3
  26. package/src/schemas/v3/overlays/nts2.json +9 -4
  27. package/src/schemas/v3/overlays/ntsl.json +5 -2
  28. package/src/schemas/v3/overlays/ntsl2.json +7 -3
  29. package/src/schemas/v3/overlays/piq.json +34 -25
  30. package/src/schemas/v3/overlays/rds.json +24 -50
  31. package/src/schemas/v3/overlays/sef25.json +16 -2
  32. package/src/schemas/v3/overlays/ta10.json +0 -9
  33. package/src/schemas/v3/overlays/ta6.json +39 -70
  34. package/src/schemas/v3/overlays/ta6ed6.json +331 -307
  35. package/{pensive-tesla-d0d355/src/schemas/v3/overlays/ta6.json → src/schemas/v3/overlays/ta6ed6v2.json} +1574 -1464
  36. package/src/schemas/v3/overlays/ta7.json +2 -1
  37. package/src/schemas/v3/overlays/ta7ed5.json +68 -21
  38. package/src/schemas/v3/pdtf-transaction.json +1030 -492
  39. package/src/schemas/v3/skeleton.json +163 -57
  40. package/src/schemas/v4/Gift.json +88 -0
  41. package/src/schemas/v4/Offer.json +425 -0
  42. package/src/schemas/v4/Organisation.json +167 -0
  43. package/src/schemas/v4/Person.json +321 -0
  44. package/src/schemas/v4/Property.json +27813 -0
  45. package/src/schemas/v4/Representation.json +67 -0
  46. package/src/schemas/v4/SellerCapacity.json +193 -0
  47. package/src/schemas/v4/Title.json +14660 -0
  48. package/src/schemas/v4/Transaction.json +1612 -0
  49. package/src/schemas/v4/TransactionRole.json +59 -0
  50. package/src/schemas/v4/mapping.json +1161 -0
  51. package/src/utils/checkTa6OmissionCompatibility.js +146 -0
  52. package/src/utils/extractExtensionOverlays.js +11 -2
  53. package/src/utils/extractOverlay.js +21 -0
  54. package/src/utils/generateV4Schemas.js +1358 -0
  55. package/src/utils/syncTa6ed6v2Markers.js +92 -0
  56. package/src/utils/v4.js +838 -0
  57. package/CLAUDE.md +0 -101
  58. package/pensive-tesla-d0d355/CLAUDE.md +0 -101
  59. package/pensive-tesla-d0d355/LICENSE +0 -21
  60. package/pensive-tesla-d0d355/README.md +0 -435
  61. package/pensive-tesla-d0d355/docs/branch-release-workflow.md +0 -138
  62. package/pensive-tesla-d0d355/docs/sef25-extensions-ui-spec.md +0 -355
  63. package/pensive-tesla-d0d355/index.js +0 -654
  64. package/pensive-tesla-d0d355/package-lock.json +0 -7297
  65. package/pensive-tesla-d0d355/package.json +0 -44
  66. package/pensive-tesla-d0d355/src/examples/v1/exampleAddParticipantVouch.json +0 -32
  67. package/pensive-tesla-d0d355/src/examples/v1/exampleDocumentedVouch.json +0 -40
  68. package/pensive-tesla-d0d355/src/examples/v1/exampleElectronicRecord.json +0 -30
  69. package/pensive-tesla-d0d355/src/examples/v1/exampleTransaction.json +0 -878
  70. package/pensive-tesla-d0d355/src/examples/v1/exampleVouch.json +0 -25
  71. package/pensive-tesla-d0d355/src/examples/v2/exampleTransaction.json +0 -901
  72. package/pensive-tesla-d0d355/src/examples/v3/exampleAddParticipantVouch.json +0 -38
  73. package/pensive-tesla-d0d355/src/examples/v3/exampleCustomOverlay.json +0 -55
  74. package/pensive-tesla-d0d355/src/examples/v3/exampleCustomOverlay2.json +0 -93
  75. package/pensive-tesla-d0d355/src/examples/v3/exampleDocumentedVouch.json +0 -47
  76. package/pensive-tesla-d0d355/src/examples/v3/exampleElectronicRecord.json +0 -36
  77. package/pensive-tesla-d0d355/src/examples/v3/exampleTransaction.json +0 -1038
  78. package/pensive-tesla-d0d355/src/examples/v3/exampleVouch.json +0 -32
  79. package/pensive-tesla-d0d355/src/mappings/SendPropertyDetailsRequestSchema.json +0 -1588
  80. package/pensive-tesla-d0d355/src/mappings/adf.js +0 -198
  81. package/pensive-tesla-d0d355/src/schemas/v1/GeoJSON.json +0 -1279
  82. package/pensive-tesla-d0d355/src/schemas/v1/baspiNotes.html +0 -102
  83. package/pensive-tesla-d0d355/src/schemas/v1/energy-performance-certificate.json +0 -124
  84. package/pensive-tesla-d0d355/src/schemas/v1/freehold-information.json +0 -2051
  85. package/pensive-tesla-d0d355/src/schemas/v1/leasehold-information.json +0 -2064
  86. package/pensive-tesla-d0d355/src/schemas/v1/legal-information.json +0 -1045
  87. package/pensive-tesla-d0d355/src/schemas/v1/material-facts.json +0 -2109
  88. package/pensive-tesla-d0d355/src/schemas/v1/pdtf-transaction-search-results.json +0 -40
  89. package/pensive-tesla-d0d355/src/schemas/v1/pdtf-transaction.json +0 -191
  90. package/pensive-tesla-d0d355/src/schemas/v1/searches/drainage-and-water.json +0 -261
  91. package/pensive-tesla-d0d355/src/schemas/v1/searches/local-land-charges.json +0 -69
  92. package/pensive-tesla-d0d355/src/schemas/v1/searches/local-searches-required.json +0 -857
  93. package/pensive-tesla-d0d355/src/schemas/v1/searches.json +0 -237
  94. package/pensive-tesla-d0d355/src/schemas/v1/title-deed.json +0 -841
  95. package/pensive-tesla-d0d355/src/schemas/v2/baspiNotes.html +0 -102
  96. package/pensive-tesla-d0d355/src/schemas/v2/combined.json +0 -37731
  97. package/pensive-tesla-d0d355/src/schemas/v2/overlays/baspi.json +0 -8132
  98. package/pensive-tesla-d0d355/src/schemas/v2/overlays/con29DW.json +0 -705
  99. package/pensive-tesla-d0d355/src/schemas/v2/overlays/con29R.json +0 -2956
  100. package/pensive-tesla-d0d355/src/schemas/v2/overlays/fme1.json +0 -1259
  101. package/pensive-tesla-d0d355/src/schemas/v2/overlays/llc1.json +0 -25
  102. package/pensive-tesla-d0d355/src/schemas/v2/overlays/lpe1.json +0 -2171
  103. package/pensive-tesla-d0d355/src/schemas/v2/overlays/nts.json +0 -326
  104. package/pensive-tesla-d0d355/src/schemas/v2/overlays/oc1.json +0 -2799
  105. package/pensive-tesla-d0d355/src/schemas/v2/overlays/piq.json +0 -3419
  106. package/pensive-tesla-d0d355/src/schemas/v2/overlays/rds.json +0 -3736
  107. package/pensive-tesla-d0d355/src/schemas/v2/overlays/ta10.json +0 -5306
  108. package/pensive-tesla-d0d355/src/schemas/v2/overlays/ta6.json +0 -4533
  109. package/pensive-tesla-d0d355/src/schemas/v2/overlays/ta7.json +0 -1045
  110. package/pensive-tesla-d0d355/src/schemas/v2/pdtf-transaction.json +0 -34351
  111. package/pensive-tesla-d0d355/src/schemas/v2/skeleton.json +0 -3973
  112. package/pensive-tesla-d0d355/src/schemas/v3/combined.json +0 -48469
  113. package/pensive-tesla-d0d355/src/schemas/v3/compactSkeleton.txt +0 -4519
  114. package/pensive-tesla-d0d355/src/schemas/v3/overlays/README.md +0 -299
  115. package/pensive-tesla-d0d355/src/schemas/v3/overlays/baspi4.json +0 -8025
  116. package/pensive-tesla-d0d355/src/schemas/v3/overlays/baspi5.json +0 -8175
  117. package/pensive-tesla-d0d355/src/schemas/v3/overlays/con29DW.json +0 -716
  118. package/pensive-tesla-d0d355/src/schemas/v3/overlays/con29R.json +0 -2981
  119. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ac.json +0 -333
  120. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/as.json +0 -74
  121. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/dk.json +0 -32
  122. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/dr.json +0 -73
  123. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/er.json +0 -85
  124. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/fd.json +0 -75
  125. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/hi.json +0 -51
  126. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/hs.json +0 -73
  127. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ic.json +0 -59
  128. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/jk.json +0 -96
  129. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/la.json +0 -85
  130. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/lc.json +0 -75
  131. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ma.json +0 -90
  132. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/mc.json +0 -38
  133. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/mi.json +0 -69
  134. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/nd.json +0 -43
  135. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/oa.json +0 -24
  136. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/oc.json +0 -57
  137. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/pc.json +0 -37
  138. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ph.json +0 -194
  139. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/rw.json +0 -68
  140. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sb.json +0 -73
  141. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sc.json +0 -129
  142. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sd.json +0 -63
  143. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sf.json +0 -74
  144. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/sl.json +0 -68
  145. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/ta.json +0 -252
  146. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/tf.json +0 -103
  147. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/tr.json +0 -73
  148. package/pensive-tesla-d0d355/src/schemas/v3/overlays/extensions/wg.json +0 -350
  149. package/pensive-tesla-d0d355/src/schemas/v3/overlays/fme1.json +0 -1266
  150. package/pensive-tesla-d0d355/src/schemas/v3/overlays/llc1.json +0 -25
  151. package/pensive-tesla-d0d355/src/schemas/v3/overlays/lpe1.json +0 -2199
  152. package/pensive-tesla-d0d355/src/schemas/v3/overlays/nts.json +0 -2157
  153. package/pensive-tesla-d0d355/src/schemas/v3/overlays/nts2.json +0 -2742
  154. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ntsl.json +0 -1813
  155. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ntsl2.json +0 -2217
  156. package/pensive-tesla-d0d355/src/schemas/v3/overlays/oc1.json +0 -2817
  157. package/pensive-tesla-d0d355/src/schemas/v3/overlays/piq.json +0 -3322
  158. package/pensive-tesla-d0d355/src/schemas/v3/overlays/rds.json +0 -3665
  159. package/pensive-tesla-d0d355/src/schemas/v3/overlays/sef25.json +0 -1639
  160. package/pensive-tesla-d0d355/src/schemas/v3/overlays/sr24.json +0 -38
  161. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta10.json +0 -4654
  162. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta6ed6.json +0 -6534
  163. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta7.json +0 -1537
  164. package/pensive-tesla-d0d355/src/schemas/v3/overlays/ta7ed5.json +0 -1551
  165. package/pensive-tesla-d0d355/src/schemas/v3/pdtf-transaction.json +0 -41573
  166. package/pensive-tesla-d0d355/src/schemas/v3/skeleton.json +0 -5767
  167. package/pensive-tesla-d0d355/src/schemas/verifiedClaims/README.md +0 -21
  168. package/pensive-tesla-d0d355/src/schemas/verifiedClaims/pdtf-verified-claims.json +0 -447
  169. package/pensive-tesla-d0d355/src/utils/compactSkeleton.js +0 -84
  170. package/pensive-tesla-d0d355/src/utils/countTokens.js +0 -67
  171. package/pensive-tesla-d0d355/src/utils/extractExtensionOverlays.js +0 -624
  172. package/pensive-tesla-d0d355/src/utils/extractOverlay.js +0 -381
  173. package/pensive-tesla-d0d355/src/utils/extractProperties.js +0 -44
  174. package/pensive-tesla-d0d355/src/utils/listPathTitles.js +0 -36
  175. package/pensive-tesla-d0d355/src/utils/minimalSkeleton.js +0 -85
  176. package/pensive-tesla-d0d355/src/utils/pathList.csv +0 -903
  177. package/pensive-tesla-d0d355/src/utils/pathSkeleton.js +0 -181
  178. package/src/examples/v1/exampleAddParticipantVouch.json +0 -32
  179. package/src/examples/v1/exampleDocumentedVouch.json +0 -40
  180. package/src/examples/v1/exampleElectronicRecord.json +0 -30
  181. package/src/examples/v1/exampleTransaction.json +0 -878
  182. package/src/examples/v1/exampleVouch.json +0 -25
  183. package/src/examples/v2/exampleTransaction.json +0 -901
  184. package/src/examples/v3/exampleAddParticipantVouch.json +0 -38
  185. package/src/examples/v3/exampleCustomOverlay.json +0 -55
  186. package/src/examples/v3/exampleCustomOverlay2.json +0 -93
  187. package/src/examples/v3/exampleDocumentedVouch.json +0 -47
  188. package/src/examples/v3/exampleElectronicRecord.json +0 -36
  189. package/src/examples/v3/exampleTransaction.json +0 -1038
  190. package/src/examples/v3/exampleVouch.json +0 -32
  191. package/src/mappings/SendPropertyDetailsRequestSchema.json +0 -1588
  192. package/src/mappings/adf.js +0 -198
@@ -1,299 +0,0 @@
1
- # PDTF Schema Overlays
2
-
3
- This directory contains overlay schemas that extend the base PDTF transaction schema with form-specific properties and requirements. Overlays use a merging system that allows flexible composition of schema features.
4
-
5
- ## Overview
6
-
7
- The PDTF schema system uses a base transaction schema (`pdtf-transaction.json`) combined with overlays to create form-specific schemas. Each overlay contains:
8
-
9
- - Form-specific references (e.g., `ntsRef`, `baspiRef`)
10
- - Additional required fields
11
- - Form-specific titles and descriptions
12
- - Enhanced validation rules
13
-
14
- ## Main Form Overlays
15
-
16
- ### Property Information Forms
17
-
18
- | Overlay | Description | Form Version | Key Features |
19
- |---------|-------------|--------------|--------------|
20
- | `baspi4.json` | Buyers and Sellers Property Information | v4.0 | Core property transaction data |
21
- | `baspi5.json` | Buyers and Sellers Property Information | v5.0 | Enhanced BASPI with additional fields |
22
- | `nts.json` | National Trading Standards | 2023 | Consumer protection requirements |
23
- | `nts2.json` | National Trading Standards | 2025 | Extended NTS with specialist issues |
24
- | `ntsl.json` | National Trading Standards (Leasehold) | 2023 | Leasehold-specific NTS requirements |
25
- | `ntsl2.json` | National Trading Standards (Leasehold) | 2025 | Enhanced leasehold NTS |
26
- | `piq.json` | Property Information Questionnaire | v3 | Estate agent property information |
27
-
28
- ### Legal Forms
29
-
30
- | Overlay | Description | Form Version | Key Features |
31
- |---------|-------------|--------------|--------------|
32
- | `ta6.json` | Property Information Form | Edition 4 | Law Society standard form |
33
- | `ta7.json` | Leasehold Information Form | Edition 3 | Leasehold-specific legal requirements |
34
- | `ta10.json` | Fittings and Contents Form | Edition 3 | Fixtures and fittings information |
35
-
36
- ### Search and Survey Forms
37
-
38
- | Overlay | Description | Form Version | Key Features |
39
- |---------|-------------|--------------|--------------|
40
- | `con29R.json` | Local Authority Search | 2019 | Standard local authority enquiries |
41
- | `con29DW.json` | Drainage and Water Search | Current | Water authority enquiries |
42
- | `lpe1.json` | Leasehold Property Enquiries | Edition 4 | Additional leasehold enquiries |
43
- | `fme1.json` | Freehold Management Enquiries | Edition 2 | Managed freehold enquiries |
44
- | `llc1.json` | Local Land Charges Search | v2 | Local land charges register |
45
- | `oc1.json` | Optional Enquiries of Local Authority | v21 | Additional local authority enquiries |
46
-
47
- ### Specialist Forms
48
-
49
- | Overlay | Description | Key Features |
50
- |---------|-------------|--------------|
51
- | `rds.json` | Residential Development Survey | Property development information |
52
- | `sr24.json` | Sustainability Report | Environmental sustainability data |
53
-
54
- ## Extension Overlays
55
-
56
- The `extensions/` directory contains modular overlays that add specific NTS2 features to the NTS base. These allow selective adoption of NTS2 enhancements without requiring the full NTS2 overlay.
57
-
58
- ### Specialist Issues Extensions
59
-
60
- | Extension | String Key | Description | Reference | Usage |
61
- |-----------|------------|-------------|-----------|-------|
62
- | `as.json` | `"as"` | Asbestos | A5.2 | Asbestos presence and management |
63
- | `dr.json` | `"dr"` | Dry Rot Treatment | A5.1 | Dry rot and timber treatment |
64
- | `jk.json` | `"jk"` | Japanese Knotweed | A5.3 | Japanese knotweed presence and management |
65
- | `sb.json` | `"sb"` | Subsidence | A5.4 | Subsidence or structural faults |
66
- | `hs.json` | `"hs"` | Health & Safety | A5.5 | Ongoing health or safety issues |
67
-
68
- ### Property Features Extensions
69
-
70
- | Extension | String Key | Description | Reference | Usage |
71
- |-----------|------------|-------------|-----------|-------|
72
- | `oa.json` | `"oa"` | Outside Areas | - | Garden, balcony, communal areas |
73
- | `la.json` | `"la"` | Loft Access | A4.1 | Loft access, boarding, insulation |
74
- | `sf.json` | `"sf"` | Spray Foam Insulation | A4.2 | Spray foam insulation details |
75
- | `mc.json` | `"mc"` | Main Construction | - | Standard construction type |
76
-
77
- ### Ownership & Financial Extensions
78
-
79
- | Extension | String Key | Description | Reference | Usage |
80
- |-----------|------------|-------------|-----------|-------|
81
- | `er.json` | `"er"` | Estate Rentcharges | A3.2 | Freehold estate rentcharges |
82
- | `ma.json` | `"ma"` | Managing Agent | A1.5.4 | Leasehold managing agent details |
83
- | `tf.json` | `"tf"` | Transfer Fees | A3.5.1.1 | Additional leasehold fees |
84
-
85
- ### Utilities & Services Extensions
86
-
87
- | Extension | String Key | Description | Reference | Usage |
88
- |-----------|------------|-------------|-----------|-------|
89
- | `sl.json` | `"sl"` | Solar Panels Ownership | B3.7.1 | Solar panel ownership details |
90
- | `hi.json` | `"hi"` | Heating Installation | B3.4.3.2 | Central heating installation date |
91
- | `fd.json` | `"fd"` | Flood Defences | - | Flood defence information |
92
-
93
- ### Transaction Extensions
94
-
95
- | Extension | String Key | Description | Reference | Usage |
96
- |-----------|------------|-------------|-----------|-------|
97
- | `oc.json` | `"oc"` | Other Property Chain | - | Chain dependency information |
98
-
99
- ## Usage Examples
100
-
101
- ### Basic Form Overlay
102
-
103
- ```javascript
104
- const { getTransactionSchema } = require('@pdtf/schemas');
105
-
106
- // Get schema with single overlay
107
- const schema = getTransactionSchema(
108
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
109
- ["nts"]
110
- );
111
- ```
112
-
113
- ### Multiple Overlays
114
-
115
- ```javascript
116
- // Combine multiple form overlays
117
- const schema = getTransactionSchema(
118
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
119
- ["baspi5", "ta6", "con29R"]
120
- );
121
- ```
122
-
123
- ### Extension Overlays
124
-
125
- ```javascript
126
- // Using string keys (recommended)
127
- const schema = getTransactionSchema(
128
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
129
- ["nts2023", "jk", "tf"]
130
- );
131
-
132
- // Or load extension overlays directly
133
- const jkExtension = require('./overlays/extensions/jk.json');
134
- const tfExtension = require('./overlays/extensions/tf.json');
135
-
136
- const schema = getTransactionSchema(
137
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
138
- ["nts2023", jkExtension, tfExtension]
139
- );
140
-
141
- // Or access via extensionOverlays object
142
- const { extensionOverlays } = require('@pdtf/schemas');
143
- const schema = getTransactionSchema(
144
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
145
- ["nts2023", extensionOverlays.jk, extensionOverlays.tf]
146
- );
147
- ```
148
-
149
- ### Custom Overlay Objects
150
-
151
- ```javascript
152
- // Define custom overlay inline
153
- const customOverlay = {
154
- properties: {
155
- propertyPack: {
156
- properties: {
157
- customField: {
158
- ntsRef: "CUSTOM.1",
159
- type: "string",
160
- title: "Custom Field"
161
- }
162
- }
163
- }
164
- }
165
- };
166
-
167
- const schema = getTransactionSchema(
168
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
169
- ["nts", customOverlay]
170
- );
171
- ```
172
-
173
- ## Overlay Structure
174
-
175
- All overlays follow this structure:
176
-
177
- ```json
178
- {
179
- "$schema": "http://json-schema.org/draft-07/schema#",
180
- "$id": "https://trust.propdata.org.uk/schemas/v3/overlays/{overlay-name}.json",
181
- "properties": {
182
- "propertyPack": {
183
- "{formRef}": "reference-code",
184
- "required": ["field1", "field2"],
185
- "properties": {
186
- "field1": {
187
- "{formRef}": "reference-code.1",
188
- "type": "string",
189
- "title": "Field Title"
190
- }
191
- }
192
- }
193
- }
194
- }
195
- ```
196
-
197
- ### Reference Attributes
198
-
199
- Each overlay uses form-specific reference attributes:
200
-
201
- - `ntsRef` / `nts2Ref` - National Trading Standards references
202
- - `baspi4Ref` / `baspi5Ref` - BASPI form references
203
- - `ta6Ref` / `ta7Ref` / `ta10Ref` - Law Society form references
204
- - `lpe1Ref` / `fme1Ref` - Property enquiry references
205
- - `con29RRef` / `con29DWRef` - Search form references
206
- - `rdsRef` - Residential Development Survey references
207
- - `piqRef` - Property Information Questionnaire references
208
-
209
- ### Discriminator Support
210
-
211
- Overlays support conditional schemas using discriminators:
212
-
213
- ```json
214
- {
215
- "yesNoField": {
216
- "discriminator": {
217
- "propertyName": "yesNo"
218
- },
219
- "oneOf": [
220
- {
221
- "properties": {
222
- "yesNo": { "enum": ["Yes"] },
223
- "details": { "type": "string" }
224
- },
225
- "required": ["details"]
226
- }
227
- ]
228
- }
229
- }
230
- ```
231
-
232
- ## Validation
233
-
234
- Use the validation functions to check data against overlay schemas:
235
-
236
- ```javascript
237
- const { getValidator, validateVerifiedClaims } = require('@pdtf/schemas');
238
-
239
- // Get validator for specific overlay combination
240
- const validator = getValidator(
241
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
242
- ["nts", "baspi5"]
243
- );
244
-
245
- // Validate data
246
- const isValid = validator(data);
247
- if (!isValid) {
248
- console.log(validator.errors);
249
- }
250
-
251
- // Validate verified claims
252
- const errors = validateVerifiedClaims(
253
- verifiedClaimsData,
254
- "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
255
- ["nts"]
256
- );
257
- ```
258
-
259
- ## Best Practices
260
-
261
- 1. **Choose appropriate overlays** for your use case - don't include unnecessary forms
262
- 2. **Test overlay combinations** thoroughly as some may conflict
263
- 3. **Use extension overlays** for selective NTS2 adoption
264
- 4. **Validate your data** against the merged schema
265
- 5. **Keep overlay order consistent** for predictable results
266
- 6. **Cache merged schemas** in production for performance
267
-
268
- ## Schema Evolution
269
-
270
- When overlays are updated:
271
-
272
- - **Patch versions** (3.4.x) - Bug fixes, no breaking changes
273
- - **Minor versions** (3.x.0) - New fields, backward compatible
274
- - **Major versions** (x.0.0) - Breaking changes, migration required
275
-
276
- Always test your integration when updating overlay versions.
277
-
278
- ## Testing
279
-
280
- Extension overlays are thoroughly tested to ensure:
281
-
282
- - **String key compatibility** - All extensions work with simple string keys
283
- - **Merging behavior** - Overlays merge correctly with base schemas
284
- - **NTS2 equivalence** - Combined extensions produce equivalent results to NTS2
285
- - **Individual functionality** - Each extension adds the expected properties
286
- - **Schema validation** - All generated schemas are valid and functional
287
-
288
- Run tests with:
289
- ```bash
290
- npm test -- --testPathPattern=extensionOverlays
291
- ```
292
-
293
- ## Support
294
-
295
- For questions about overlays:
296
-
297
- - Check the [main repository documentation](../../../README.md)
298
- - Review [example files](../../examples/) for usage patterns
299
- - Submit issues to the [GitHub repository](https://github.com/Property-Data-Trust-Framework/schemas)