更换swaggerui
This commit is contained in:
@@ -20,7 +20,7 @@ Yi框架-一套与SqlSugar一样爽的.Net6低代码开源框架。
|
||||
适合.Net6学习、Sqlsugar学习 、项目二次开发。
|
||||
集大成者,终究轮子
|
||||
|
||||
Yi框架最新版本标签:`v1.0.1` 更新时间:2022/4/15
|
||||
Yi框架最新版本标签:`v1.0.2` 更新时间:2022/4/16
|
||||
|
||||
(项目与Sqlsugar同步更新,但这作者老杰哥代码天天爆肝到凌晨两点,我们也尽量会跟上他的脚步。更新频繁,所以可watching持续关注。)
|
||||
|
||||
|
||||
Binary file not shown.
@@ -93,11 +93,5 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.TestController.ContextTest">
|
||||
<summary>
|
||||
自由导航属性
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -62,16 +62,16 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
}, Array.Empty<string>() }
|
||||
});
|
||||
|
||||
c.AddServer(new OpenApiServer()
|
||||
{
|
||||
Url = "https://ccnetcore.com",
|
||||
Description = "Yi-Framework"
|
||||
});
|
||||
c.CustomOperationIds(apiDesc =>
|
||||
{
|
||||
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
||||
return controllerAction.ActionName;
|
||||
});
|
||||
//c.AddServer(new OpenApiServer()
|
||||
//{
|
||||
// Url = "https://ccnetcore.com",
|
||||
// Description = "Yi-Framework"
|
||||
//});
|
||||
//c.CustomOperationIds(apiDesc =>
|
||||
//{
|
||||
// var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
||||
// return controllerAction.ActionName;
|
||||
//});
|
||||
});
|
||||
#endregion
|
||||
|
||||
@@ -85,27 +85,12 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
app.UseSwagger();
|
||||
|
||||
|
||||
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 =>
|
||||
//app.UseKnife4UI(c =>
|
||||
//{
|
||||
// c.RoutePrefix = "swagger"; // serve the UI at root
|
||||
// if (swaggerModels.Length == 0)
|
||||
// {
|
||||
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "Yi.Framework");
|
||||
// c.SwaggerEndpoint("/v1/swagger.json", "Yi.Framework");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
@@ -114,10 +99,25 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
//);
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user