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

Add OneOf() assert #36

Open
nunofgs opened this issue Nov 9, 2015 · 1 comment
Open

Add OneOf() assert #36

nunofgs opened this issue Nov 9, 2015 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@nunofgs
Copy link
Contributor

nunofgs commented Nov 9, 2015

It would be cool to have an assert that validates if at least one of its child nodes is present. For example:

validate({
  phone: new Assert().OneOf({
    main: [new Assert().IsString(), new Assert().Length({ max: 50 })],
    mobile: [new Assert().IsString(), new Assert().Length({ max: 48 })]
  })
});

This would make sure that at least a main or an object nodes were given.

@nunofgs nunofgs added enhancement New feature or request help wanted Extra attention is needed labels Nov 9, 2015
@rplopes
Copy link
Contributor

rplopes commented Oct 23, 2018

Is this still relevant? Does it solve any particular problem we're facing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants