herbsjs / gotu

Entities - Create your Entity and enjoy an elegant validation and serialization
Other
11 stars 19 forks source link

The validate method must return whether the entity is valid or not #19

Closed maikmb closed 2 years ago

maikmb commented 4 years ago

Hi! Currently, when you validate an entity, you should call validate () and get the result using the isValid () method, but it is more efficient to just call validate () and get the result.

Is Bad:

image

Is Cool:

image

maikmb commented 4 years ago

Hello everyone!

I checked the files and in BaseEntity when calling the isValid () method, the validation() method is already executed internally! I think we can improve the documentation with this information.