Skip to content

Allow validation of the struct DTO or explicitly document unsupported types #74

@monco83

Description

@monco83

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions