integralEvents: {
baseIntegral: '12',
userName: [
'5a06b428e806d466f7e118dc',
'5a06b428e806d466f7e118d4'
],
name: '1212',
content: '12',
createTime: '2018-01-02T16:00:00.000Z',
revocation: '0'
}
egg-validate能验证者这种嵌套的数据,比如验证userName是不是数组,我看了文档,没这方面的介绍。
我用点语法也不行。
"userIntegral.userName": "array"
const rule = {
baseIntegral: 'string',
userName: {
type: 'array',
itemType: {type:'string', format: ...}
},
....
};
or
const rule = {
integralEvents: {
type: 'object',
rule: {
baseIntegral: 'string',
userName: {
type: 'array',
itemType: {type:'string', format: ...}
.....
},
}
}
}
@2015-lizaiyang https://www.npmjs.com/package/parameter
还有这种操作,@zhangming0305 谢谢。
不是这么写的吗?itemType怎么会是个对象?
const rule = {
baseIntegral: 'string',
userName: {
type: 'array',
itemType: 'string' ,
rule: {
}
},
....
};
Most helpful comment
or