mm_validator 0.0.0-stage → 1.0.0
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/index.js +9 -0
- package/package.json +34 -4
- package/tool/abac/index.js +7 -0
- package/tool/abac/tool.json +76 -0
- package/tool/basic/index.js +7 -0
- package/tool/basic/tool.json +69 -0
- package/tool/code/index.js +7 -0
- package/tool/code/tool.json +69 -0
- package/tool/enum/index.js +7 -0
- package/tool/enum/tool.json +51 -0
- package/tool/json/index.js +7 -0
- package/tool/json/tool.json +65 -0
- package/tool/jwt/index.js +7 -0
- package/tool/jwt/tool.json +91 -0
- package/tool/length/index.js +7 -0
- package/tool/length/tool.json +53 -0
- package/tool/oauth/index.js +7 -0
- package/tool/oauth/tool.json +86 -0
- package/tool/params/index.js +7 -0
- package/tool/params/tool.json +92 -0
- package/tool/pattern/index.js +7 -0
- package/tool/pattern/tool.json +52 -0
- package/tool/range/index.js +7 -0
- package/tool/range/tool.json +79 -0
- package/tool/rbac/index.js +7 -0
- package/tool/rbac/tool.json +74 -0
- package/tool/required/index.js +7 -0
- package/tool/required/tool.json +46 -0
- package/tool/sanitize/index.js +7 -0
- package/tool/sanitize/tool.json +83 -0
- package/tool/string/index.js +7 -0
- package/tool/string/tool.json +62 -0
- package/tool/type/index.js +7 -0
- package/tool/type/tool.json +54 -0
- package/README.md +0 -3
package/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/** 工具宿主入口:统一复用 mm_tool_host,避免各模块重复复制扫描骨架 */
|
|
3
|
+
const { createToolHost } = require('mm_tool_host');
|
|
4
|
+
|
|
5
|
+
module.exports = createToolHost(__dirname, { load: true });
|
|
6
|
+
|
|
7
|
+
/* mm-tool-logic-export 工具能力层:其它模块可 require("<pkg>").tools.<name> 直接引用 */
|
|
8
|
+
Object.defineProperty(module.exports, 'tools', { enumerable: true, configurable: true,
|
|
9
|
+
get: function () { return require('./lib/tools'); } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_validator",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "mm_workflow 验证器工具包:ABAC、基础、验证码、枚举、JSON、JWT、长度、OAuth、参数、模式、范围、RBAC、必填、清洗、字符串、类型 等 16 个验证工具模块",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://gitee.com/qiuwenwu91/mm_validator.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"mm_mod",
|
|
13
|
+
"operator",
|
|
14
|
+
"validator",
|
|
15
|
+
"超级美眉",
|
|
16
|
+
"工作流工具"
|
|
17
|
+
],
|
|
18
|
+
"layer": "shared",
|
|
19
|
+
"group": "operator",
|
|
20
|
+
"operator": "validator",
|
|
21
|
+
"author": "邱文武",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"files": [
|
|
24
|
+
"index.js",
|
|
25
|
+
"tool"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=16"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "node -e \"const t=require('./index.js').loadTools();console.log(Object.keys(t).length+' tools loaded')\""
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"mm_tool_host": "^1.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "abac",
|
|
3
|
+
"handler": "validator",
|
|
4
|
+
"title": "ABAC权限验证器",
|
|
5
|
+
"description": "基于属性的访问控制验证,依据主体、资源、环境属性评估策略是否放行。适用场景:多条件组合的细粒度权限校验、动态授权决策时。工作流提示:action 选 evaluate 评估,subject/resource/environment 传属性、operation 传操作名,结果看 valid 与 policies。",
|
|
6
|
+
"type": "core",
|
|
7
|
+
"params": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"action": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "操作类型: evaluate/add_policy/remove_policy",
|
|
13
|
+
"enum": [
|
|
14
|
+
"evaluate",
|
|
15
|
+
"add_policy",
|
|
16
|
+
"remove_policy"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"subject": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"description": "主体属性(用户属性)"
|
|
22
|
+
},
|
|
23
|
+
"resource": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"description": "资源属性"
|
|
26
|
+
},
|
|
27
|
+
"environment": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "环境属性"
|
|
30
|
+
},
|
|
31
|
+
"operation": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "操作名称"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"required": [
|
|
37
|
+
"action"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"returns": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"valid": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"description": "验证是否通过"
|
|
46
|
+
},
|
|
47
|
+
"tip": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "提示信息,通过时为'参数校验通过',失败时包含错误数量和详情"
|
|
50
|
+
},
|
|
51
|
+
"errors": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"description": "错误信息列表"
|
|
54
|
+
},
|
|
55
|
+
"policies": {
|
|
56
|
+
"description": "evaluate 时返回决策列表,add_policy 时返回全部策略列表"
|
|
57
|
+
},
|
|
58
|
+
"error": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"description": "错误信息,仅调用出错时返回",
|
|
61
|
+
"properties": {
|
|
62
|
+
"code": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "错误码,如 VAL_ABAC"
|
|
65
|
+
},
|
|
66
|
+
"message": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "错误描述"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"options": {},
|
|
75
|
+
"group": "permission"
|
|
76
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "basic",
|
|
3
|
+
"handler": "validator",
|
|
4
|
+
"title": "Basic验证器",
|
|
5
|
+
"description": "验证 HTTP Basic 认证,支持编码、解码与校验用户名密码。适用场景:接口登录鉴权、生成 Basic 头或反向解析时。工作流提示:action 选 encode/verify 时填 username、password,选 decode/verify 时填 encoded,结果看 valid 与 errors。",
|
|
6
|
+
"type": "core",
|
|
7
|
+
"params": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"action": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "操作类型: encode/decode/verify",
|
|
13
|
+
"enum": [
|
|
14
|
+
"encode",
|
|
15
|
+
"decode",
|
|
16
|
+
"verify"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"username": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "用户名(encode/verify时必填)"
|
|
22
|
+
},
|
|
23
|
+
"password": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "密码(encode/verify时必填)"
|
|
26
|
+
},
|
|
27
|
+
"encoded": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Base64编码的认证字符串(decode/verify时必填)"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": [
|
|
33
|
+
"action"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"returns": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"valid": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "验证是否通过"
|
|
42
|
+
},
|
|
43
|
+
"tip": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "提示信息,通过时为'参数校验通过',失败时包含错误数量和详情"
|
|
46
|
+
},
|
|
47
|
+
"errors": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"description": "错误信息列表"
|
|
50
|
+
},
|
|
51
|
+
"error": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"description": "错误信息,仅调用出错时返回",
|
|
54
|
+
"properties": {
|
|
55
|
+
"code": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "错误码,如 VAL_BASIC"
|
|
58
|
+
},
|
|
59
|
+
"message": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "错误描述"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"options": {},
|
|
68
|
+
"group": "auth"
|
|
69
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "code",
|
|
3
|
+
"handler": "validator",
|
|
4
|
+
"title": "代码格式验证器",
|
|
5
|
+
"description": "验证代码语法与格式规范,返回问题列表与修复详情。适用场景:LLM 生成代码后质量把关、提交前静态检查时。工作流提示:code 填待检代码、language 指定语言(默认 javascript)、rules 传检查规则(命名/语法/缩进/引号等),结果看 valid、errors、error_count。",
|
|
6
|
+
"type": "core",
|
|
7
|
+
"params": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"code": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "待验证的代码内容"
|
|
13
|
+
},
|
|
14
|
+
"language": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "编程语言,默认 javascript"
|
|
17
|
+
},
|
|
18
|
+
"rules": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"description": "检查规则列表: naming/semicolon/jsdoc/boolean_name/long_function/event_handler/try_catch/tab_indent/double_quote/var_decl/line_length"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": [
|
|
24
|
+
"code"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"returns": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "验证结果,正常时包含 valid/tip/errors/error_count/line_count,异常时包含 error",
|
|
30
|
+
"properties": {
|
|
31
|
+
"valid": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "是否通过验证"
|
|
34
|
+
},
|
|
35
|
+
"tip": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "验证提示信息"
|
|
38
|
+
},
|
|
39
|
+
"errors": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"description": "发现的问题列表"
|
|
42
|
+
},
|
|
43
|
+
"error_count": {
|
|
44
|
+
"type": "number",
|
|
45
|
+
"description": "问题数量"
|
|
46
|
+
},
|
|
47
|
+
"line_count": {
|
|
48
|
+
"type": "number",
|
|
49
|
+
"description": "代码行数"
|
|
50
|
+
},
|
|
51
|
+
"error": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"description": "错误信息,仅调用出错时返回",
|
|
54
|
+
"properties": {
|
|
55
|
+
"code": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "错误码"
|
|
58
|
+
},
|
|
59
|
+
"message": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "错误描述"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"options": {},
|
|
68
|
+
"group": "code"
|
|
69
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "enum",
|
|
3
|
+
"handler": "validator",
|
|
4
|
+
"title": "枚举验证器",
|
|
5
|
+
"description": "校验字段值是否属于指定枚举集合。适用场景:状态机取值校验、白名单检查、选项合法性判断时。工作流提示:field 填字段名、value 填待校验值、options 填允许的枚举数组,结果看 valid(boolean) 与 errors,通过时返回 allowed_values 枚举列表。",
|
|
6
|
+
"type": "core",
|
|
7
|
+
"params": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"field": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "字段名称"
|
|
13
|
+
},
|
|
14
|
+
"value": {
|
|
15
|
+
"description": "待验证的值"
|
|
16
|
+
},
|
|
17
|
+
"options": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"description": "允许的枚举列表"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": [
|
|
23
|
+
"field",
|
|
24
|
+
"value",
|
|
25
|
+
"options"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"returns": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"valid": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "验证是否通过"
|
|
34
|
+
},
|
|
35
|
+
"tip": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "提示信息,通过时为'参数校验通过',失败时包含错误数量和详情"
|
|
38
|
+
},
|
|
39
|
+
"errors": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"description": "错误信息列表"
|
|
42
|
+
},
|
|
43
|
+
"allowed_values": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"description": "允许的枚举值列表"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"options": {},
|
|
50
|
+
"group": "check"
|
|
51
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "json",
|
|
3
|
+
"handler": "validator",
|
|
4
|
+
"title": "JSON格式验证器",
|
|
5
|
+
"description": "验证 JSON 语法与 work.json 字段规范,返回问题列表。适用场景:生成 workflow.json 后的合法性校验、修复前问题定位时。工作流提示:code 填待校验内容、rules 选检查规则(语法/必填字段/命名/版本/描述长度等),结果看 valid、errors、error_count。",
|
|
6
|
+
"type": "core",
|
|
7
|
+
"params": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"code": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "待验证的JSON内容"
|
|
13
|
+
},
|
|
14
|
+
"rules": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"description": "检查规则列表: syntax/required_fields/name_format/version_format/description_length"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": [
|
|
20
|
+
"code"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"returns": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"description": "验证结果,正常时包含 valid/tip/errors/error_count/line_count,异常时包含 error",
|
|
26
|
+
"properties": {
|
|
27
|
+
"valid": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"description": "是否通过验证"
|
|
30
|
+
},
|
|
31
|
+
"tip": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "验证提示信息"
|
|
34
|
+
},
|
|
35
|
+
"errors": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"description": "发现的问题列表"
|
|
38
|
+
},
|
|
39
|
+
"error_count": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"description": "问题数量"
|
|
42
|
+
},
|
|
43
|
+
"line_count": {
|
|
44
|
+
"type": "number",
|
|
45
|
+
"description": "JSON行数"
|
|
46
|
+
},
|
|
47
|
+
"error": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"description": "错误信息,仅调用出错时返回",
|
|
50
|
+
"properties": {
|
|
51
|
+
"code": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"description": "错误码"
|
|
54
|
+
},
|
|
55
|
+
"message": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "错误描述"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"options": {},
|
|
64
|
+
"group": "struct"
|
|
65
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jwt",
|
|
3
|
+
"handler": "validator",
|
|
4
|
+
"title": "JWT验证器",
|
|
5
|
+
"description": "签发、校验与解析 JSON Web Token。适用场景:登录态令牌生成、接口鉴权、解析令牌载荷时。工作流提示:action 选 sign 时填 payload 与 expires_in(秒),选 verify/decode 时填 token,结果看 valid 与 payload。",
|
|
6
|
+
"type": "core",
|
|
7
|
+
"params": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"action": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "操作类型: sign/verify/decode",
|
|
13
|
+
"enum": [
|
|
14
|
+
"sign",
|
|
15
|
+
"verify",
|
|
16
|
+
"decode"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"token": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "JWT令牌(verify/decode时必填)"
|
|
22
|
+
},
|
|
23
|
+
"payload": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"description": "令牌载荷(sign时必填)"
|
|
26
|
+
},
|
|
27
|
+
"expires_in": {
|
|
28
|
+
"type": "number",
|
|
29
|
+
"description": "过期时间(秒)"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": [
|
|
33
|
+
"action"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"returns": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"valid": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "验证是否通过"
|
|
42
|
+
},
|
|
43
|
+
"tip": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "提示信息,通过时为'参数校验通过',失败时包含错误数量和详情"
|
|
46
|
+
},
|
|
47
|
+
"payload": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"description": "解码后的令牌载荷"
|
|
50
|
+
},
|
|
51
|
+
"errors": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"description": "错误信息列表"
|
|
54
|
+
},
|
|
55
|
+
"error": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"description": "错误信息,仅调用出错时返回",
|
|
58
|
+
"properties": {
|
|
59
|
+
"code": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "错误码,如 VAL_JWT"
|
|
62
|
+
},
|
|
63
|
+
"message": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"description": "错误描述"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"options": {
|
|
72
|
+
"secret": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "JWT签名密钥"
|
|
75
|
+
},
|
|
76
|
+
"algorithm": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "签名算法: HS256/RS256",
|
|
79
|
+
"default": "HS256",
|
|
80
|
+
"enum": [
|
|
81
|
+
"HS256",
|
|
82
|
+
"RS256"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"issuer": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"description": "签发者"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"group": "auth"
|
|
91
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "length",
|
|
3
|
+
"handler": "validator",
|
|
4
|
+
"title": "长度验证器",
|
|
5
|
+
"description": "校验字符串或数组的长度是否在指定范围内。适用场景:用户名或密码长度限制、数组条数约束、输入长度兜底检查时。工作流提示:field 填字段名、value 填待校验值、min/max 填最小/最大长度,结果看 valid 与 errors。",
|
|
6
|
+
"type": "core",
|
|
7
|
+
"params": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"field": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "字段名称"
|
|
13
|
+
},
|
|
14
|
+
"value": {
|
|
15
|
+
"description": "待验证的字符串或数组"
|
|
16
|
+
},
|
|
17
|
+
"min": {
|
|
18
|
+
"type": "number",
|
|
19
|
+
"description": "最小长度",
|
|
20
|
+
"min": 0
|
|
21
|
+
},
|
|
22
|
+
"max": {
|
|
23
|
+
"type": "number",
|
|
24
|
+
"description": "最大长度",
|
|
25
|
+
"min": 1,
|
|
26
|
+
"max": 1000000
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": [
|
|
30
|
+
"field",
|
|
31
|
+
"value"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"returns": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"valid": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "验证是否通过"
|
|
40
|
+
},
|
|
41
|
+
"tip": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "提示信息,通过时为'参数校验通过',失败时包含错误数量和详情"
|
|
44
|
+
},
|
|
45
|
+
"errors": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"description": "错误信息列表"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"options": {},
|
|
52
|
+
"group": "check"
|
|
53
|
+
}
|