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

Improve MVC endpoint detection

Open DenisPav opened this issue 1 year ago • 1 comments

Hi, I've decided to try out your package due to older one from FluentValidation being deprecated. But I've bumped into a issue where none of my validators were actually fired. I've debugged everything and noted that the IAsyncFilter that you use to wire things up is detecting the MVC endpoints based of if controller is actually ControllerBase.

My current project is using a bit of a different MVC setup where controllers are not inherited but make use of ApiController attribute and conventions as described here.

Due to that validators won't get triggered as controllers are convention based and do not inherit ControllerBase or other controller based classes that are provided out of the box.

It would be great if we can somehow support this so that this flavor of MVC controllers will trigger validators automatically also.

PS: thanks for awesome project.

DenisPav avatar Apr 20 '24 19:04 DenisPav

Hi @DenisPav, your MVC setup sounds like a use case we should support. I don’t have a lot of time on my hands at the moment so this one is going to have to wait unfortunately. Feel free to open up a PR if you are comfortable enough.

mvdgun avatar Apr 24 '24 19:04 mvdgun

Good find @DenisPav. Thought, i was configuring things wrong there. Might pick this up over some weekend as i foresee this coming a significant issue.

Is it ok if i add this limitation to the README, it would have save me a lot of time and i'm sure it will save other developer's time as well

francis04j avatar Dec 04 '24 12:12 francis04j