ImmediatePlatform / Immediate.Validations

Source generated validations for Immediate.Handlers parameters
MIT License
4 stars 2 forks source link

Emit warning for types with validated members without [Validate] attribute #58

Closed svee4 closed 2 months ago

svee4 commented 3 months ago

Emit a warning for a type whose members have validation attributes, but the type itself does not have the [Validate] attribute AND it does not implement the IValidationTarget<T> interface, thus making all the validation attributes useless.

Example code for which a warning would be raised:

// note the missing [Validate] and IValidationTarget<Query>
public class Query
{
    [Immediate.Validations.Shared.GreaterThan(0)]
    public int Value { get; set; }
}

Having only one of [Validate] or IValidationTarget<T> raises a warning about the other, so that's not a concern.