jwaliszko / ExpressiveAnnotations

Annotation-based conditional validation library.
MIT License
351 stars 124 forks source link

Unseal RequiredIf #189

Closed SpaceOgre closed 6 years ago

SpaceOgre commented 6 years ago

Hi,

I'm using RequiredIf with the same property in lots of ViewModels (it is in our BaseViewModel) and I would like to reduce the risk of people writing wrong or the need to look elsewhere for the correct way. So I would like to extend RequiredIf to add special logic for this but I can't since it is sealed so I wonder if it would be possible for you to unseal it?

Regards Daniel

jwaliszko commented 6 years ago

Hi, sealed keyword is there by design, as explained here: https://github.com/JaroslawWaliszko/ExpressiveAnnotations/issues/70.

If you'd like to provide your implementation of RequiredIfAttribute, inherit from ExpressiveAttribute. Here are the examples, i.e.: CustomizedAssertThatAttribute and CustomizedRequiredIfAttribute.

Sample project provides also implementation of relevant custom validators and usage samples.