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

Validate raw data without having to instantiate a structure #13

Closed
talyssonoc opened this issue Dec 28, 2016 · 0 comments
Closed

Validate raw data without having to instantiate a structure #13

talyssonoc opened this issue Dec 28, 2016 · 0 comments

Comments

@talyssonoc
Copy link
Owner

We could have a way if some raw data is valid given a structure, it could be a static method like:

const Car = attributes({
  model: String
})(class Car { });

const { valid, errors } = Car.validate({ model: 123 });

valid; // false
errors; // [ { message: '"model" must be a string', path: 'model' } ]

I'm not sure about the API and the name of the method yet.

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

1 participant