@dvsa/cvs-type-definitions 1.0.11
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/README.md +53 -0
- package/json-schemas/.DS_Store +0 -0
- package/json-schemas/activity/index.json +62 -0
- package/json-schemas/defect-category-reference-data/index.json +440 -0
- package/json-schemas/defect-details/index.json +265 -0
- package/json-schemas/defect-location/index.json +49 -0
- package/json-schemas/reason-item/index.json +17 -0
- package/json-schemas/tech-record/index.json +639 -0
- package/json-schemas/test/index.json +1843 -0
- package/json-schemas/test-result/index.json +636 -0
- package/json-schemas/test-station/index.json +67 -0
- package/json-schemas/test-type/index.json +479 -0
- package/json-schemas/vehicle/index.json +1804 -0
- package/json-schemas/vehicle-tech-record/index.json +683 -0
- package/json-schemas/visit/index.json +1895 -0
- package/lib/schemas.d.ts +1 -0
- package/lib/schemas.js +18 -0
- package/lib/src/schema-validation/schema-validator.d.ts +3 -0
- package/lib/src/schema-validation/schema-validator.js +22 -0
- package/package.json +35 -0
- package/types/activity/index.d.ts +23 -0
- package/types/defect-category-reference-data/index.d.ts +52 -0
- package/types/defect-details/index.d.ts +53 -0
- package/types/defect-location/index.d.ts +16 -0
- package/types/reason-item/index.d.ts +11 -0
- package/types/tech-record/index.d.ts +202 -0
- package/types/test/index.d.ts +353 -0
- package/types/test-result/index.d.ts +136 -0
- package/types/test-station/index.d.ts +23 -0
- package/types/test-type/index.d.ts +98 -0
- package/types/vehicle/index.d.ts +345 -0
- package/types/vehicle-tech-record/index.d.ts +212 -0
- package/types/visit/index.d.ts +366 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# cvs-type-definitions
|
|
2
|
+
[json schema](https://json-schema.org/) and .ts type definitions for cvs vta application
|
|
3
|
+
|
|
4
|
+
# Usage
|
|
5
|
+
|
|
6
|
+
## Install GitHub package:
|
|
7
|
+
|
|
8
|
+
- Ensure consuming repo is set up to install private DVSA packages by adding the following to the `.npmrc` file:
|
|
9
|
+
`@dvsa:registry=https://npm.pkg.github.com`
|
|
10
|
+
- **NOTE:** in order to install private DVSA packages you will need a `.npmrc` file in your `$PATH` containing a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) linked to the DVSA org. You should add the token to your `.npmrc` file as follows:
|
|
11
|
+
- `//npm.pkg.github.com/:_authToken=<AUTH_TOKEN_HERE>`
|
|
12
|
+
- install GitHub package: `npm install @dvsa/cvs-type-definitions@latest`
|
|
13
|
+
|
|
14
|
+
## Example usage (TS types):
|
|
15
|
+
|
|
16
|
+
`import { CommercialVehicleTestSchema } from @dvsa/cvs-type-definitions/types/test`
|
|
17
|
+
|
|
18
|
+
## Example usage (json schemas)
|
|
19
|
+
|
|
20
|
+
The package exports an `isValidObject()` function which can be used to validate an object against a specified schema. E.g:
|
|
21
|
+
|
|
22
|
+
`import { isValidObject } from '@dvsa/cvs-type-definitions/lib/src/schema-validation/schema-validator';`
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
`const isValidVisit: boolean = isValidObject('visit', myVisitObject);`
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Updating a schema
|
|
30
|
+
|
|
31
|
+
Edits should only be made to `json` schema definitions within `json-definitions` directory.
|
|
32
|
+
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
1. Navigate into the relevant schema (e.g. `./json-definitions/test/index.json`)
|
|
36
|
+
2. Edit file
|
|
37
|
+
3. Generate the new TypeScript and de-referenced json schema definitions using `npm run generate`
|
|
38
|
+
4. Bump the version of the package using `npm version {major|minor|patch}`
|
|
39
|
+
5. Publish updates
|
|
40
|
+
|
|
41
|
+
# Adding a new schema
|
|
42
|
+
|
|
43
|
+
1. Create a new subdirectory with an appropriate name within the `json-defininitions` directory (e.g. `my-new-schema`)
|
|
44
|
+
2. Add an `index.json` file to the new directory with appropriate json schema definitions
|
|
45
|
+
3. Add the new schema name to the `schemas` constant array in `./schemas.ts` **NOTE:** this MUST match the directory name created at step 1 (`my-new-schema` in the example here)
|
|
46
|
+
3. Generate the new TypeScript definitions using `npm run generate`
|
|
47
|
+
4. Bump the version of the package using `npm version {major|minor|patch}`
|
|
48
|
+
5. Publish updates
|
|
49
|
+
|
|
50
|
+
# Publishing github package
|
|
51
|
+
|
|
52
|
+
1. Raise a Pull Request on Github and await approvals
|
|
53
|
+
2. Once merged, publish the new package from the latest `develop` branch to GitHub packages using `npm publish` - _You must be logged in and have the correct permissions to publish to the package
|
|
Binary file
|
|
@@ -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
|
+
"oneOf": [
|
|
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
|
+
}
|