FluentValidation.AutoValidation icon indicating copy to clipboard operation
FluentValidation.AutoValidation copied to clipboard

Allow validation of the struct DTO or explicitly document unsupported types

Open monco83 opened this issue 4 weeks ago • 2 comments

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:

  1. customize this validation via options or specific interface injection,
  2. at least describe this behavior in documentation.

monco83 avatar Nov 13 '25 20:11 monco83

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.

mvdgun avatar Nov 13 '25 23:11 mvdgun

Thank you

monco83 avatar Nov 14 '25 06:11 monco83