@planning-inspectorate/data-model 1.11.0

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 (131) hide show
  1. package/.azure/ci.yml +60 -0
  2. package/.azure/release.yml +57 -0
  3. package/.github/dependabot.yml +11 -0
  4. package/.husky/install.mjs +7 -0
  5. package/.husky/pre-commit +1 -0
  6. package/.prettierignore +11 -0
  7. package/.prettierrc +19 -0
  8. package/LICENSE +21 -0
  9. package/README.md +237 -0
  10. package/commitlint.config.js +8 -0
  11. package/docs/README.md +85 -0
  12. package/docs/appeal-document.md +776 -0
  13. package/docs/appeal-event-estimate.md +108 -0
  14. package/docs/appeal-event.md +404 -0
  15. package/docs/appeal-has.md +1960 -0
  16. package/docs/appeal-representation.md +375 -0
  17. package/docs/appeal-s78.md +3607 -0
  18. package/docs/appeal.md +1879 -0
  19. package/docs/case-schedule.md +8 -0
  20. package/docs/dart-response.md +1413 -0
  21. package/docs/employee.md +70 -0
  22. package/docs/entraid.md +108 -0
  23. package/docs/folder.md +147 -0
  24. package/docs/gettimesheets-response.md +188 -0
  25. package/docs/interested-party.md +284 -0
  26. package/docs/listed-building.md +113 -0
  27. package/docs/listed-buildings.md +113 -0
  28. package/docs/nsip-document.md +966 -0
  29. package/docs/nsip-exam-timetable-defs-event.md +223 -0
  30. package/docs/nsip-exam-timetable-defs-line-item.md +51 -0
  31. package/docs/nsip-exam-timetable-defs.md +3 -0
  32. package/docs/nsip-exam-timetable-submission.md +113 -0
  33. package/docs/nsip-exam-timetable.md +352 -0
  34. package/docs/nsip-project-update.md +163 -0
  35. package/docs/nsip-project.md +2098 -0
  36. package/docs/nsip-representation-defs-attachment.md +133 -0
  37. package/docs/nsip-representation-defs.md +3 -0
  38. package/docs/nsip-representation.md +448 -0
  39. package/docs/nsip-subscription.md +193 -0
  40. package/docs/pins-inspector.md +184 -0
  41. package/docs/pins-lpa.md +260 -0
  42. package/docs/s51-advice.md +460 -0
  43. package/docs/service-user.md +575 -0
  44. package/eslint.config.js +21 -0
  45. package/jsconfig.json +12 -0
  46. package/package.json +55 -0
  47. package/pins_data_model/__init__.py +0 -0
  48. package/pins_data_model/gen_models.py +51 -0
  49. package/pins_data_model/load_schemas.py +51 -0
  50. package/pins_data_model/models/__init__.py +0 -0
  51. package/pins_data_model/models/model_appeal_document.py +294 -0
  52. package/pins_data_model/models/model_appeal_event.py +117 -0
  53. package/pins_data_model/models/model_appeal_event_estimate.py +37 -0
  54. package/pins_data_model/models/model_appeal_has.py +585 -0
  55. package/pins_data_model/models/model_appeal_representation.py +132 -0
  56. package/pins_data_model/models/model_appeal_s78.py +864 -0
  57. package/pins_data_model/models/model_case_schedule.py +11 -0
  58. package/pins_data_model/models/model_dart_response.py +292 -0
  59. package/pins_data_model/models/model_entraid.py +37 -0
  60. package/pins_data_model/models/model_folder.py +56 -0
  61. package/pins_data_model/models/model_gettimesheets_response.py +45 -0
  62. package/pins_data_model/models/model_listed_building.py +33 -0
  63. package/pins_data_model/models/model_listed_buildings.py +33 -0
  64. package/pins_data_model/models/model_nsip_document.py +199 -0
  65. package/pins_data_model/models/model_nsip_exam_timetable.py +90 -0
  66. package/pins_data_model/models/model_nsip_project.py +488 -0
  67. package/pins_data_model/models/model_nsip_project_update.py +60 -0
  68. package/pins_data_model/models/model_nsip_representation.py +83 -0
  69. package/pins_data_model/models/model_nsip_subscription.py +60 -0
  70. package/pins_data_model/models/model_pins_inspector.py +53 -0
  71. package/pins_data_model/models/model_pins_lpa.py +69 -0
  72. package/pins_data_model/models/model_s51_advice.py +109 -0
  73. package/pins_data_model/models/model_service_user.py +121 -0
  74. package/requirements.txt +2 -0
  75. package/schemas/__init__.py +0 -0
  76. package/schemas/appeal-document.schema.json +250 -0
  77. package/schemas/appeal-event-estimate.schema.json +31 -0
  78. package/schemas/appeal-event.schema.json +123 -0
  79. package/schemas/appeal-has.schema.json +576 -0
  80. package/schemas/appeal-representation.schema.json +131 -0
  81. package/schemas/appeal-s78.schema.json +1060 -0
  82. package/schemas/commands/__init__.py +0 -0
  83. package/schemas/commands/appeal-common-submission.schema.json +202 -0
  84. package/schemas/commands/appeal-has-submission.schema.json +82 -0
  85. package/schemas/commands/appeal-representation-submission.schema.json +192 -0
  86. package/schemas/commands/appeal-s78-submission.schema.json +100 -0
  87. package/schemas/commands/appellant-submission.schema.json +164 -0
  88. package/schemas/commands/interested-party.schema.json +80 -0
  89. package/schemas/commands/lpa-questionnaire-common.schema.json +110 -0
  90. package/schemas/commands/lpa-questionnaire-has.schema.json +69 -0
  91. package/schemas/commands/lpa-questionnaire-s78.schema.json +218 -0
  92. package/schemas/commands/lpa-questionnaire.schema.json +125 -0
  93. package/schemas/commands/new-deadline-submission.schema.json +59 -0
  94. package/schemas/commands/nsip-exam-timetable-submission.schema.json +27 -0
  95. package/schemas/commands/register-nsip-subscription.schema.json +32 -0
  96. package/schemas/commands/register-representation.schema.json +51 -0
  97. package/schemas/dart-response.schema.json +350 -0
  98. package/schemas/entraid.schema.json +31 -0
  99. package/schemas/folder.schema.json +49 -0
  100. package/schemas/gettimesheets-response.schema.json +46 -0
  101. package/schemas/listed-building.schema.json +31 -0
  102. package/schemas/listed-buildings.schema.json +31 -0
  103. package/schemas/nsip-document.schema.json +235 -0
  104. package/schemas/nsip-exam-timetable.schema.json +101 -0
  105. package/schemas/nsip-project-update.schema.json +49 -0
  106. package/schemas/nsip-project.schema.json +539 -0
  107. package/schemas/nsip-representation.schema.json +110 -0
  108. package/schemas/nsip-subscription.schema.json +52 -0
  109. package/schemas/pins-inspector.schema.json +47 -0
  110. package/schemas/pins-lpa.schema.json +63 -0
  111. package/schemas/s51-advice.schema.json +113 -0
  112. package/schemas/service-user.schema.json +152 -0
  113. package/setup.py +15 -0
  114. package/src/enums.cjs +632 -0
  115. package/src/enums.d.ts +573 -0
  116. package/src/enums.js +573 -0
  117. package/src/gen-docs.js +34 -0
  118. package/src/gen-enums.js +119 -0
  119. package/src/gen-types.js +70 -0
  120. package/src/index.cjs +746 -0
  121. package/src/index.d.ts +18 -0
  122. package/src/index.js +34 -0
  123. package/src/lib/load.js +78 -0
  124. package/src/schemas.d.ts +4570 -0
  125. package/tests/appeals/appeal-event.test.js +62 -0
  126. package/tests/appeals/commands/appeal-representation-submission.test.js +107 -0
  127. package/tests/appeals/commands/has-questionnaire.test.js +92 -0
  128. package/tests/appeals/commands/has-submission.test.js +113 -0
  129. package/tests/appeals/commands/s78-questionnaire.test.js +96 -0
  130. package/tests/appeals/commands/s78-submission.test.js +119 -0
  131. package/tests/schemas.test.js +97 -0
@@ -0,0 +1,575 @@
1
+ ## Service User Type
2
+
3
+ `object` ([Service User](service-user.md))
4
+
5
+ # Service User Properties
6
+
7
+ | Property | Type | Required | Nullable | Defined by |
8
+ | :------------------------------------ | :------- | :------- | :------------- | :------------------------------------------------------------------------------------------------------------------ |
9
+ | [id](#id) | `string` | Required | cannot be null | [Service User](service-user-properties-id.md "service-user.schema.json#/properties/id") |
10
+ | [salutation](#salutation) | `string` | Required | can be null | [Service User](service-user-properties-salutation.md "service-user.schema.json#/properties/salutation") |
11
+ | [firstName](#firstname) | `string` | Required | can be null | [Service User](service-user-properties-firstname.md "service-user.schema.json#/properties/firstName") |
12
+ | [lastName](#lastname) | `string` | Required | can be null | [Service User](service-user-properties-lastname.md "service-user.schema.json#/properties/lastName") |
13
+ | [addressLine1](#addressline1) | `string` | Required | can be null | [Service User](service-user-properties-addressline1.md "service-user.schema.json#/properties/addressLine1") |
14
+ | [addressLine2](#addressline2) | `string` | Required | can be null | [Service User](service-user-properties-addressline2.md "service-user.schema.json#/properties/addressLine2") |
15
+ | [addressTown](#addresstown) | `string` | Required | can be null | [Service User](service-user-properties-addresstown.md "service-user.schema.json#/properties/addressTown") |
16
+ | [addressCounty](#addresscounty) | `string` | Required | can be null | [Service User](service-user-properties-addresscounty.md "service-user.schema.json#/properties/addressCounty") |
17
+ | [postcode](#postcode) | `string` | Required | can be null | [Service User](service-user-properties-postcode.md "service-user.schema.json#/properties/postcode") |
18
+ | [addressCountry](#addresscountry) | `string` | Required | can be null | [Service User](service-user-properties-addresscountry.md "service-user.schema.json#/properties/addressCountry") |
19
+ | [organisation](#organisation) | `string` | Required | can be null | [Service User](service-user-properties-organisation.md "service-user.schema.json#/properties/organisation") |
20
+ | [organisationType](#organisationtype) | `string` | Required | can be null | [Service User](service-user-properties-organisationtype.md "service-user.schema.json#/properties/organisationType") |
21
+ | [role](#role) | `string` | Required | can be null | [Service User](service-user-properties-role.md "service-user.schema.json#/properties/role") |
22
+ | [telephoneNumber](#telephonenumber) | `string` | Required | can be null | [Service User](service-user-properties-telephonenumber.md "service-user.schema.json#/properties/telephoneNumber") |
23
+ | [otherPhoneNumber](#otherphonenumber) | `string` | Required | can be null | [Service User](service-user-properties-otherphonenumber.md "service-user.schema.json#/properties/otherPhoneNumber") |
24
+ | [faxNumber](#faxnumber) | `string` | Required | can be null | [Service User](service-user-properties-faxnumber.md "service-user.schema.json#/properties/faxNumber") |
25
+ | [emailAddress](#emailaddress) | `string` | Required | can be null | [Service User](service-user-properties-emailaddress.md "service-user.schema.json#/properties/emailAddress") |
26
+ | [webAddress](#webaddress) | `string` | Required | can be null | [Service User](service-user-properties-webaddress.md "service-user.schema.json#/properties/webAddress") |
27
+ | [serviceUserType](#serviceusertype) | `string` | Required | cannot be null | [Service User](service-user-properties-serviceusertype.md "service-user.schema.json#/properties/serviceUserType") |
28
+ | [caseReference](#casereference) | `string` | Required | cannot be null | [Service User](service-user-properties-casereference.md "service-user.schema.json#/properties/caseReference") |
29
+ | [sourceSystem](#sourcesystem) | `string` | Required | cannot be null | [Service User](service-user-properties-sourcesystem.md "service-user.schema.json#/properties/sourceSystem") |
30
+ | [sourceSuid](#sourcesuid) | `string` | Required | cannot be null | [Service User](service-user-properties-sourcesuid.md "service-user.schema.json#/properties/sourceSuid") |
31
+ | Additional Properties | Any | Optional | can be null | |
32
+
33
+ ## id
34
+
35
+ A unique identifier for the entity.
36
+
37
+ `id`
38
+
39
+ * is required
40
+
41
+ * Type: `string`
42
+
43
+ * cannot be null
44
+
45
+ * defined in: [Service User](service-user-properties-id.md "service-user.schema.json#/properties/id")
46
+
47
+ ### id Type
48
+
49
+ `string`
50
+
51
+ ### id Examples
52
+
53
+ ```json
54
+ "12345"
55
+ ```
56
+
57
+ ## salutation
58
+
59
+ A formal greeting, e.g., Mr, Mrs, Ms.
60
+
61
+ `salutation`
62
+
63
+ * is required
64
+
65
+ * Type: `string`
66
+
67
+ * can be null
68
+
69
+ * defined in: [Service User](service-user-properties-salutation.md "service-user.schema.json#/properties/salutation")
70
+
71
+ ### salutation Type
72
+
73
+ `string`
74
+
75
+ ### salutation Examples
76
+
77
+ ```json
78
+ "Mr"
79
+ ```
80
+
81
+ ## firstName
82
+
83
+ The first name of the individual.
84
+
85
+ `firstName`
86
+
87
+ * is required
88
+
89
+ * Type: `string`
90
+
91
+ * can be null
92
+
93
+ * defined in: [Service User](service-user-properties-firstname.md "service-user.schema.json#/properties/firstName")
94
+
95
+ ### firstName Type
96
+
97
+ `string`
98
+
99
+ ### firstName Examples
100
+
101
+ ```json
102
+ "John"
103
+ ```
104
+
105
+ ## lastName
106
+
107
+ The last name of the individual.
108
+
109
+ `lastName`
110
+
111
+ * is required
112
+
113
+ * Type: `string`
114
+
115
+ * can be null
116
+
117
+ * defined in: [Service User](service-user-properties-lastname.md "service-user.schema.json#/properties/lastName")
118
+
119
+ ### lastName Type
120
+
121
+ `string`
122
+
123
+ ### lastName Examples
124
+
125
+ ```json
126
+ "Doe"
127
+ ```
128
+
129
+ ## addressLine1
130
+
131
+ The first line of the address.
132
+
133
+ `addressLine1`
134
+
135
+ * is required
136
+
137
+ * Type: `string`
138
+
139
+ * can be null
140
+
141
+ * defined in: [Service User](service-user-properties-addressline1.md "service-user.schema.json#/properties/addressLine1")
142
+
143
+ ### addressLine1 Type
144
+
145
+ `string`
146
+
147
+ ### addressLine1 Examples
148
+
149
+ ```json
150
+ "123 Elm Street"
151
+ ```
152
+
153
+ ## addressLine2
154
+
155
+ The second line of the address, usually includes suite or apartment number.
156
+
157
+ `addressLine2`
158
+
159
+ * is required
160
+
161
+ * Type: `string`
162
+
163
+ * can be null
164
+
165
+ * defined in: [Service User](service-user-properties-addressline2.md "service-user.schema.json#/properties/addressLine2")
166
+
167
+ ### addressLine2 Type
168
+
169
+ `string`
170
+
171
+ ### addressLine2 Examples
172
+
173
+ ```json
174
+ "Apt 4B"
175
+ ```
176
+
177
+ ## addressTown
178
+
179
+ The town or city of the address.
180
+
181
+ `addressTown`
182
+
183
+ * is required
184
+
185
+ * Type: `string`
186
+
187
+ * can be null
188
+
189
+ * defined in: [Service User](service-user-properties-addresstown.md "service-user.schema.json#/properties/addressTown")
190
+
191
+ ### addressTown Type
192
+
193
+ `string`
194
+
195
+ ### addressTown Examples
196
+
197
+ ```json
198
+ "Springfield"
199
+ ```
200
+
201
+ ## addressCounty
202
+
203
+ The county in which the town or city is located.
204
+
205
+ `addressCounty`
206
+
207
+ * is required
208
+
209
+ * Type: `string`
210
+
211
+ * can be null
212
+
213
+ * defined in: [Service User](service-user-properties-addresscounty.md "service-user.schema.json#/properties/addressCounty")
214
+
215
+ ### addressCounty Type
216
+
217
+ `string`
218
+
219
+ ### addressCounty Examples
220
+
221
+ ```json
222
+ "Hampshire"
223
+ ```
224
+
225
+ ## postcode
226
+
227
+ The postal code for the address.
228
+
229
+ `postcode`
230
+
231
+ * is required
232
+
233
+ * Type: `string`
234
+
235
+ * can be null
236
+
237
+ * defined in: [Service User](service-user-properties-postcode.md "service-user.schema.json#/properties/postcode")
238
+
239
+ ### postcode Type
240
+
241
+ `string`
242
+
243
+ ### postcode Examples
244
+
245
+ ```json
246
+ "M12 4AF"
247
+ ```
248
+
249
+ ## addressCountry
250
+
251
+ The country of the address.
252
+
253
+ `addressCountry`
254
+
255
+ * is required
256
+
257
+ * Type: `string`
258
+
259
+ * can be null
260
+
261
+ * defined in: [Service User](service-user-properties-addresscountry.md "service-user.schema.json#/properties/addressCountry")
262
+
263
+ ### addressCountry Type
264
+
265
+ `string`
266
+
267
+ ### addressCountry Examples
268
+
269
+ ```json
270
+ "United Kingdom"
271
+ ```
272
+
273
+ ## organisation
274
+
275
+ The name of the organisation associated with the individual.
276
+
277
+ `organisation`
278
+
279
+ * is required
280
+
281
+ * Type: `string`
282
+
283
+ * can be null
284
+
285
+ * defined in: [Service User](service-user-properties-organisation.md "service-user.schema.json#/properties/organisation")
286
+
287
+ ### organisation Type
288
+
289
+ `string`
290
+
291
+ ### organisation Examples
292
+
293
+ ```json
294
+ "Tech Corp"
295
+ ```
296
+
297
+ ## organisationType
298
+
299
+ The type or nature of the organisation.
300
+
301
+ `organisationType`
302
+
303
+ * is required
304
+
305
+ * Type: `string`
306
+
307
+ * can be null
308
+
309
+ * defined in: [Service User](service-user-properties-organisationtype.md "service-user.schema.json#/properties/organisationType")
310
+
311
+ ### organisationType Type
312
+
313
+ `string`
314
+
315
+ ### organisationType Examples
316
+
317
+ ```json
318
+ "Private Company"
319
+ ```
320
+
321
+ ## role
322
+
323
+ The individual's role or position within the organisation.
324
+
325
+ `role`
326
+
327
+ * is required
328
+
329
+ * Type: `string`
330
+
331
+ * can be null
332
+
333
+ * defined in: [Service User](service-user-properties-role.md "service-user.schema.json#/properties/role")
334
+
335
+ ### role Type
336
+
337
+ `string`
338
+
339
+ ### role Examples
340
+
341
+ ```json
342
+ "Agent"
343
+ ```
344
+
345
+ ## telephoneNumber
346
+
347
+ The primary telephone contact number.
348
+
349
+ `telephoneNumber`
350
+
351
+ * is required
352
+
353
+ * Type: `string`
354
+
355
+ * can be null
356
+
357
+ * defined in: [Service User](service-user-properties-telephonenumber.md "service-user.schema.json#/properties/telephoneNumber")
358
+
359
+ ### telephoneNumber Type
360
+
361
+ `string`
362
+
363
+ ### telephoneNumber Examples
364
+
365
+ ```json
366
+ "+447123456789"
367
+ ```
368
+
369
+ ## otherPhoneNumber
370
+
371
+ An alternate or secondary phone number.
372
+
373
+ `otherPhoneNumber`
374
+
375
+ * is required
376
+
377
+ * Type: `string`
378
+
379
+ * can be null
380
+
381
+ * defined in: [Service User](service-user-properties-otherphonenumber.md "service-user.schema.json#/properties/otherPhoneNumber")
382
+
383
+ ### otherPhoneNumber Type
384
+
385
+ `string`
386
+
387
+ ### otherPhoneNumber Examples
388
+
389
+ ```json
390
+ "+447123456789"
391
+ ```
392
+
393
+ ## faxNumber
394
+
395
+ A fax contact number.
396
+
397
+ `faxNumber`
398
+
399
+ * is required
400
+
401
+ * Type: `string`
402
+
403
+ * can be null
404
+
405
+ * defined in: [Service User](service-user-properties-faxnumber.md "service-user.schema.json#/properties/faxNumber")
406
+
407
+ ### faxNumber Type
408
+
409
+ `string`
410
+
411
+ ### faxNumber Examples
412
+
413
+ ```json
414
+ "+447123456789"
415
+ ```
416
+
417
+ ## emailAddress
418
+
419
+ The primary email address for contact.
420
+
421
+ `emailAddress`
422
+
423
+ * is required
424
+
425
+ * Type: `string`
426
+
427
+ * can be null
428
+
429
+ * defined in: [Service User](service-user-properties-emailaddress.md "service-user.schema.json#/properties/emailAddress")
430
+
431
+ ### emailAddress Type
432
+
433
+ `string`
434
+
435
+ ### emailAddress Examples
436
+
437
+ ```json
438
+ "john.doe@example.com"
439
+ ```
440
+
441
+ ## webAddress
442
+
443
+ Website address or URL.
444
+
445
+ `webAddress`
446
+
447
+ * is required
448
+
449
+ * Type: `string`
450
+
451
+ * can be null
452
+
453
+ * defined in: [Service User](service-user-properties-webaddress.md "service-user.schema.json#/properties/webAddress")
454
+
455
+ ### webAddress Type
456
+
457
+ `string`
458
+
459
+ ### webAddress Examples
460
+
461
+ ```json
462
+ "https://www.example.com"
463
+ ```
464
+
465
+ ## serviceUserType
466
+
467
+ Type or category of the service user.
468
+
469
+ `serviceUserType`
470
+
471
+ * is required
472
+
473
+ * Type: `string`
474
+
475
+ * cannot be null
476
+
477
+ * defined in: [Service User](service-user-properties-serviceusertype.md "service-user.schema.json#/properties/serviceUserType")
478
+
479
+ ### serviceUserType Type
480
+
481
+ `string`
482
+
483
+ ### serviceUserType Constraints
484
+
485
+ **enum**: the value of this property must be equal to one of the following values:
486
+
487
+ | Value | Explanation |
488
+ | :------------------------ | :---------- |
489
+ | `"Applicant"` | |
490
+ | `"Appellant"` | |
491
+ | `"Agent"` | |
492
+ | `"Rule6Party"` | |
493
+ | `"InterestedParty"` | |
494
+ | `"RepresentationContact"` | |
495
+ | `"Subscriber"` | |
496
+
497
+ ## caseReference
498
+
499
+ Reference number for a particular case or incident.
500
+
501
+ `caseReference`
502
+
503
+ * is required
504
+
505
+ * Type: `string`
506
+
507
+ * cannot be null
508
+
509
+ * defined in: [Service User](service-user-properties-casereference.md "service-user.schema.json#/properties/caseReference")
510
+
511
+ ### caseReference Type
512
+
513
+ `string`
514
+
515
+ ### caseReference Examples
516
+
517
+ ```json
518
+ "BC0510001"
519
+ ```
520
+
521
+ ## sourceSystem
522
+
523
+ The originating system from where the data was sourced.
524
+
525
+ `sourceSystem`
526
+
527
+ * is required
528
+
529
+ * Type: `string`
530
+
531
+ * cannot be null
532
+
533
+ * defined in: [Service User](service-user-properties-sourcesystem.md "service-user.schema.json#/properties/sourceSystem")
534
+
535
+ ### sourceSystem Type
536
+
537
+ `string`
538
+
539
+ ### sourceSystem Examples
540
+
541
+ ```json
542
+ "ODT"
543
+ ```
544
+
545
+ ```json
546
+ "Horizon"
547
+ ```
548
+
549
+ ## sourceSuid
550
+
551
+ Unique identifier from the source system.
552
+
553
+ `sourceSuid`
554
+
555
+ * is required
556
+
557
+ * Type: `string`
558
+
559
+ * cannot be null
560
+
561
+ * defined in: [Service User](service-user-properties-sourcesuid.md "service-user.schema.json#/properties/sourceSuid")
562
+
563
+ ### sourceSuid Type
564
+
565
+ `string`
566
+
567
+ ### sourceSuid Examples
568
+
569
+ ```json
570
+ "12345"
571
+ ```
572
+
573
+ ## Additional Properties
574
+
575
+ Additional properties are allowed and do not have to follow a specific schema
@@ -0,0 +1,21 @@
1
+ import js from '@eslint/js';
2
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
+ import globals from 'globals';
4
+
5
+ export default [
6
+ {
7
+ ...js.configs.recommended,
8
+ ignores: ['**/*.cjs', 'node_modules/**']
9
+ },
10
+ {
11
+ ignores: ['node_modules/**', '**/*.cjs'],
12
+ languageOptions: {
13
+ ecmaVersion: 2025,
14
+ sourceType: 'module',
15
+ globals: {
16
+ ...globals.node
17
+ }
18
+ }
19
+ },
20
+ eslintConfigPrettier
21
+ ];
package/jsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "allowSyntheticDefaultImports": true,
5
+ "checkJs": true,
6
+ "esModuleInterop": true,
7
+ "moduleResolution": "node",
8
+ "target": "esnext",
9
+ "module": "es2022",
10
+ "strict": true
11
+ }
12
+ }
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@planning-inspectorate/data-model",
3
+ "version": "1.11.0",
4
+ "description": "JSON Schemas for the Planning Inspectorate's Data Model",
5
+ "main": "src/index.js",
6
+ "type": "module",
7
+ "exports": {
8
+ "import": "./src/index.js",
9
+ "require": "./src/index.cjs"
10
+ },
11
+ "scripts": {
12
+ "commitlint": "commitlint --from=$(git cherry origin/main | head -n 1 | cut -c 3-)",
13
+ "gen": "npm run gen-docs && npm run gen-enums && npm run gen-types && npm run gen-cjs",
14
+ "gen-docs": "node src/gen-docs.js",
15
+ "gen-enums": "node src/gen-enums.js",
16
+ "gen-types": "node src/gen-types.js",
17
+ "gen-cjs": "npx rollup ./src/index.js --file ./src/index.cjs --format cjs && npx rollup ./src/enums.js --file ./src/enums.cjs --format cjs",
18
+ "lint": "npx eslint .",
19
+ "format": "prettier --write .",
20
+ "format-check": "prettier --check .",
21
+ "prepare": "node .husky/install.mjs"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/Planning-Inspectorate/data-model.git"
26
+ },
27
+ "license": "MIT",
28
+ "dependencies": {
29
+ "jsonc-parser": "^3.3.1"
30
+ },
31
+ "devDependencies": {
32
+ "@adobe/jsonschema2md": "^8.0.3",
33
+ "@commitlint/cli": "^19.8.1",
34
+ "@commitlint/config-conventional": "^19.8.1",
35
+ "ajv": "^8.17.1",
36
+ "ajv-formats": "^3.0.1",
37
+ "eslint": "^9.30.1",
38
+ "eslint-config-prettier": "^10.1.5",
39
+ "husky": "^9.1.7",
40
+ "json-schema-to-typescript": "^15.0.4",
41
+ "lint-staged": "^16.1.2",
42
+ "lodash.snakecase": "^4.1.1",
43
+ "prettier": "^3.6.2",
44
+ "rollup": "^4.44.2",
45
+ "semantic-release": "^24.2.6"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "lint-staged": {
51
+ "*.js": [
52
+ "eslint --fix"
53
+ ]
54
+ }
55
+ }
File without changes
@@ -0,0 +1,51 @@
1
+ """
2
+ Module to generate pydantic models from json schemas
3
+ """
4
+
5
+ import json
6
+ from os import path
7
+ from pathlib import Path
8
+ from datamodel_code_generator import InputFileType, PythonVersion, generate
9
+ from datamodel_code_generator import DataModelType
10
+
11
+ from load_schemas import load_all_schemas
12
+
13
+ modelsDir = path.join(path.dirname(path.realpath(__file__)), "models")
14
+
15
+
16
+ def gen_models() -> None:
17
+ """
18
+ Function to generate pydantic models from json schemas.
19
+ It loops through a list of schemas, generates a file path and
20
+ generates a pydantic v2 base model.
21
+ """
22
+
23
+ loaded = load_all_schemas()
24
+ schemas = loaded["schemas"]
25
+
26
+ for name in schemas:
27
+ schema = schemas[name]
28
+ json_schema = json.dumps(schema)
29
+ filename = (
30
+ "model_"
31
+ + name.replace("-", "_")
32
+ .replace(".schema.jsonc", "")
33
+ .replace(".schema.json", "")
34
+ + ".py"
35
+ )
36
+ generate(
37
+ json_schema,
38
+ input_file_type=InputFileType.JsonSchema,
39
+ input_filename=name,
40
+ output=Path(path.join(modelsDir, filename)),
41
+ output_model_type=DataModelType.PydanticV2BaseModel,
42
+ use_double_quotes=True,
43
+ use_standard_collections=True,
44
+ use_union_operator=True,
45
+ use_field_description=True,
46
+ target_python_version=PythonVersion.PY_311,
47
+ use_schema_description=True,
48
+ )
49
+
50
+
51
+ gen_models()