调整swagger 分组
This commit is contained in:
parent
3d3e89ee43
commit
f4bab2b711
@ -2,7 +2,7 @@
|
||||
<!-- 定义项目加载属性 -->
|
||||
<PropertyGroup>
|
||||
<!--JiShe.ServicePro版本-->
|
||||
<ServiceProVersion>1.0.5.29</ServiceProVersion>
|
||||
<ServiceProVersion>1.0.5.33</ServiceProVersion>
|
||||
<!--Volo Abp 版本-->
|
||||
<VoloAbpVersion>9.1.1</VoloAbpVersion>
|
||||
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
using Hangfire.Redis.StackExchange;
|
||||
using JiShe.ServicePro.Core;
|
||||
using JiShe.ServicePro.FreeRedisProvider;
|
||||
using JiShe.ServicePro.SwaggerConfigs;
|
||||
using Medallion.Threading;
|
||||
using Medallion.Threading.Redis;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using Volo.Abp.BlobStoring;
|
||||
using Volo.Abp.BlobStoring.FileSystem;
|
||||
|
||||
@ -150,9 +154,22 @@ public partial class IoTHttpApiHostModule
|
||||
// 文件下载类型
|
||||
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" });
|
||||
|
||||
options.SwaggerDoc("AbpPro",
|
||||
new OpenApiInfo { Title = "AbpPro API", Version = "v1" });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
//options.SwaggerDoc("AbpPro",
|
||||
// new OpenApiInfo { Title = "AbpPro API", Version = "v1" });
|
||||
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
var groupNames = EnumExtensions.GetStringKeyValueList<SwaggerGroupEnum>();
|
||||
|
||||
groupNames.ForEach(group =>
|
||||
{
|
||||
options.SwaggerDoc(group.Key,
|
||||
new OpenApiInfo { Title = group.Value, Version = "v1"});
|
||||
});
|
||||
|
||||
options.DocInclusionPredicate((docName, description) => {
|
||||
|
||||
return description.GroupName == docName;
|
||||
});
|
||||
options.EnableAnnotations(); // 启用注解
|
||||
options.DocumentFilter<HiddenAbpDefaultApiFilter>();
|
||||
options.SchemaFilter<EnumSchemaFilter>();
|
||||
@ -163,6 +180,18 @@ public partial class IoTHttpApiHostModule
|
||||
options.IncludeXmlComments(xml, true);
|
||||
}
|
||||
|
||||
// 加载 模块引入的xml注释
|
||||
// 加载所有xml注释,这里会导致swagger加载有点缓慢
|
||||
var modulePath = Path.Combine(AppContext.BaseDirectory, "moduleSwagger");
|
||||
if (Directory.Exists(modulePath))
|
||||
{
|
||||
var xmlModulePaths = Directory.GetFiles(modulePath, "*.xml");
|
||||
foreach (var xml in xmlModulePaths)
|
||||
{
|
||||
options.IncludeXmlComments(xml, true);
|
||||
}
|
||||
}
|
||||
|
||||
options.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme,
|
||||
new OpenApiSecurityScheme()
|
||||
{
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using JiShe.ServicePro.SwaggerConfigs;
|
||||
using System.Reflection;
|
||||
using Volo.Abp.BlobStoring.FileSystem;
|
||||
|
||||
namespace JiShe.IoT
|
||||
@ -70,7 +72,14 @@ namespace JiShe.IoT
|
||||
app.UseSwagger();
|
||||
app.UseAbpSwaggerUI(options =>
|
||||
{
|
||||
options.SwaggerEndpoint("/swagger/AbpPro/swagger.json", "AbpPro API");
|
||||
var groupNames = EnumExtensions.GetStringKeyValueList<SwaggerGroupEnum>();
|
||||
|
||||
groupNames.ForEach(attr => {
|
||||
|
||||
options.SwaggerEndpoint($"/swagger/{attr.Key}/swagger.json", attr.Value);
|
||||
});
|
||||
//options.SwaggerEndpoint("/swagger/AbpPro/swagger.json", "AbpPro API");
|
||||
|
||||
options.DocExpansion(DocExpansion.None);
|
||||
options.DefaultModelsExpandDepth(-1);
|
||||
});
|
||||
|
||||
@ -66,4 +66,8 @@
|
||||
<Content Remove="$(UserProfile)\.nuget\packages\*\*\contentFiles\any\*\*.abppkg*.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="moduleSwagger\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -19,11 +19,12 @@
|
||||
<form class="form-horizontal" method="post">
|
||||
@Html.AntiForgeryToken()
|
||||
<span class="heading">后台服务登录</span>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="userName" placeholder="用户名">
|
||||
<input type="text" class="form-control" name="userName" value="admin" placeholder="用户名">
|
||||
</div>
|
||||
<div class="form-group help">
|
||||
<input type="password" class="form-control" name="password" placeholder="密码">
|
||||
<input type="password" class="form-control" name="password" value="1q2w3E*" placeholder="密码">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-default">登录</button>
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>$(DotnetTargetFrameworkVersion)</TargetFramework>
|
||||
<RootNamespace>JiShe.IoT</RootNamespace>
|
||||
<NoWarn>$(NoWarn);1591;1570</NoWarn>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -41,7 +41,7 @@ namespace JiShe.IoT
|
||||
public override void PostConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
// 定时任务
|
||||
ConfigureBackgroundJob(context);
|
||||
//ConfigureBackgroundJob(context);
|
||||
}
|
||||
|
||||
private static void ConfigureBackgroundJob(ServiceConfigurationContext context)
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>$(DotnetTargetFrameworkVersion)</TargetFramework>
|
||||
<RootNamespace>JiShe.IoT</RootNamespace>
|
||||
<NoWarn>$(NoWarn);1591;1570</NoWarn>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user