FluentValidation.AutoValidation
FluentValidation.AutoValidation copied to clipboard
ICollection<T> support
Current implementation checks if parameter type is class. This check fails if we use ICollection<T> as parameter type.
ASP.NET is able to deserialize to it, it is also possible to create and register IValidator<ICollection<T>>.
What is the reason for not allowing such interfaces to be auto-validated?
In PR with refactor of IsCustomType (#32) it is proposed to change to even more strict, by disallowing anything that implements IEnumerable, which I would consider breaking change and would like to understand the reason for it.
Hi @tomasz-soltysik, thanks for expressing your concerns! I haven't really gotten around to reviewing the PR that you mentioned. If the merging of said PR would result in a breaking change it will not be something that will be released in the v1.x versions. If a breaking change would slip through the cracks it is something I would revert right away.
Regarding the validation of ICollection<T> and variants; great point, I guess if FluentValidation supports validation for it we should support it as well. If anything I am of the opinion that the IsCustomType check should be more relaxed instead of more strict. I am also reluctant to relaxing the IsCustomType check in the v1.x versions since you also could argue that that would also be considered a breaking change :).
@mvdgun @tomasz-soltysik I added another commit to remove the check for IEnumerable
Moved this issue to the v2.0 milestone