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

2

4

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!

Ela answered 3/11, 2014 at 20:50 Comment(0)
E
11

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."

Ela answered 4/11, 2014 at 13:35 Comment(0)
S
0

(This probably ought to be a comment but I don't have enough rep yet)

I'd start with break pointing the various points in Areas\HelpPage - e.g. XmlDocumentationProvider - to see if that gives you any clues. Nothing leaps out at me.

Could it be that you've changed where the XML help file is output and not updated the document path passed to XmlDocumentationProvider? The path is set through the Properties page - Output XML Documentation File.

Stanchion answered 4/11, 2014 at 12:34 Comment(1)
Good advice for setting breakpoints, although I have no idea where to set them. As far as the XML file, the paths in HelpPageConfig.cs and in Properties are the same, and I've included it in the project, so it's not that.Ela

© 2022 - 2024 — McMap. All rights reserved.