mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-12-30 14:05:48 +08:00
update 控制器上注释展示
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user