@dvsa/cvs-type-definitions 2.0.12 → 2.0.16

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 (104) hide show
  1. package/README.md +1 -1
  2. package/lib/README.md +48 -0
  3. package/lib/json-schemas/v1/activity/index.json +62 -0
  4. package/lib/json-schemas/v1/defect-category-reference-data/index.json +440 -0
  5. package/lib/json-schemas/v1/defect-details/index.json +265 -0
  6. package/lib/json-schemas/v1/defect-location/index.json +49 -0
  7. package/lib/json-schemas/v1/reason-item/index.json +17 -0
  8. package/lib/json-schemas/v1/tech-record/index.json +639 -0
  9. package/lib/json-schemas/v1/test/index.json +1843 -0
  10. package/lib/json-schemas/v1/test-result/index.json +636 -0
  11. package/lib/json-schemas/v1/test-station/index.json +67 -0
  12. package/lib/json-schemas/v1/test-type/index.json +479 -0
  13. package/lib/json-schemas/v1/vehicle/index.json +1804 -0
  14. package/lib/json-schemas/v1/vehicle-tech-record/index.json +683 -0
  15. package/lib/json-schemas/v1/visit/index.json +1895 -0
  16. package/lib/json-schemas/v3/tech-record/get/car/complete/index.json +216 -0
  17. package/lib/json-schemas/v3/tech-record/get/car/skeleton/index.json +195 -0
  18. package/lib/json-schemas/v3/tech-record/get/hgv/complete/index.json +1051 -0
  19. package/lib/json-schemas/v3/tech-record/get/hgv/skeleton/index.json +1124 -0
  20. package/lib/json-schemas/v3/tech-record/get/hgv/testable/index.json +1119 -0
  21. package/lib/json-schemas/v3/tech-record/get/lgv/complete/index.json +226 -0
  22. package/lib/json-schemas/v3/tech-record/get/lgv/skeleton/index.json +202 -0
  23. package/lib/json-schemas/v3/tech-record/get/motorcycle/complete/index.json +219 -0
  24. package/lib/json-schemas/v3/tech-record/get/motorcycle/skeleton/index.json +202 -0
  25. package/lib/json-schemas/v3/tech-record/get/psv/complete/index.json +1027 -0
  26. package/lib/json-schemas/v3/tech-record/get/psv/skeleton/index.json +1120 -0
  27. package/lib/json-schemas/v3/tech-record/get/psv/testable/index.json +1097 -0
  28. package/lib/json-schemas/v3/tech-record/get/search/complete/index.json +55 -0
  29. package/lib/json-schemas/v3/tech-record/get/search/skeleton/index.json +55 -0
  30. package/lib/json-schemas/v3/tech-record/get/trl/complete/index.json +1307 -0
  31. package/lib/json-schemas/v3/tech-record/get/trl/skeleton/index.json +1002 -0
  32. package/lib/json-schemas/v3/tech-record/get/trl/testable/index.json +1155 -0
  33. package/lib/json-schemas/v3/tech-record/post/psv/complete/index.json +1024 -0
  34. package/lib/json-schemas/v3/tech-record/post/psv/skeleton/index.json +1112 -0
  35. package/lib/json-schemas/v3/tech-record/post/psv/testable/index.json +1092 -0
  36. package/lib/json-schemas/v3/tech-record/put/car/complete/request/index.json +87 -0
  37. package/lib/json-schemas/v3/tech-record/put/car/complete/response/index.json +237 -0
  38. package/lib/json-schemas/v3/tech-record/put/car/skeleton/request/index.json +64 -0
  39. package/lib/json-schemas/v3/tech-record/put/car/skeleton/response/index.json +216 -0
  40. package/lib/json-schemas/v3/tech-record/put/hgv/complete/index.json +1009 -0
  41. package/lib/json-schemas/v3/tech-record/put/hgv/skeleton/index.json +1082 -0
  42. package/lib/json-schemas/v3/tech-record/put/hgv/testable/index.json +1077 -0
  43. package/lib/json-schemas/v3/tech-record/put/lgv/complete/request/index.json +97 -0
  44. package/lib/json-schemas/v3/tech-record/put/lgv/complete/response/index.json +247 -0
  45. package/lib/json-schemas/v3/tech-record/put/lgv/skeleton/request/index.json +71 -0
  46. package/lib/json-schemas/v3/tech-record/put/lgv/skeleton/response/index.json +223 -0
  47. package/lib/json-schemas/v3/tech-record/put/trl/complete/index.json +1265 -0
  48. package/lib/json-schemas/v3/tech-record/put/trl/skeleton/index.json +978 -0
  49. package/lib/json-schemas/v3/tech-record/put/trl/testable/index.json +1115 -0
  50. package/lib/package.json +38 -0
  51. package/lib/schema-validator.d.ts +3 -0
  52. package/lib/schema-validator.js +17 -0
  53. package/lib/schemas.d.ts +1 -0
  54. package/lib/schemas.js +52 -0
  55. package/lib/types/v1/activity/index.d.ts +23 -0
  56. package/lib/types/v1/defect-category-reference-data/index.d.ts +52 -0
  57. package/lib/types/v1/defect-details/index.d.ts +53 -0
  58. package/lib/types/v1/defect-location/index.d.ts +16 -0
  59. package/lib/types/v1/reason-item/index.d.ts +11 -0
  60. package/lib/types/v1/tech-record/index.d.ts +202 -0
  61. package/lib/types/v1/test/index.d.ts +353 -0
  62. package/lib/types/v1/test-result/index.d.ts +136 -0
  63. package/lib/types/v1/test-station/index.d.ts +23 -0
  64. package/lib/types/v1/test-type/index.d.ts +98 -0
  65. package/lib/types/v1/vehicle/index.d.ts +345 -0
  66. package/lib/types/v1/vehicle-tech-record/index.d.ts +212 -0
  67. package/lib/types/v1/visit/index.d.ts +366 -0
  68. package/lib/types/v3/tech-record/get/car/complete/index.d.ts +74 -0
  69. package/lib/types/v3/tech-record/get/car/skeleton/index.d.ts +72 -0
  70. package/lib/types/v3/tech-record/get/hgv/complete/index.d.ts +285 -0
  71. package/lib/types/v3/tech-record/get/hgv/skeleton/index.d.ts +285 -0
  72. package/lib/types/v3/tech-record/get/hgv/testable/index.d.ts +285 -0
  73. package/lib/types/v3/tech-record/get/lgv/complete/index.d.ts +75 -0
  74. package/lib/types/v3/tech-record/get/lgv/skeleton/index.d.ts +73 -0
  75. package/lib/types/v3/tech-record/get/motorcycle/complete/index.d.ts +75 -0
  76. package/lib/types/v3/tech-record/get/motorcycle/skeleton/index.d.ts +73 -0
  77. package/lib/types/v3/tech-record/get/psv/complete/index.d.ts +315 -0
  78. package/lib/types/v3/tech-record/get/psv/skeleton/index.d.ts +313 -0
  79. package/lib/types/v3/tech-record/get/psv/testable/index.d.ts +313 -0
  80. package/lib/types/v3/tech-record/get/search/complete/index.d.ts +20 -0
  81. package/lib/types/v3/tech-record/get/search/skeleton/index.d.ts +19 -0
  82. package/lib/types/v3/tech-record/get/trl/complete/index.d.ts +350 -0
  83. package/lib/types/v3/tech-record/get/trl/skeleton/index.d.ts +256 -0
  84. package/lib/types/v3/tech-record/get/trl/testable/index.d.ts +294 -0
  85. package/lib/types/v3/tech-record/post/psv/complete/index.d.ts +315 -0
  86. package/lib/types/v3/tech-record/post/psv/skeleton/index.d.ts +313 -0
  87. package/lib/types/v3/tech-record/post/psv/testable/index.d.ts +313 -0
  88. package/lib/types/v3/tech-record/put/car/complete/request/index.d.ts +24 -0
  89. package/lib/types/v3/tech-record/put/car/complete/response/index.d.ts +75 -0
  90. package/lib/types/v3/tech-record/put/car/skeleton/request/index.d.ts +22 -0
  91. package/lib/types/v3/tech-record/put/car/skeleton/response/index.d.ts +75 -0
  92. package/lib/types/v3/tech-record/put/hgv/complete/index.d.ts +276 -0
  93. package/lib/types/v3/tech-record/put/hgv/skeleton/index.d.ts +276 -0
  94. package/lib/types/v3/tech-record/put/hgv/testable/index.d.ts +276 -0
  95. package/lib/types/v3/tech-record/put/lgv/complete/request/index.d.ts +25 -0
  96. package/lib/types/v3/tech-record/put/lgv/complete/response/index.d.ts +76 -0
  97. package/lib/types/v3/tech-record/put/lgv/skeleton/request/index.d.ts +23 -0
  98. package/lib/types/v3/tech-record/put/lgv/skeleton/response/index.d.ts +76 -0
  99. package/lib/types/v3/tech-record/put/trl/complete/index.d.ts +341 -0
  100. package/lib/types/v3/tech-record/put/trl/skeleton/index.d.ts +250 -0
  101. package/lib/types/v3/tech-record/put/trl/testable/index.d.ts +285 -0
  102. package/package.json +3 -5
  103. package/schemas.ts +0 -49
  104. package/src/schema-validation/schema-validator.ts +0 -25
