Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array validation #108

Open
Diokuz opened this issue Nov 2, 2015 · 3 comments
Open

Array validation #108

Diokuz opened this issue Nov 2, 2015 · 3 comments

Comments

@Diokuz
Copy link

Diokuz commented Nov 2, 2015

I have an array of contacts:

var contacts = [{
    type: 'email',
    value: 'x@x.x'
}, {
    type: 'phone',
    value: '+8 9123 23213123'
}]

Can you please give me an example of schema for this case?

@marcysutton
Copy link

+1 to this. I need to validate that an object contains an array and this doesn't work for that use case at all.

@4kochi
Copy link

4kochi commented Mar 31, 2017

I am not sure if revalidator can handle array as root item. But I know that the lib https://github.com/litixsoft/lx-valid can do it. Here is the schema:

const schema = {
  type: 'array',
  items: {
    type: 'object',
    properties: {
      type: {
        type: 'string'
      },
      value: {
        type: 'string'
      }
    }
  }
};

@brennick
Copy link

brennick commented Oct 4, 2018

Was this ever solved for revalidator library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants