All Projects → luoyunchong → IGeekFan.AspNetCore.Knife4jUI

luoyunchong / IGeekFan.AspNetCore.Knife4jUI

Licence: Apache-2.0 license
support .NET Core3.0+,.NET Standard2.0 Swagger UI knife4j ui,you can use NSwagger or Swashbuckle.AspNetCore in packages

Programming Languages

C#
18002 projects
HTML
75241 projects

Projects that are alternatives of or similar to IGeekFan.AspNetCore.Knife4jUI

Recaptcha.aspnetcore
Google reCAPTCHA v2/v3 for .NET Core 3.x
Stars: ✭ 122 (-31.46%)
Mutual labels:  aspnetcore, nuget
Osharp
OSharp是一个基于.NetCore的快速开发框架,框架对 AspNetCore 的配置、依赖注入、日志、缓存、实体框架、Mvc(WebApi)、身份认证、功能权限、数据权限等模块进行更高一级的自动化封装,并规范了一套业务实现的代码结构与操作流程,使 .Net Core 框架更易于应用到实际项目开发中。
Stars: ✭ 2,151 (+1108.43%)
Mutual labels:  aspnetcore, netstandard
Elmahcore
ELMAH for Net.Standard and Net.Core
Stars: ✭ 127 (-28.65%)
Mutual labels:  aspnetcore, netstandard
Headerpropagation
ASP.NET Core middleware to propagate HTTP headers from the incoming request to the outgoing HTTP Client requests. This is a backport to ASP.NET Core 2.1 (and 2.2) of the ASP.NET Core HeaderPropagation middleware I had recently contributed to the ASP.NET Core project.
Stars: ✭ 23 (-87.08%)
Mutual labels:  aspnetcore, netstandard
aspnetcore-authentication-apikey
Easy to use and very light weight Microsoft style API Key Authentication Implementation for ASP.NET Core. It can be setup so that it can accept API Key in Header, Authorization Header, QueryParams or HeaderOrQueryParams.
Stars: ✭ 215 (+20.79%)
Mutual labels:  aspnetcore, netstandard
Csla
A home for your business logic in any .NET application.
Stars: ✭ 865 (+385.96%)
Mutual labels:  aspnetcore, netstandard
Dotnetcore
.NET 5 Nuget Packages.
Stars: ✭ 146 (-17.98%)
Mutual labels:  aspnetcore, nuget
AspSqliteCache
An ASP.NET Core IDistributedCache provider backed by SQLite
Stars: ✭ 39 (-78.09%)
Mutual labels:  aspnetcore, nuget
MsCoreOne
MsCoreOne is a simple Ecommerce with using many technologies such as .NET 5, Entity Framework Core 5, React 16.13 with modern Clean Architecture, Domain-Driven Design, CQRS, SOLID, Identity Server 4, Blazor. It will focus on resolving the problems always see in the process to develop projects.
Stars: ✭ 77 (-56.74%)
Mutual labels:  aspnetcore, swagger-ui
Blazortable
Blazor Table Component with Sorting, Paging and Filtering
Stars: ✭ 249 (+39.89%)
Mutual labels:  aspnetcore, nuget
Blazorwebformscomponents
A collection of Blazor components that emulate the ASP.NET Web Forms controls of the same name
Stars: ✭ 274 (+53.93%)
Mutual labels:  aspnetcore, nuget
dark-sky-core
A .NET Standard Library for using the Dark Sky API.
Stars: ✭ 55 (-69.1%)
Mutual labels:  nuget, netstandard
Identityserver4aspnetcoreidentitytemplate
An ASP.NET Core 3.1 IdentityServer4 Identity Bootstrap 4 template with localization
Stars: ✭ 262 (+47.19%)
Mutual labels:  aspnetcore, nuget
Couchdb Net
EF Core-like CouchDB experience for .NET!
Stars: ✭ 50 (-71.91%)
Mutual labels:  aspnetcore, netstandard
Cosmos.Identity
A Cosmos storage provider for ASP.NET Core Identity.
Stars: ✭ 26 (-85.39%)
Mutual labels:  aspnetcore, netstandard
Owaspheaders.core
A .NET Core middleware for injecting the Owasp recommended HTTP Headers for increased security
Stars: ✭ 138 (-22.47%)
Mutual labels:  aspnetcore, nuget
Megaapiclient
MegaApiClient is a C# .Net library to access http://mega.co.nz / http://mega.nz cloud storage and file hosting service.
Stars: ✭ 151 (-15.17%)
Mutual labels:  nuget, netstandard
DevOpsExamples
A repo to show you how to use a private NuGet feed, such as Telerik, to restore packages in Azure DevOps, GitHub Actions, GitLab CI and AppCenter.
Stars: ✭ 16 (-91.01%)
Mutual labels:  aspnetcore, nuget
Revo
Event Sourcing, CQRS and DDD framework for C#/.NET Core.
Stars: ✭ 162 (-8.99%)
Mutual labels:  aspnetcore, netstandard
profiler-api
The portable version of JetBrains profiler API for .NET Framework / .NET Core / .NET / .NET Standard / Mono
Stars: ✭ 21 (-88.2%)
Mutual labels:  aspnetcore, netstandard

IGeekFan.AspNetCore.Knife4jUI

一个swagger ui 库:knife4j UI,支持 .NET Core3.0+或.NET Standard2.0。

nuget stats GitHub license

相关依赖项

knife4j

  • knife4j-vue

Swashbuckle.AspNetCore

  • Swashbuckle.AspNetCore.Swagger
  • Swashbuckle.AspNetCore.SwaggerGen

Demo

📚 快速开始

🚀安装包

以下为使用Swashbuckle.AspNetCore.Swagger底层组件

1.Install the standard Nuget package into your ASP.NET Core application.

Package Manager : 

Install-Package Swashbuckle.AspNetCore.Swagger
Install-Package Swashbuckle.AspNetCore.SwaggerGen
Install-Package IGeekFan.AspNetCore.Knife4jUI

OR

CLI :

dotnet add package Swashbuckle.AspNetCore.Swagger
dotnet add package Swashbuckle.AspNetCore.SwaggerGen
dotnet add package IGeekFan.AspNetCore.Knife4jUI

2.In the ConfigureServices method of Startup.cs, register the Swagger generator, defining one or more Swagger documents.

using Microsoft.AspNetCore.Mvc.Controllers
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using IGeekFan.AspNetCore.Knife4jUI;

🚁 ConfigureServices

3.服务配置,CustomOperationIds和AddServer是必须的。

   services.AddSwaggerGen(c =>
    {
        c.SwaggerDoc("v1",new OpenApiInfo{Title = "API V1",Version = "v1"});
        c.AddServer(new OpenApiServer()
        {
            Url = "",
            Description = "vvv"
        });
        c.CustomOperationIds(apiDesc =>
        {
            var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
            return  controllerAction.ControllerName+"-"+controllerAction.ActionName;
        });
    });

💪 Configure

  1. 中间件配置
app.UseSwagger();

app.UseKnife4UI(c =>
{
    c.RoutePrefix = ""; // serve the UI at root
    c.SwaggerEndpoint("/v1/api-docs", "V1 Docs");
});

app.UseEndpoints(endpoints =>
{
    endpoints.MapControllers();
    endpoints.MapSwagger("{documentName}/api-docs");
});

5.更多功能

为文档添加注释 在项目上右键--属性--生成

在AddSwaggerGen方法中添加如下代码

c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "SwaggerDemo.xml"),true);

最后一个参数设置为true,代表启用控制器上的注释

运行后如看不到控制器上注释显示,请点开文档管理->个性化设置,开启分组tag显示description说明属性

NSwag.AspNetCore

(请参考目录test/WebSites/NSwag.Swagger.Knife4jUI)

public void ConfigureServices(IServiceCollection services)
 {
    // 其它Service
     services.AddOpenApiDocument();
 }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
            // 其它 Use
          app.UseOpenApi();
          app.UseKnife4UI(c =>
         {
               c.RoutePrefix = "";
               c.SwaggerEndpoint("/swagger/v1/swagger.json");
          });
}

即可使用 Knife4jUI

🔎 效果图

运行项目,打开 https://localhost:5001/index.html#/home

docs/home.jpg

更多配置请参考

更多项目

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].