update 控制器上注释展示

This commit is contained in:
luoyunchong
2020-08-13 00:14:20 +08:00
parent d108d99e32
commit 5ea5c57450
16 changed files with 73 additions and 43 deletions

View File

@@ -6,6 +6,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using System.IO;
namespace Knife4jUIDemo
{
@@ -35,6 +36,9 @@ namespace Knife4jUIDemo
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
return controllerAction.ControllerName + "-" + controllerAction.ActionName;
});
var filePath = Path.Combine(System.AppContext.BaseDirectory, "Knife4jUIDemo.xml");
c.IncludeXmlComments(filePath, true);
});
}
@@ -54,6 +58,11 @@ namespace Knife4jUIDemo
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/v1/api-docs", "LinCms");
});
app.UseKnife4UI(c =>
{
c.RoutePrefix = ""; // serve the UI at root