m-jovanovic / event-reminder

.NET Core Web API for seamless event organization with configurable notification systems.
MIT License
313 stars 103 forks source link

Input validation consistency #3

Open dotnetcontributer opened 6 months ago

dotnetcontributer commented 6 months ago

Hi Milan,

Thanks a bunch for this awesome project—it's exactly what I've been searching for!

I'm pretty new to clean architecture and DDD, and I've got a couple of questions about keeping things consistent with input rules, like checking for not null or empty and setting maximum lengths. I'd love to hear your thoughts.

The not null/empty rules are in the Domain layer, but they're also duplicated in the Application layer. So, when I need to change the rules, I have to make updates in two places. There's a risk that a developer might forget to update one of them. Any best practices for solving this?

The max length rules are in the Application layer. Should I also have the same rules in the Domain layer? If not, why do we have not empty rules in both layers? If yes, it brings me back to my first question.

Looking forward to your insights.

Best regards.

Ebrahem-Outlook commented 2 months ago

Y