更换swaggerui

This commit is contained in:
橙子
2022-04-16 00:16:32 +08:00
parent 88b968e826
commit 0fcf172192
6 changed files with 59 additions and 37 deletions

View File

@@ -20,7 +20,7 @@ Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。
适合.Net6学习、Sqlsugar学习 、项目二次开发。 适合.Net6学习、Sqlsugar学习 、项目二次开发。
集大成者,终究轮子 集大成者,终究轮子
Yi框架最新版本标签`v1.0.1` 更新时间2022/4/15 Yi框架最新版本标签`v1.0.2` 更新时间2022/4/16
项目与Sqlsugar同步更新但这作者老杰哥代码天天爆肝到凌晨两点我们也尽量会跟上他的脚步。更新频繁所以可watching持续关注。 项目与Sqlsugar同步更新但这作者老杰哥代码天天爆肝到凌晨两点我们也尽量会跟上他的脚步。更新频繁所以可watching持续关注。

Binary file not shown.

View File

@@ -93,11 +93,5 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.ContextTest">
<summary>
自由导航属性
</summary>
<returns></returns>
</member>
</members> </members>
</doc> </doc>

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
using Yi.Framework.WebCore;
using Yi.Framework.WebCore.AttributeExtend;
using Yi.Framework.WebCore.AuthorizationPolicy;
namespace Yi.Framework.ApiMicroservice.Controllers
{
[ApiController]
[Route("api/[controller]/[action]")]
public class RoleController : BaseCrudController<RoleEntity>
{
private IRoleService _iRoleService;
public RoleController(ILogger<RoleEntity> logger, IRoleService iRoleService) : base(logger, iRoleService)
{
_iRoleService = iRoleService;
}
}
}

View File

@@ -62,16 +62,16 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
}, Array.Empty<string>() } }, Array.Empty<string>() }
}); });
c.AddServer(new OpenApiServer() //c.AddServer(new OpenApiServer()
{ //{
Url = "https://ccnetcore.com", // Url = "https://ccnetcore.com",
Description = "Yi-Framework" // Description = "Yi-Framework"
}); //});
c.CustomOperationIds(apiDesc => //c.CustomOperationIds(apiDesc =>
{ //{
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor; // var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
return controllerAction.ActionName; // return controllerAction.ActionName;
}); //});
}); });
#endregion #endregion
@@ -85,27 +85,12 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
app.UseSwagger(); app.UseSwagger();
app.UseKnife4UI(c => //app.UseKnife4UI(c =>
{
c.RoutePrefix = "swagger"; // serve the UI at root
if (swaggerModels.Length == 0)
{
c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework");
}
else
{
foreach (var k in swaggerModels)
{
c.SwaggerEndpoint(k.url, k.name);
}
}
});
//app.UseSwaggerUI(c =>
//{ //{
// c.RoutePrefix = "swagger"; // serve the UI at root
// if (swaggerModels.Length == 0) // if (swaggerModels.Length == 0)
// { // {
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework"); // c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework");
// } // }
// else // else
// { // {
@@ -114,10 +99,25 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
// c.SwaggerEndpoint(k.url, k.name); // c.SwaggerEndpoint(k.url, k.name);
// } // }
// } // }
//});
//} app.UseSwaggerUI(c =>
{
if (swaggerModels.Length == 0)
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework");
}
else
{
foreach (var k in swaggerModels)
{
c.SwaggerEndpoint(k.url, k.name);
}
}
//); }
);
} }
} }