[WebAPI] ApiExplorer doesn't handle ModelBinderAttribute params


When we use ApiExplorer to generate a document, the following conditions causes the item to be skipped:
1-) Action has a parameter used via ModelBinder
2-) If it doesn't make use of TypeConverter

Actually it seems, ApiExplorer does not handle the case when we apply ModelBinder to the parameter itself without using a type converter.

public class SomeCustomType {  public int X {get; private set; }  public int Y {get; private set; }}
public void SomeAction (int num, [ModelBinder(typeof(MyModelBinderSettingPrivateSetter)] SomeCustomType someType)       { ... }
While this action works just fine, its documentation is not generated due to the below line:

In System.Web.Http.Description.ApiParameterDescription: TryExpandUriParameters method only searches if
we have public setter and getter or it can make use of type converter. However, while writing our custom model binder, there is no such requirement. If I use ModelBinder as a parameter attribute and it just works fine. But its documentation is not generated due to above issue. I find this over restricitive and inconsistent.

The alternative, to decorate TypeConverterAttribute, is also not available in all cases as in Portable Class Libraries
Closed May 1, 2014 at 11:19 PM by danroth27
Unfortunately the fix for this issue is pretty complex and doesn't align with our current priorities.