kb-server 0.0.4 → 0.0.6
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.
|
@@ -12,8 +12,11 @@ function createAPI(ParamsClass, execution) {
|
|
|
12
12
|
// 校验参数
|
|
13
13
|
const paramsToCheck = params instanceof ParamsClass
|
|
14
14
|
? params
|
|
15
|
-
: (0, class_transformer_1.
|
|
16
|
-
const errors = await (0, class_validator_1.validate)(paramsToCheck || {}
|
|
15
|
+
: (0, class_transformer_1.plainToInstance)(ParamsClass, params);
|
|
16
|
+
const errors = await (0, class_validator_1.validate)(paramsToCheck || {}, {
|
|
17
|
+
// 允许空校验器
|
|
18
|
+
forbidUnknownValues: false,
|
|
19
|
+
});
|
|
17
20
|
if (errors?.length) {
|
|
18
21
|
const errorMessages = errors.flatMap((error) => getMessage(error));
|
|
19
22
|
throw new create_errors_1.CommonErrors.InvalidParameter.ValidationError(errorMessages.join("\n"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kb-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A fast server for Node.JS,made by express.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"better-sse": "^0.13.0",
|
|
26
26
|
"class-transformer": "^0.5.1",
|
|
27
|
-
"class-validator": "^0.14.
|
|
27
|
+
"class-validator": "^0.14.2",
|
|
28
28
|
"dayjs": "^1.11.13",
|
|
29
29
|
"express": "^4.21.1",
|
|
30
30
|
"is-plain-object": "^5.0.0",
|