Closed leonardbinet closed 1 year ago
Hi @leonardbinet , thanks for the feedback :bulb:!!!
I thought of something similar on this issue But I didn't continue.
About validation, this core library is premised on being free of third-party libraries, But I believe that "decorators" can be a good solution for new implementations.
Just need to find a way to avoid breaking the domain with "throw errors" and returning a result instance.
Feel free to fork and test new implementations and suggestions.
Every help is welcome
Thanks!
Is your feature request related to a problem? Please describe.
First, congratulation @4lessandrodev for this great lib 🏅, I really appreciate your work!
In your lib, you declare a
Validator
class, I think that validation is a topic that is well addressed by some dedicated packages, notably class-validator which provide rich functionalities.Wouldn't it make sense to rather use such lib rather than writing a custom implementation?
I see those potential benefits:
ValueObject
(see example below)Describe the solution you'd like
In your example app, let's take the example of the product-price value object:
With some changes on the
ValueObject
class (adopting such approach ), this might be simplified to: