developer82
developer82

Reputation: 13733

ASP.NET Core Web Api automatic help pages

In previous versions of ASP.NET, when I created Web Api 2, visual studio automatically wired up automatic generation of documentation for the API.

It's also explained here: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages

I'm writing a new project and I've decided to do it with ASP.NET Core, but I don't see anything similar to what existed in the previous versions that generates the documentation from the API (I'm also guessing that's its a bit different since all controllers now inherit from the same Controller class).

But, is there some way to have help files generated for ASP.NET Core APIs?

Upvotes: 7

Views: 9206

Answers (1)

Ron Gerard Valero
Ron Gerard Valero

Reputation: 1

For this instance, I used the Microsoft.AspNetCore.Mvc.ApiExplorer to inject IApiDescriptionGroupCollectionProvider, and tryaddenumerable for IApiDescriptionProvider, DefaultApiDescriptionProvider

I then created a help controller which provided me a list of string from looping into ApiDescriptionGroups.Items[0] then getting each relativepath. Also checking if there are ParameterDescriptions then getting all its name to stringbuilder to provide me the API description. Not bad but hehe. That's what the old man wants me todo. Hahaha.

EDIT: You can discard the tryaddenumerable for IApiDescriptionProvider, DefaultApiDescriptionProvider as for this example i am not using the provider to be expanded in the api documentation entities.

Upvotes: 0

Related Questions