105040 Update Swagger文档分组支持
This commit is contained in:
parent
97bc99e853
commit
cb8b1c5de9
|
|
@ -0,0 +1,217 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<doc>
|
||||||
|
<assembly>
|
||||||
|
<name>LFlow.Base</name>
|
||||||
|
</assembly>
|
||||||
|
<members>
|
||||||
|
<member name="T:LFlow.Base.App">
|
||||||
|
<summary>
|
||||||
|
程序对象
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Default.DefaultCurdRepo`2">
|
||||||
|
<summary>
|
||||||
|
默认的增删改查仓储
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
<typeparam name="K"></typeparam>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Default.DefaultCurdRepo`2.DeleteById(`1)">
|
||||||
|
<summary>
|
||||||
|
根据ID删除对象
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<returns></returns>
|
||||||
|
<exception cref="T:System.Exception"></exception>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Default.DefaultCurdRepo`2.Get(`1)">
|
||||||
|
<summary>
|
||||||
|
根据ID获取对象
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Default.DefaultCurdRepo`2.GetAll(System.Int32,System.Int32,System.Int32@)">
|
||||||
|
<summary>
|
||||||
|
批量查询(分页)
|
||||||
|
</summary>
|
||||||
|
<param name="pageIndex"></param>
|
||||||
|
<param name="pageSize"></param>
|
||||||
|
<param name="pageTotal"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Default.DefaultCurdRepo`2.SaveOrUpdate(`0,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
报错或是更新对象
|
||||||
|
</summary>
|
||||||
|
<param name="entity"></param>
|
||||||
|
<param name="isUpdate"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Default.DefaultCurdRepo`2.Search(`0)">
|
||||||
|
<summary>
|
||||||
|
搜索
|
||||||
|
</summary>
|
||||||
|
<param name="whereObj"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Default.DefaultCurdRepo`2.WhereSearchId(`0)">
|
||||||
|
<summary>
|
||||||
|
查找ID
|
||||||
|
</summary>
|
||||||
|
<param name="whereObj"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Interfaces.BaseController">
|
||||||
|
<summary>
|
||||||
|
基础控制器
|
||||||
|
</summary>
|
||||||
|
<example> Route("api/[controller]/[action]") ApiController </example>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Interfaces.IController">
|
||||||
|
<summary>
|
||||||
|
控制器接口
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Interfaces.IDataModel">
|
||||||
|
<summary>
|
||||||
|
数据模型接口 Repo层用
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:LFlow.Base.Interfaces.IDataModel.ID">
|
||||||
|
<summary>
|
||||||
|
ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Interfaces.IModel">
|
||||||
|
<summary>
|
||||||
|
模型顶层接口 Service层用
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Interfaces.IModule">
|
||||||
|
<summary>
|
||||||
|
模块接口
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Interfaces.IRepo`2">
|
||||||
|
<summary>
|
||||||
|
通用的仓库对象接口
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T">数据模型</typeparam>
|
||||||
|
<typeparam name="K">主键</typeparam>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Interfaces.IRepo`2.Get(`1)">
|
||||||
|
<summary>
|
||||||
|
获取单个对象
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Interfaces.IRepo`2.DeleteById(`1)">
|
||||||
|
<summary>
|
||||||
|
删除单个对象
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Interfaces.IRepo`2.SaveOrUpdate(`0,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
保存与更新
|
||||||
|
</summary>
|
||||||
|
<param name="entity"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Interfaces.IRepo`2.GetAll(System.Int32,System.Int32,System.Int32@)">
|
||||||
|
<summary>
|
||||||
|
获取所有对象列表(默认分页)
|
||||||
|
</summary>
|
||||||
|
<param name="pageIndex"></param>
|
||||||
|
<param name="pageSize"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Interfaces.IRepo`2.Search(`0)">
|
||||||
|
<summary>
|
||||||
|
根据条件搜索对象列表
|
||||||
|
</summary>
|
||||||
|
<param name="whereObj"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Interfaces.IRepo`2.WhereSearchId(`0)">
|
||||||
|
<summary>
|
||||||
|
根据条件搜索主键列表
|
||||||
|
</summary>
|
||||||
|
<param name="whereObj"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Interfaces.IService">
|
||||||
|
<summary>
|
||||||
|
服务接口
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Program.LoadSubService(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
|
||||||
|
<summary>
|
||||||
|
从子文件夹中加载DLL
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Utils.ApiExplorerGroupPerVersionConvention">
|
||||||
|
<summary>
|
||||||
|
控制器模型约定
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Utils.ApiExplorerGroupPerVersionConvention.Apply(Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerModel)">
|
||||||
|
<summary>
|
||||||
|
配置
|
||||||
|
</summary>
|
||||||
|
<param name="controller"></param>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Utils.ApiResult`1">
|
||||||
|
<summary>
|
||||||
|
返回结果包装
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Utils.Mapper.Map``1(System.Object)">
|
||||||
|
<summary>
|
||||||
|
将一个对象映射到另一个对象
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
<param name="source"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Utils.ObjectToWhereExp.ToWhereExp(LFlow.Base.Interfaces.IModel)">
|
||||||
|
<summary>
|
||||||
|
将IModel对象转换为where条件
|
||||||
|
</summary>
|
||||||
|
<param name="model"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:LFlow.Base.Utils.PagedApiResult`1">
|
||||||
|
<summary>
|
||||||
|
返回结果包装 (分页)
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Utils.RegisterModule.RegisterAllModel(System.Collections.Generic.List{System.Type},Microsoft.Extensions.DependencyInjection.IServiceCollection)">
|
||||||
|
<summary>
|
||||||
|
注册所有模型
|
||||||
|
</summary>
|
||||||
|
<param name="types"></param>
|
||||||
|
<param name="services"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Utils.RegisterModule.RegisterAllService(System.Collections.Generic.List{System.Type},Microsoft.Extensions.DependencyInjection.IServiceCollection)">
|
||||||
|
<summary>
|
||||||
|
注册所有服务
|
||||||
|
</summary>
|
||||||
|
<param name="types"></param>
|
||||||
|
<param name="services"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:LFlow.Base.Utils.RegisterModule.RegisterAllRepo(System.Collections.Generic.List{System.Type},Microsoft.Extensions.DependencyInjection.IServiceCollection)">
|
||||||
|
<summary>
|
||||||
|
注册所有数据仓库
|
||||||
|
</summary>
|
||||||
|
<param name="types"></param>
|
||||||
|
<param name="services"></param>
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
|
</doc>
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
<OutputPath>../LFlow_Bin/</OutputPath>
|
<OutputPath>../LFlow_Bin/</OutputPath>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<DocumentationFile>Base.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -46,16 +46,19 @@ public static class Program
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
builder.Services.AddHttpContextAccessor();
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
|
||||||
Log.Logger.Information("ConfigureSqlSugar");
|
Log.Logger.Information("ConfigureSqlSugar");
|
||||||
builder.Services.ConfigureSqlSugar();
|
builder.Services.ConfigureSqlSugar();
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers(c =>
|
||||||
|
{
|
||||||
|
c.Conventions.Add(new ApiExplorerGroupPerVersionConvention());
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddSwaggerGen(u =>
|
builder.Services.AddSwaggerGen(u =>
|
||||||
{
|
{
|
||||||
|
|
||||||
u.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
|
u.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
|
||||||
{
|
{
|
||||||
Version = "Ver.1",
|
Version = "Ver.1",
|
||||||
|
|
@ -67,6 +70,22 @@ public static class Program
|
||||||
Email = "noemail@ling.chat"
|
Email = "noemail@ling.chat"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
u.IncludeXmlComments("Base.xml", true);
|
||||||
|
// 获取自定义的xml目录
|
||||||
|
var xmlPath = Path.Combine(System.AppContext.BaseDirectory, "Services");
|
||||||
|
DirectoryInfo dir = new(xmlPath);
|
||||||
|
// 获取目录下的所有xml文件,并设置为swagger文档包含文件
|
||||||
|
dir.GetFiles("*.xml").ToList().ForEach(f =>
|
||||||
|
{
|
||||||
|
u.IncludeXmlComments(f.FullName, true);
|
||||||
|
|
||||||
|
u.SwaggerDoc(Path.GetFileNameWithoutExtension(f.Name), new Microsoft.OpenApi.Models.OpenApiInfo
|
||||||
|
{
|
||||||
|
Version = "Ver.1",
|
||||||
|
Title = Path.GetFileNameWithoutExtension(f.Name),
|
||||||
|
Description = "LFlow api test and document",
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
// 配置跨域策略
|
// 配置跨域策略
|
||||||
builder.Services.AddCors(options =>
|
builder.Services.AddCors(options =>
|
||||||
|
|
@ -118,6 +137,14 @@ public static class Program
|
||||||
app.UseSwaggerUI(u =>
|
app.UseSwaggerUI(u =>
|
||||||
{
|
{
|
||||||
u.DocumentTitle = "LFlow";
|
u.DocumentTitle = "LFlow";
|
||||||
|
var xmlPath = Path.Combine(System.AppContext.BaseDirectory, "Services");
|
||||||
|
DirectoryInfo dir = new(xmlPath);
|
||||||
|
// 获取目录下的所有xml文件,并设置为swagger文档包含文件
|
||||||
|
dir.GetFiles("*.xml").ToList().ForEach(f =>
|
||||||
|
{
|
||||||
|
var progName = Path.GetFileNameWithoutExtension(f.Name);
|
||||||
|
u.SwaggerEndpoint($"/swagger/{progName}/swagger.json", progName);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 在启动后调用Sqlsugar进行CodeFirst
|
// 在启动后调用Sqlsugar进行CodeFirst
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LFlow.Base.Utils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 控制器模型约定
|
||||||
|
/// </summary>
|
||||||
|
public class ApiExplorerGroupPerVersionConvention : IControllerModelConvention
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 配置
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="controller"></param>
|
||||||
|
public void Apply(ControllerModel controller)
|
||||||
|
{
|
||||||
|
foreach (var action in controller.Actions)
|
||||||
|
{
|
||||||
|
action.ApiExplorer.GroupName = controller.ControllerName;
|
||||||
|
action.ApiExplorer.IsVisible = true;
|
||||||
|
Log.Logger.Information($"ApiExplorerGroup added -> {controller.ControllerName} / {action.ActionName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<DocumentationFile>..\LFlow_Bin\Services\OnlineManegement.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<DocumentationFile>..\LFlow_Bin\Services\Permission.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<DocumentationFile>..\LFlow_Bin\Services\Role.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<DocumentationFile>..\LFlow_Bin\Services\UserManagement.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
<UseCommonOutputDirectory>true</UseCommonOutputDirectory>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<DocumentationFile>..\LFlow_Bin\Services\VersionManagement.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue