Skip to content

custom validation #62

Open
Open

Description

@LiranBri

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

Activity

  1. t3h2mas commented on Jun 3, 2020

    @t3h2mas
    Contributor

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions