@dvsa/cvs-type-definitions 2.0.30 → 2.1.1
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/json-schemas/v3/tech-record/get/hgv/complete/index.json +1 -1
- package/json-schemas/v3/tech-record/get/hgv/skeleton/index.json +1 -1
- package/json-schemas/v3/tech-record/get/hgv/testable/index.json +1 -1
- package/json-schemas/v3/tech-record/get/psv/complete/index.json +2 -2
- package/json-schemas/v3/tech-record/get/psv/skeleton/index.json +2 -2
- package/json-schemas/v3/tech-record/get/psv/testable/index.json +2 -2
- package/json-schemas/v3/tech-record/get/trl/complete/index.json +1 -1
- package/json-schemas/v3/tech-record/get/trl/skeleton/index.json +1 -1
- package/json-schemas/v3/tech-record/get/trl/testable/index.json +1 -1
- package/json-schemas/v3/tech-record/put/hgv/complete/index.json +1 -1
- package/json-schemas/v3/tech-record/put/hgv/skeleton/index.json +1 -1
- package/json-schemas/v3/tech-record/put/hgv/testable/index.json +1 -1
- package/json-schemas/v3/tech-record/put/psv/complete/index.json +2 -2
- package/json-schemas/v3/tech-record/put/psv/skeleton/index.json +2 -2
- package/json-schemas/v3/tech-record/put/psv/testable/index.json +2 -2
- package/json-schemas/v3/tech-record/put/trl/complete/index.json +1 -1
- package/json-schemas/v3/tech-record/put/trl/skeleton/index.json +1 -1
- package/json-schemas/v3/tech-record/put/trl/testable/index.json +1 -1
- package/package.json +1 -1
- package/schema-validator.d.ts +2 -1
- package/schema-validator.js +6 -5
|
@@ -550,7 +550,7 @@
|
|
|
550
550
|
},
|
|
551
551
|
"techRecord_bodyMake": {
|
|
552
552
|
"type": "string",
|
|
553
|
-
"maxLength":
|
|
553
|
+
"maxLength": 50
|
|
554
554
|
},
|
|
555
555
|
"techRecord_bodyModel": {
|
|
556
556
|
"type": "string",
|
|
@@ -558,7 +558,7 @@
|
|
|
558
558
|
},
|
|
559
559
|
"techRecord_chassisMake": {
|
|
560
560
|
"type": "string",
|
|
561
|
-
"maxLength":
|
|
561
|
+
"maxLength": 50
|
|
562
562
|
},
|
|
563
563
|
"techRecord_chassisModel": {
|
|
564
564
|
"type": "string",
|
|
@@ -582,7 +582,7 @@
|
|
|
582
582
|
"string",
|
|
583
583
|
"null"
|
|
584
584
|
],
|
|
585
|
-
"maxLength":
|
|
585
|
+
"maxLength": 50
|
|
586
586
|
},
|
|
587
587
|
"techRecord_bodyModel": {
|
|
588
588
|
"type": [
|
|
@@ -596,7 +596,7 @@
|
|
|
596
596
|
"string",
|
|
597
597
|
"null"
|
|
598
598
|
],
|
|
599
|
-
"maxLength":
|
|
599
|
+
"maxLength": 50
|
|
600
600
|
},
|
|
601
601
|
"techRecord_chassisModel": {
|
|
602
602
|
"type": [
|
|
@@ -557,7 +557,7 @@
|
|
|
557
557
|
"string",
|
|
558
558
|
"null"
|
|
559
559
|
],
|
|
560
|
-
"maxLength":
|
|
560
|
+
"maxLength": 50
|
|
561
561
|
},
|
|
562
562
|
"techRecord_bodyModel": {
|
|
563
563
|
"type": [
|
|
@@ -571,7 +571,7 @@
|
|
|
571
571
|
"string",
|
|
572
572
|
"null"
|
|
573
573
|
],
|
|
574
|
-
"maxLength":
|
|
574
|
+
"maxLength": 50
|
|
575
575
|
},
|
|
576
576
|
"techRecord_chassisModel": {
|
|
577
577
|
"type": [
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
},
|
|
545
545
|
"techRecord_bodyMake": {
|
|
546
546
|
"type": "string",
|
|
547
|
-
"maxLength":
|
|
547
|
+
"maxLength": 50
|
|
548
548
|
},
|
|
549
549
|
"techRecord_bodyModel": {
|
|
550
550
|
"type": "string",
|
|
@@ -552,7 +552,7 @@
|
|
|
552
552
|
},
|
|
553
553
|
"techRecord_chassisMake": {
|
|
554
554
|
"type": "string",
|
|
555
|
-
"maxLength":
|
|
555
|
+
"maxLength": 50
|
|
556
556
|
},
|
|
557
557
|
"techRecord_chassisModel": {
|
|
558
558
|
"type": "string",
|
|
@@ -577,7 +577,7 @@
|
|
|
577
577
|
"string",
|
|
578
578
|
"null"
|
|
579
579
|
],
|
|
580
|
-
"maxLength":
|
|
580
|
+
"maxLength": 50
|
|
581
581
|
},
|
|
582
582
|
"techRecord_bodyModel": {
|
|
583
583
|
"type": [
|
|
@@ -591,7 +591,7 @@
|
|
|
591
591
|
"string",
|
|
592
592
|
"null"
|
|
593
593
|
],
|
|
594
|
-
"maxLength":
|
|
594
|
+
"maxLength": 50
|
|
595
595
|
},
|
|
596
596
|
"techRecord_chassisModel": {
|
|
597
597
|
"type": [
|
|
@@ -557,7 +557,7 @@
|
|
|
557
557
|
"string",
|
|
558
558
|
"null"
|
|
559
559
|
],
|
|
560
|
-
"maxLength":
|
|
560
|
+
"maxLength": 50
|
|
561
561
|
},
|
|
562
562
|
"techRecord_bodyModel": {
|
|
563
563
|
"type": [
|
|
@@ -571,7 +571,7 @@
|
|
|
571
571
|
"string",
|
|
572
572
|
"null"
|
|
573
573
|
],
|
|
574
|
-
"maxLength":
|
|
574
|
+
"maxLength": 50
|
|
575
575
|
},
|
|
576
576
|
"techRecord_chassisModel": {
|
|
577
577
|
"type": [
|
package/package.json
CHANGED
package/schema-validator.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ErrorObject } from "ajv";
|
|
2
2
|
import { schemas } from "./schemas";
|
|
3
3
|
export declare type Schema = typeof schemas[number];
|
|
4
|
-
export declare
|
|
4
|
+
export declare function isValidObject<B extends boolean | undefined>(schemaName: Schema, objectToValidate: object): boolean;
|
|
5
|
+
export declare function isValidObject<B extends boolean | undefined>(schemaName: Schema, objectToValidate: object, returnErrors: B): B extends false ? boolean : ErrorObject[];
|
package/schema-validator.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isValidObject = void 0;
|
|
4
4
|
var ajv_1 = require("ajv");
|
|
5
5
|
var fs_1 = require("fs");
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
function isValidObject(schemaName, objectToValidate, returnErrors, logErrors) {
|
|
7
|
+
var _a;
|
|
8
8
|
if (logErrors === void 0) { logErrors = false; }
|
|
9
9
|
var ajv = new ajv_1.default({ removeAdditional: true, allErrors: true });
|
|
10
10
|
var schema = JSON.parse((0, fs_1.readFileSync)("".concat(__dirname, "/json-schemas/").concat(schemaName), "utf8"));
|
|
@@ -13,9 +13,10 @@ var isValidObject = function (schemaName, objectToValidate, returnErrors, logErr
|
|
|
13
13
|
if (logErrors && validateFunction.errors) {
|
|
14
14
|
console.error(validateFunction.errors);
|
|
15
15
|
}
|
|
16
|
-
if (returnErrors
|
|
17
|
-
return validateFunction.errors;
|
|
16
|
+
if (returnErrors) {
|
|
17
|
+
return (_a = validateFunction.errors) !== null && _a !== void 0 ? _a : [];
|
|
18
18
|
}
|
|
19
19
|
return isValid;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
exports.isValidObject = isValidObject;
|
|
22
|
+
;
|