Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource Description on Web API Help page is showing "None."

I'm having trouble figuring out how to get the Help page in my Web Api to show anything for Resource Description other than None. It has IHttpActionResult linked and then "None." after that. I got my samples working by adding config.SetActualResponseType(typeof(ComplexType), "Controller", "Action"); to HelpPageConfig.cs. My controller looks like this:

/// <summary>
/// My description
/// </summary>
[Route("MyRoute")]
public IHttpActionResult Get()
{
    try
    {
        //throw new Exception("TEST");
        return Ok(returnValue);
    }
    catch (Exception ex)
    {
        *Company Log Method*
        return NotFound();
    }
}

I don't know what I'm missing from HelpPageConfig.cs or any place else. Maybe a fresh set of eyes can catch something. Thanks in advance for the help!

like image 709
dkiefer Avatar asked Dec 19 '22 09:12

dkiefer


1 Answers

I just needed to add [ResponseType(typeof(MyModel))] above my action after including using System.Web.Http.Description; at the top of my controller. I'm getting the description of my model now instead of IHttpActionResult and "None."

like image 143
dkiefer Avatar answered Mar 07 '23 05:03

dkiefer