package/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  The package exports an `isValidObject()` function which can be used to validate an object against a specified schema. E.g:
18
18
 
19
- `import { isValidObject } from '@dvsa/cvs-type-definitions/lib/src/schema-validation/schema-validator';`
19
+ `import { isValidObject } from '@dvsa/cvs-type-definitions/lib/src/schema-validation../../schema-validator';`
20
20
 
21
21
  `const isValidVisit: boolean = isValidObject('visit', myVisitObject);`
22
22
 
package/lib/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # cvs-type-definitions
2
+
3
+ [json schema](https://json-schema.org/) and .ts type definitions for cvs vta application
4
+
5
+ # Usage
6
+
7
+ ## Install GitHub package:
8
+
9
+ - install GitHub package: `npm install @dvsa/cvs-type-definitions@latest`
10
+
11
+ ## Example usage (TS types):
12
+
13
+ `import { CommercialVehicleTestSchema } from @dvsa/cvs-type-definitions/types/test`
14
+
15
+ ## Example usage (json schemas)
16
+
17
+ The package exports an `isValidObject()` function which can be used to validate an object against a specified schema. E.g:
18
+
19
+ `import { isValidObject } from '@dvsa/cvs-type-definitions/lib/src/schema-validation../../schema-validator';`
20
+
21
+ `const isValidVisit: boolean = isValidObject('visit', myVisitObject);`
22
+
23
+ # Updating a schema
24
+
25
+ Edits should only be made to `json` schema definitions within `json-definitions` directory.
26
+
27
+ TypeScript interfaces will be generated from these files and saved to `types` directory. De-referenced json schema definitions will be saved to `json-schemas` directory. Only these two directories are published in the npm package.
28
+
29
+ 1. Navigate into the relevant schema (e.g. `./json-definitions/test/index.json`)
30
+ 2. Edit file
31
+ 3. Generate the new TypeScript and de-referenced json schema definitions using `npm run generate`
32
+ 4. Bump the version of the package using `npm version {major|minor|patch}`
33
+ 5. Publish updates
34
+
35
+ # Adding a new schema
36
+
37
+ 1. Create a new subdirectory with an appropriate name within the `json-defininitions` directory (e.g. `my-new-schema`)
38
+ 2. If you do not wish for a type file and a de-referenced schema to be generated for a schema, add `.ignore` in the name of the file (e.g. `my-new-schema.ignore.json`)
39
+ 3. Generate the new TypeScript definitions using `npm run generate`
40
+ 4. Bump the version of the package using `npm version {major|minor|patch}`
41
+ 5. Publish updates
42
+
43
+ # Publishing a new version
44
+
45
+ - Raise a PR
46
+ - The PR title should start with `major`, `minor` or `patch` and be followed by the character `(`. Doing this ensure the correct version of the package is published to npm. A Github action should enforce the PR title format.
47
+ - Add a description of the changes in the `Changelog` section of the PR description
48
+ - Once merged to develop, a github action should create a release and publish a new version of that release on npm
@@ -0,0 +1,62 @@
1
+ {
2
+ "title": "Activity Schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "activityType": {
6
+ "type": "string"
7
+ },
8
+ "testStationName": {
9
+ "type": "string"
10
+ },
11
+ "testStationPNumber": {
12
+ "type": "string"
13
+ },
14
+ "testStationEmail": {
15
+ "type": "string"
16
+ },
17
+ "testStationType": {
18
+ "type": "string"
19
+ },
20
+ "testerName": {
21
+ "type": "string"
22
+ },
23
+ "testerStaffId": {
24
+ "type": "string"
25
+ },
26
+ "testerEmail": {
27
+ "type": "string"
28
+ },
29
+ "startTime": {
30
+ "type": "string"
31
+ },
32
+ "endTime": {
33
+ "type": "string"
34
+ },
35
+ "parentId": {
36
+ "type": "string"
37
+ },
38
+ "waitReason": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "string"
42
+ }
43
+ },
44
+ "notes": {
45
+ "type": "string"
46
+ },
47
+ "id": {
48
+ "type": "string"
49
+ }
50
+ },
51
+ "additionalProperties": false,
52
+ "required": [
53
+ "activityType",
54
+ "testStationName",
55
+ "testStationPNumber",
56
+ "testStationEmail",
57
+ "testStationType",
58
+ "testerName",
59
+ "testerStaffId",
60
+ "startTime"
61
+ ]
62
+ }
@@ -0,0 +1,440 @@
1
+ {
2
+ "title": "Defect Category Reference Data Schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "imNumber": {
6
+ "type": "integer"
7
+ },
8
+ "imDescription": {
9
+ "type": "string"
10
+ },
11
+ "forVehicleType": {
12
+ "type": "array",
13
+ "items": {
14
+ "type": "string"
15
+ }
16
+ },
17
+ "additionalInfo": {
18
+ "title": "Additional Info Schema",
19
+ "type": "object",
20
+ "properties": {
21
+ "psv": {
22
+ "properties": {
23
+ "location": {
24
+ "title": "Defect Location Metadata Schema",
25
+ "type": "object",
26
+ "properties": {
27
+ "vertical": {
28
+ "anyOf": [
29
+ {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "string"
33
+ }
34
+ },
35
+ {
36
+ "type": "null"
37
+ }
38
+ ]
39
+ },
40
+ "horizontal": {
41
+ "anyOf": [
42
+ {
43
+ "type": "array",
44
+ "items": {
45
+ "type": "string"
46
+ }
47
+ },
48
+ {
49
+ "type": "null"
50
+ }
51
+ ]
52
+ },
53
+ "lateral": {
54
+ "anyOf": [
55
+ {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string"
59
+ }
60
+ },
61
+ {
62
+ "type": "null"
63
+ }
64
+ ]
65
+ },
66
+ "longitudinal": {
67
+ "anyOf": [
68
+ {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string"
72
+ }
73
+ },
74
+ {
75
+ "type": "null"
76
+ }
77
+ ]
78
+ },
79
+ "rowNumber": {
80
+ "anyOf": [
81
+ {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "number"
85
+ }
86
+ },
87
+ {
88
+ "type": "null"
89
+ }
90
+ ]
91
+ },
92
+ "seatNumber": {
93
+ "anyOf": [
94
+ {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "integer"
98
+ }
99
+ },
100
+ {
101
+ "type": "null"
102
+ }
103
+ ]
104
+ },
105
+ "axleNumber": {
106
+ "anyOf": [
107
+ {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "number"
111
+ }
112
+ },
113
+ {
114
+ "type": "null"
115
+ }
116
+ ]
117
+ }
118
+ },
119
+ "additionalProperties": false
120
+ },
121
+ "notes": {
122
+ "type": "boolean"
123
+ }
124
+ },
125
+ "additionalProperties": false
126
+ },
127
+ "hgv": {
128
+ "properties": {
129
+ "location": {
130
+ "title": "Defect Location Metadata Schema",
131
+ "type": "object",
132
+ "properties": {
133
+ "vertical": {
134
+ "anyOf": [
135
+ {
136
+ "type": "array",
137
+ "items": {
138
+ "type": "string"
139
+ }
140
+ },
141
+ {
142
+ "type": "null"
143
+ }
144
+ ]
145
+ },
146
+ "horizontal": {
147
+ "anyOf": [
148
+ {
149
+ "type": "array",
150
+ "items": {
151
+ "type": "string"
152
+ }
153
+ },
154
+ {
155
+ "type": "null"
156
+ }
157
+ ]
158
+ },
159
+ "lateral": {
160
+ "anyOf": [
161
+ {
162
+ "type": "array",
163
+ "items": {
164
+ "type": "string"
165
+ }
166
+ },
167
+ {
168
+ "type": "null"
169
+ }
170
+ ]
171
+ },
172
+ "longitudinal": {
173
+ "anyOf": [
174
+ {
175
+ "type": "array",
176
+ "items": {
177
+ "type": "string"
178
+ }
179
+ },
180
+ {
181
+ "type": "null"
182
+ }
183
+ ]
184
+ },
185
+ "rowNumber": {
186
+ "anyOf": [
187
+ {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "number"
191
+ }
192
+ },
193
+ {
194
+ "type": "null"
195
+ }
196
+ ]
197
+ },
198
+ "seatNumber": {
199
+ "anyOf": [
200
+ {
201
+ "type": "array",
202
+ "items": {
203
+ "type": "integer"
204
+ }
205
+ },
206
+ {
207
+ "type": "null"
208
+ }
209
+ ]
210
+ },
211
+ "axleNumber": {
212
+ "anyOf": [
213
+ {
214
+ "type": "array",
215
+ "items": {
216
+ "type": "number"
217
+ }
218
+ },
219
+ {
220
+ "type": "null"
221
+ }
222
+ ]
223
+ }
224
+ },
225
+ "additionalProperties": false
226
+ },
227
+ "notes": {
228
+ "type": "boolean"
229
+ }
230
+ },
231
+ "additionalProperties": false
232
+ },
233
+ "trl": {
234
+ "properties": {
235
+ "location": {
236
+ "title": "Defect Location Metadata Schema",
237
+ "type": "object",
238
+ "properties": {
239
+ "vertical": {
240
+ "anyOf": [
241
+ {
242
+ "type": "array",
243
+ "items": {
244
+ "type": "string"
245
+ }
246
+ },
247
+ {
248
+ "type": "null"
249
+ }
250
+ ]
251
+ },
252
+ "horizontal": {
253
+ "anyOf": [
254
+ {
255
+ "type": "array",
256
+ "items": {
257
+ "type": "string"
258
+ }
259
+ },
260
+ {
261
+ "type": "null"
262
+ }
263
+ ]
264
+ },
265
+ "lateral": {
266
+ "anyOf": [
267
+ {
268
+ "type": "array",
269
+ "items": {
270
+ "type": "string"
271
+ }
272
+ },
273
+ {
274
+ "type": "null"
275
+ }
276
+ ]
277
+ },
278
+ "longitudinal": {
279
+ "anyOf": [
280
+ {
281
+ "type": "array",
282
+ "items": {
283
+ "type": "string"
284
+ }
285
+ },
286
+ {
287
+ "type": "null"
288
+ }
289
+ ]
290
+ },
291
+ "rowNumber": {
292
+ "anyOf": [
293
+ {
294
+ "type": "array",
295
+ "items": {
296
+ "type": "number"
297
+ }
298
+ },
299
+ {
300
+ "type": "null"
301
+ }
302
+ ]
303
+ },
304
+ "seatNumber": {
305
+ "anyOf": [
306
+ {
307
+ "type": "array",
308
+ "items": {
309
+ "type": "integer"
310
+ }
311
+ },
312
+ {
313
+ "type": "null"
314
+ }
315
+ ]
316
+ },
317
+ "axleNumber": {
318
+ "anyOf": [
319
+ {
320
+ "type": "array",
321
+ "items": {
322
+ "type": "number"
323
+ }
324
+ },
325
+ {
326
+ "type": "null"
327
+ }
328
+ ]
329
+ }
330
+ },
331
+ "additionalProperties": false
332
+ },
333
+ "notes": {
334
+ "type": "boolean"
335
+ }
336
+ },
337
+ "additionalProperties": false
338
+ }
339
+ },
340
+ "additionalProperties": false,
341
+ "required": [
342
+ "hgv",
343
+ "psv",
344
+ "trl"
345
+ ]
346
+ },
347
+ "items": {
348
+ "type": "array",
349
+ "items": {
350
+ "title": "Defect Item Reference Data Schema",
351
+ "type": "object",
352
+ "properties": {
353
+ "itemNumber": {
354
+ "type": "integer"
355
+ },
356
+ "itemDescription": {
357
+ "type": "string"
358
+ },
359
+ "forVehicleType": {
360
+ "type": "array",
361
+ "items": {
362
+ "type": "string"
363
+ }
364
+ },
365
+ "deficiencies": {
366
+ "type": "array",
367
+ "items": {
368
+ "title": "Defect Deficiency Reference Data Schema",
369
+ "type": "object",
370
+ "properties": {
371
+ "ref": {
372
+ "type": "string"
373
+ },
374
+ "deficiencyId": {
375
+ "type": [
376
+ "string",
377
+ "null"
378
+ ]
379
+ },
380
+ "deficiencySubId": {
381
+ "type": "string"
382
+ },
383
+ "deficiencyCategory": {
384
+ "type": "string"
385
+ },
386
+ "deficiencyText": {
387
+ "type": "string"
388
+ },
389
+ "stdForProhibition": {
390
+ "type": "boolean"
391
+ },
392
+ "forVehicleType": {
393
+ "anyOf": [
394
+ {
395
+ "type": "array",
396
+ "items": {
397
+ "type": "string"
398
+ }
399
+ },
400
+ {
401
+ "type": "string",
402
+ "enum": [
403
+ "psv",
404
+ "hgv",
405
+ "trl",
406
+ "car",
407
+ "lgv",
408
+ "motorcycle"
409
+ ]
410
+ }
411
+ ]
412
+ }
413
+ },
414
+ "additionalProperties": false,
415
+ "required": [
416
+ "ref",
417
+ "deficiencyId",
418
+ "deficiencySubId",
419
+ "deficiencyCategory",
420
+ "deficiencyText",
421
+ "stdForProhibition",
422
+ "forVehicleType"
423
+ ]
424
+ }
425
+ }
426
+ },
427
+ "additionalProperties": false,
428
+ "required": []
429
+ }
430
+ }
431
+ },
432
+ "additionalProperties": false,
433
+ "required": [
434
+ "imNumber",
435
+ "imDescription",
436
+ "forVehicleType",
437
+ "additionalInfo",
438
+ "items"
439
+ ]
440
+ }