@verii/validation 1.1.0-pre.1770077593 → 1.1.0-pre.1770080046
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/package.json +15 -14
- package/src/validation.js +1 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/validation",
|
|
3
|
-
"version": "1.1.0-pre.
|
|
3
|
+
"version": "1.1.0-pre.1770080046",
|
|
4
4
|
"description": "Validation package for Velocity Projects, based on ajv and fastify validation",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "cross-env NODE_ENV=test node --test --test-concurrency=1 --experimental-test-module-mocks --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout 'test/**/*.test.js'",
|
|
13
13
|
"test:ci": "NODE_ENV=test node --test --test-concurrency=1 --experimental-test-module-mocks --experimental-test-coverage --test-coverage-include='src/**' --test-reporter=spec --test-reporter=junit --test-reporter-destination=stdout --test-reporter-destination=test-results.junit.xml --test-reporter=lcov --test-reporter-destination=lcov.info 'test/**/*.test.js'",
|
|
14
|
-
"lint": "eslint
|
|
14
|
+
"lint": "eslint .",
|
|
15
15
|
"lint:ci": "eslint . --format json >> eslint-results.json",
|
|
16
|
-
"lint:fix": "eslint --fix
|
|
16
|
+
"lint:fix": "eslint --fix ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"ajv": "8.17.1",
|
|
@@ -22,25 +22,26 @@
|
|
|
22
22
|
"lodash": "^4.17.21"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@verii/config": "1.1.0-pre.
|
|
26
|
-
"@verii/tests-helpers": "1.1.0-pre.
|
|
27
|
-
"eslint": "
|
|
28
|
-
"eslint-config-airbnb-
|
|
29
|
-
"eslint-config-prettier": "
|
|
30
|
-
"eslint-plugin-autofix": "
|
|
31
|
-
"eslint-plugin-better-mutation": "1.
|
|
25
|
+
"@verii/config": "1.1.0-pre.1770080046",
|
|
26
|
+
"@verii/tests-helpers": "1.1.0-pre.1770080046",
|
|
27
|
+
"eslint": "9.39.2",
|
|
28
|
+
"eslint-config-airbnb-extended": "3.0.1",
|
|
29
|
+
"eslint-config-prettier": "10.1.8",
|
|
30
|
+
"eslint-plugin-autofix": "2.2.0",
|
|
31
|
+
"eslint-plugin-better-mutation": "2.1.0",
|
|
32
32
|
"eslint-plugin-import": "2.32.0",
|
|
33
33
|
"eslint-plugin-prefer-arrow-functions": "3.9.1",
|
|
34
|
-
"eslint-plugin-prettier": "
|
|
35
|
-
"eslint-watch": "
|
|
34
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
35
|
+
"eslint-watch": "8.0.0",
|
|
36
36
|
"expect": "30.2.0",
|
|
37
37
|
"fastify": "5.7.3",
|
|
38
|
-
"
|
|
38
|
+
"globals": "16.5.0",
|
|
39
|
+
"prettier": "3.8.1"
|
|
39
40
|
},
|
|
40
41
|
"nx": {
|
|
41
42
|
"tags": [
|
|
42
43
|
"lib"
|
|
43
44
|
]
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b095afed30b67c9643860bfddec83169ef8a50b4"
|
|
46
47
|
}
|
package/src/validation.js
CHANGED
|
@@ -30,14 +30,9 @@ const wrapValidationError = (result, dataVar = '') => {
|
|
|
30
30
|
return result;
|
|
31
31
|
}
|
|
32
32
|
const error = new Error(schemaErrorsText(result, dataVar));
|
|
33
|
-
|
|
34
|
-
// eslint-disable-next-line better-mutation/no-mutation
|
|
35
33
|
error.statusCode = 400;
|
|
36
|
-
// eslint-disable-next-line better-mutation/no-mutation
|
|
37
34
|
error.code = 'FST_ERR_VALIDATION';
|
|
38
|
-
// eslint-disable-next-line better-mutation/no-mutation
|
|
39
35
|
error.validation = result;
|
|
40
|
-
// eslint-disable-next-line better-mutation/no-mutation
|
|
41
36
|
error.validationContext = dataVar;
|
|
42
37
|
return error;
|
|
43
38
|
};
|
|
@@ -83,6 +78,7 @@ const initValidation = (ajv) => {
|
|
|
83
78
|
return { isValid, error };
|
|
84
79
|
};
|
|
85
80
|
|
|
81
|
+
// eslint-disable-next-line default-param-last
|
|
86
82
|
const validateJSONBySchema = (json = {}, schema) => {
|
|
87
83
|
const validate = ajv.compile(schema);
|
|
88
84
|
const valid = validate(json);
|