parameter icon indicating copy to clipboard operation
parameter copied to clipboard

Can't validate Array

Open leaves4j opened this issue 7 years ago • 2 comments

const arr = [{ key: ' ' }];
const rules = {};
validate(rules, arr);

No matter how to set the rule can not validate the array

leaves4j avatar Mar 29 '18 03:03 leaves4j

You can wrap array to a object, then pass it to parameter https://github.com/node-modules/parameter#array

paranoidjk avatar Apr 20 '18 08:04 paranoidjk

Of course you could wrap everything into an object as a "work around", but this somehow makes options.validateRoot default to false a little confusing and misleading: by giving an impression that it could validate something other than objects, such as arrays.

BkunS avatar Mar 16 '19 23:03 BkunS