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

custom validation #62

Open
LiranBri opened this issue Oct 26, 2018 · 1 comment
Open

custom validation #62

LiranBri opened this issue Oct 26, 2018 · 1 comment

Comments

@LiranBri
Copy link

LiranBri commented Oct 26, 2018

I suggest to add an option to add a custom business validation. for example, if field A is "abc" and bigger than B, then validation is failed

it would be very usefull when used in the domain layer, such as in @talyssonoc 's boilerplate
https://github.com/talyssonoc/node-api-boilerplate/blob/master/src/domain/user/User.js

note: here it was solved by adding additional "isLegal" function to the class.. but it can be part of the validation. otherwise every time you create an instance you would call both "validate()" and "isLegal()" which is wierd and error prone if you forget one of the two

@t3h2mas
Copy link
Contributor

t3h2mas commented Jun 3, 2020

@talyssonoc If someone were to take a run at this, what do you think the API should look like?

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

2 participants