Skip to content

Can't validate Array #34

Open
Open

Description

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

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

Activity

  1. paranoidjk commented on Apr 20, 2018

    @paranoidjk
    Contributor

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

  2. BkunS commented on Mar 16, 2019

    @BkunS

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions