request-validation插件 布尔(Boolean)验证 plaintext { "bodyschema": { "type": "object", "required": ["boolpayload"], "properties": { "boolpayload": { "type": "boolean", "default": true } } } } 数字范围(Number or Integer)验证 plaintext { "bodyschema": { "type": "object", "required": ["integerpayload"], "properties": { "integerpayload": { "type": "integer", "minimum": 1, "maximum": 65535 } } } } 字符串长度(String)验证 plaintext { "bodyschema": { "type": "object", "required": ["stringpayload"], "properties": { "stringpayload": { "type": "string", "minLength": 1, "maxLength": 32 } } } } 正则表达式(Regex)验证 plaintext { "bodyschema": { "type": "object", "required": ["regexpayload"], "properties": { "regexpayload": { "type": "string", "minLength": 1, "maxLength": 32, "pattern": "[[^[azAZ09]+$]]" } } } } 数组(Array)验证 plaintext { "bodyschema": { "type": "object", "required": ["arraypayload"], "properties": { "arraypayload": { "type": "array", "minItems": 1, "items": { "type": "integer", "minimum": 200, "maximum": 599 }, "uniqueItems": true, "default": [200, 302] } } } } 多字段组合(Combined)验证 plaintext { "bodyschema": { "type": "object", "required": ["booleanpayload", "arraypayload", "regexpayload"], "properties": { "booleanpayload": { "type": "boolean" }, "arraypayload": { "type": "array", "minItems": 1, "items": { "type": "integer", "minimum": 200, "maximum": 599 }, "uniqueItems": true, "default": [200, 302] }, "regexpayload": { "type": "string", "minLength": 1, "maxLength": 32, "pattern": "[[^[azAZ09]+$]]" } } } } 配置模板 plaintext [必填]headerschema和bodyschema至少二选一,可以同时使用 header数据的schema数据结构 headerschema: body数据的schema数据结构 bodyschema: [可选]当请求被拒绝时要返回的状态码。默认值400,有效范围[200,...,599] rejectedcode: 400 [可选]当请求被拒绝时返回的信息。有效长度为1256 rejectedmsg: “The request param validation failed”