Shared Validations
Where are shared validations typically stored? For example, say I have a
User resource that has an email that has format and length requirements. Say there was a second resource where I wanted to share those same validations. Where would I store that? Normally I would put it in the MyApp.Accounts.User.Validations.Email module, but I'm not sure if that's appropriate to share across resources as a validation. The only alternative I can think of is having something like MyApp.Accounts.Shared.Validations.Email to make it clear this is a shared validation. Is there a best practice when it comes to this?Solution
There's no hard rule, but for me it's typically just
MyApp.Domain.Validations...