A toolchain for ASP.NET Core to automatically generating API documentation.
[x] Get Enum raw constant value and XML comments.
public enum Gender {
/// <summary>
/// 未知.
/// </summary>
Unknown,
/// <summary>
/// 男性.
/// </summary>
Male,
/// <summary>
/// 女性.
/// </summary>
Female,
}
{
"0": "未知",
"1": "男性",
"2": "女性"
}
To integrate ApiHelp
to your project, download this repo and see Host source code, running and open link api/help/ui
in your browser to view the result.
Microsoft.AspNetCore.ApiHelp.Core
The core API toolchain for ASP.NET Core.
The three styles UI (Swagger, JsonH, JsonEditor) for Microsoft.AspNetCore.ApiHelp.Core.
PM> Install-Package Microsoft.AspNetCore.ApiHelp
public void ConfigureServices(IServiceCollection services) {
services.AddMvc()
.AddApiHelp(options => {
options.IgnoreObsoleteApi = true;
options.GenerateStrategy = DocumentGenerateStrategy.Eager;
options.IncludeSupportedMediaType = false;
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
app.UseApiHelp(new ApiHelpUIOptions {
Title = "API toolchain for ASP.NET Core",
UI = ApiHelpUI.Swagger,
});
app.UseMvc();
}