dev-mastery / comments-api

MIT License
1.92k stars 649 forks source link

Validation in entity #55

Open mirkadev opened 3 years ago

mirkadev commented 3 years ago

Hi Bill! Thanks a lot for your code - it was really useful for me. I have the next question - how correct is it to use validation in entities? Is it still within business rules? Maybe we should use validation in other layers of the application?

richardantao commented 3 years ago

Validation is related to the entities, and is part of the business logic that ensures that the entities are subjected to the rules that are compliant with the business objectives. So entity validation belongs in the domain layer (where it is).

hle-aashish commented 3 years ago

Uncle Bob himself clarifying on this.

https://groups.google.com/g/clean-code-discussion/c/latn4x6Zo7w/m/bFwtDI1XSA8J

mirkadev commented 3 years ago

Uncle Bob himself clarifying on this.

https://groups.google.com/g/clean-code-discussion/c/latn4x6Zo7w/m/bFwtDI1XSA8J

Big thanks!