FluentValidation.AutoValidation
FluentValidation.AutoValidation copied to clipboard
Allow validation of the struct DTO or explicitly document unsupported types
Good day!
Autovalidation does not work when I try use it with struct DTO in MVC controllers. The reason is here: https://github.com/SharpGrip/FluentValidation.AutoValidation/blob/master/FluentValidation.AutoValidation.Mvc/src/Filters/FluentValidationAutoValidationActionFilter.cs#L64 and here: https://github.com/SharpGrip/FluentValidation.AutoValidation/blob/master/FluentValidation.AutoValidation.Shared/src/Extensions/TypeExtensions.cs#L21
For some reason some types are not considered as 'Custom types' and ignored in the filter.
I suggest reconsider this logic and eliminate this validation completely or at least exclude from check list structs. Honestly, I don't fully understand the reason for this behavior.
If you disagree to eliminate or mitigate this validation I can suggest:
- customize this validation via options or specific interface injection,
- at least describe this behavior in documentation.
Hi there, since this is a breaking change I put it in the v2.0 milestone. Should be an easy fix, will pick this one up ASAP. Honestly surprised this issue didn't pop up earlier.
Thank you