structure icon indicating copy to clipboard operation
structure copied to clipboard

custom validation

Open LiranBri opened this issue 7 years ago • 1 comments

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

LiranBri avatar Oct 26 '18 08:10 LiranBri

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

t3h2mas avatar Jun 03 '20 16:06 t3h2mas