markvincze / rest-api-helpers

Collection of extensions for ASP.NET MVC helping implementing Rest Apis
20 stars 6 forks source link

usage of ValidationContext in ValidateActionParametersAttribute #2

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi Mark! I've found that custom model validation attributes sometimes override IsValid method with two parameters: object value and ValidationContext validationContext. That's why I decided to add following improvements in ValidateActionParametersAttribute.

Hope you'll find it helpful.

Anyway, since ASP.Net Core 2.1 we will no longer need this attribute: https://andrewlock.net/coming-in-asp-net-core-2-1-top-level-mvc-parameter-validation/

ghost commented 6 years ago

Oh, I've forgot to fix tests. I'll try to fix it this week

markvincze commented 6 years ago

Hey @LutsenkoKirill,
Thanks for the PR! I left two comments, once those are addressed and the tests are fixed, we can merge.