2

I have a ASP.NET Web API which returns a template class but I can't get the Web API Help Page to provide documentation for the return type correctly.

Let's say I have the following Model classes:

public class MyType<T>
{
  /// <summary>A list of T</summary>
  public List<T> MyList { get; set; }
}
public class Foo
{
  /// <summary>Bar string</summary>
  public string Bar { get; set; }
}

and my API action looks as follows

[ResponseType(typeof(MyType<Foo>))]
public IHttpActionResult Get()
{
  return Ok<MyType<Foo>>(new MyType<Foo>());
}

The resulting Web API Help Page then declares that the Get action returns a MyTypeOfFoo and do not provide the XML documentation for MyType, it just lists the parameters it contains. Probably because it don't understand that MyTypeOfFoo is the same as MyType<Foo>. Are there any known solutions to this problem?

Update

Creating a pseudo-class and returning it instead does not work either. E.g.

/// <summary>My Foo Type</summary>
public class MyFooType : MyType<Foo>
{
}

[ResponseType(typeof(MyFooType)]
public IHttpActionResult Get()
{
  return Ok<MyFooType>(new MyFooType());
}

The documentation output for the above code lacks the comments available on the inherited properties.

m__
  • 1,721
  • 1
  • 17
  • 30
  • I think there is limited support for scenarios like yours but since HelpPage's source code is installed along with the package, you can probably modify it according to your needs. – Kiran Jul 22 '14 at 15:01

0 Answers0