parameter icon indicating copy to clipboard operation
parameter copied to clipboard

A parameter verify tools.

Results 35 parameter issues
Sort by recently updated
recently updated
newest added

假设 我有两个字段, 只需要存在其中一个字段即可. 这个怎么去写 Rule.

`Object.prototype.hasOwnProperty.call(obj, prop)` should be safer

传参 { a: undefined } 在校验 { a: { type: 'string', required: false } } 时, 会失败。 ```javasript it.only('test paramsValidates', async () => { const res = ctx.paramsValidate({ a: 'string',...

有没有ts的描述文件 有些自定义验证要调用他这边预设方法,但是TS会报错, 我是在 egg中用

Hey there! I'd like to report a security issue but cannot find contact instructions on your repository. If not a hassle, might you kindly add a `SECURITY.md` file with an...

过滤未知字段是一个很常用且有用的功能啊,前端传参时不一定针对每个接口都pick。如果需要更严格的时候, 存在未知字段就返回错误。这样经过校验的参数都可以放心使用。不然参数经过校验后,还需要去判断存不存在一些未知字段?

I feel there is something wrong with this line of code in function checkArray() .... const subRule = rule.itemType === 'object' ? rule : rule.rule || formatRule(rule.itemType); ..... ========should be...

项目使用egg开发,使用内置的egg-validate作为参数验证,有幸接触到本项目。由于参数验证中不能使用自定义函数对对象进行转换,所以会造成一些不便。 例如前端用户get方式传递参数`{ids:[1,2,3]}`,url编码后url为 `http://xxx.com?ids[]=1&ids[]=2&ids[]=3`,后端接受到的参数`{ids:['1','2','3']}`,数组中每个项目均为字符串。此时如果使用以下验证对象会验证失败。 ```javascript const rules = { ids:{ type:'array', itemType:'int', } } ``` 已经实现以下转换方式,只有在自定义convertType为函数的情况下,才支持对对向的转换。且兼容之前任何操作 ```javascript const p = new Parameter({ convert:true }) const data = { ids:['1','2','3'] } const...

不好意思,实在没看明白自定义规则如何使用。 const rule = { title: 'myRule' }; let r = ctx.validate(rule, ctx.request.body); r 一直是undefined

I have the problem. I want to set some value to null. but it throw an error. `const rule = { transferDate: {type: 'string', required: false, allowEmpty: true}}` `let someData...