Web Api 5.2.3, hosted in IIS using Owin.Host.SystemWeb
We have a Web Api (5.2.3) controller action with the following signature which we want the request body to be validated by FluentValidation, but the URI params to be bound but not validated:
public IHttpActionResult Put([FromUri] string userId, Resources.Identity identities)
We have written a custom validator for the "identities" param but when the code executes, an error occurs which appears to be caused by not being able to find a Validator for the "userId" param.
Looking through the history of issues, my understanding was that anything marked with the FromUri attribute would not fire any validation but this doesn't seem to be the case:
Unable to resolve type: FluentValidation.IValidator`1[[System.String, mscorlib, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Due to the way the URIs have been designed, the userId must remain in the action signature. I have stepped into the Web Api source during debugging and it appears that FromUri should be validating as it uses the CompositeModelBinder class to invoke the validators
- can anyone suggest anything else I should try?