mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-04-16 23:42:51 +08:00
update 控制器上注释展示
This commit is contained in:
parent
d108d99e32
commit
5ea5c57450
@ -11,12 +11,13 @@
|
|||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<RepositoryUrl>https://github.com/luoyunchong/IGeekFan.AspNetCore.Knife4jUI.git</RepositoryUrl>
|
<RepositoryUrl>https://github.com/luoyunchong/IGeekFan.AspNetCore.Knife4jUI.git</RepositoryUrl>
|
||||||
<RootNamespace>IGeekFan.AspNetCore.Knife4jUI</RootNamespace>
|
<RootNamespace>IGeekFan.AspNetCore.Knife4jUI</RootNamespace>
|
||||||
<Version>0.0.2</Version>
|
<Version>0.0.3</Version>
|
||||||
<Company />
|
<Company />
|
||||||
<Authors>igeekfan;xiaoym;</Authors>
|
<Authors>igeekfan;xiaoym;</Authors>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Copyright>Apache License 2.0</Copyright>
|
<Copyright>Apache License 2.0</Copyright>
|
||||||
<PackageLicenseExpression></PackageLicenseExpression>
|
<PackageLicenseExpression></PackageLicenseExpression>
|
||||||
|
<AssemblyVersion>0.0.3.0</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
|
||||||
|
@ -6,16 +6,16 @@
|
|||||||
<meta name=viewport content="width=device-width,initial-scale=1">
|
<meta name=viewport content="width=device-width,initial-scale=1">
|
||||||
<link rel=icon href=favicon.ico>
|
<link rel=icon href=favicon.ico>
|
||||||
<title>%(DocumentTitle)</title>
|
<title>%(DocumentTitle)</title>
|
||||||
<link href=knife4j/css/app.8f08f96a.css rel=preload as= style>
|
<link href=knife4j/css/app.b932f742.css rel=preload>
|
||||||
<link href=knife4j/js/app.c02977a4.js rel=preload as=script>
|
<link href=knife4j/js/app.920753bc.js rel=preload as=script>
|
||||||
<link href=knife4j/js/chunk-vendors.e86fea24.js rel=preload as=script>
|
<link href=knife4j/js/chunk-vendors.e86fea24.js rel=preload as=script>
|
||||||
<link href=knife4j/css/app.8f08f96a.css rel=stylesheet>
|
<link href=knife4j/css/app.b932f742.css rel=stylesheet>
|
||||||
%(HeadContent)
|
%(HeadContent)
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript><strong>We're sorry but knife4j-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div>
|
<noscript><strong>We're sorry but knife4j-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div>
|
||||||
<script src=knife4j/js/chunk-vendors.e86fea24.js></script>
|
<script src=knife4j/js/chunk-vendors.e86fea24.js></script>
|
||||||
<script src=knife4j/js/app.c02977a4.js></script>
|
<script src=knife4j/js/app.920753bc.js></script>
|
||||||
<script>
|
<script>
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
src/IGeekFan.AspNetCore.Knife4jUI/knife4j/js/app.920753bc.js.gz
Normal file
BIN
src/IGeekFan.AspNetCore.Knife4jUI/knife4j/js/app.920753bc.js.gz
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,21 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:53224"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"launchUrl": "",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Basic": {
|
"Basic": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
|
@ -50,9 +50,9 @@ namespace Basic
|
|||||||
|
|
||||||
c.GeneratePolymorphicSchemas();
|
c.GeneratePolymorphicSchemas();
|
||||||
|
|
||||||
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "Basic.xml"));
|
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "Basic.xml"),true);
|
||||||
|
|
||||||
c.EnableAnnotations();
|
//c.EnableAnnotations();
|
||||||
c.AddServer(new OpenApiServer()
|
c.AddServer(new OpenApiServer()
|
||||||
{
|
{
|
||||||
Url = "",
|
Url = "",
|
||||||
@ -104,7 +104,7 @@ namespace Basic
|
|||||||
|
|
||||||
app.UseKnife4UI(c =>
|
app.UseKnife4UI(c =>
|
||||||
{
|
{
|
||||||
c.RoutePrefix = ""; // serve the UI at root
|
//c.RoutePrefix = ""; // serve the UI at root
|
||||||
c.SwaggerEndpoint("/v1/api-docs", "V1 Docs");
|
c.SwaggerEndpoint("/v1/api-docs", "V1 Docs");
|
||||||
c.SwaggerEndpoint("/gp/api-docs", "되쩌친욥");
|
c.SwaggerEndpoint("/gp/api-docs", "되쩌친욥");
|
||||||
});
|
});
|
||||||
|
@ -7,8 +7,11 @@ using Microsoft.Extensions.Logging;
|
|||||||
|
|
||||||
namespace Knife4jUIDemo.Controllers
|
namespace Knife4jUIDemo.Controllers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 中文这是一个Get请求这是一个Get请求
|
||||||
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("api/WeatherForecast")]
|
||||||
public class WeatherForecastController : ControllerBase
|
public class WeatherForecastController : ControllerBase
|
||||||
{
|
{
|
||||||
private static readonly string[] Summaries = new[]
|
private static readonly string[] Summaries = new[]
|
||||||
@ -23,6 +26,10 @@ namespace Knife4jUIDemo.Controllers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 这是一个Get请求
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<WeatherForecast> Get()
|
public IEnumerable<WeatherForecast> Get()
|
||||||
{
|
{
|
||||||
|
@ -1,19 +1,29 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<UserSecretsId>cb2091c6-d10b-4c1a-89c7-c72588c6ffe0</UserSecretsId>
|
<UserSecretsId>cb2091c6-d10b-4c1a-89c7-c72588c6ffe0</UserSecretsId>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" Version="0.0.1" />
|
<DocumentationFile>Knife4jUIDemo.xml</DocumentationFile>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
</PropertyGroup>
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\IGeekFan.AspNetCore.Knife4jUI\IGeekFan.AspNetCore.Knife4jUI.csproj" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\IGeekFan.AspNetCore.Knife4jUI\IGeekFan.AspNetCore.Knife4jUI.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Knife4jUIDemo.xml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
19
test/Knife4jUIDemo/Knife4jUIDemo.xml
Normal file
19
test/Knife4jUIDemo/Knife4jUIDemo.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<doc>
|
||||||
|
<assembly>
|
||||||
|
<name>Knife4jUIDemo</name>
|
||||||
|
</assembly>
|
||||||
|
<members>
|
||||||
|
<member name="T:Knife4jUIDemo.Controllers.WeatherForecastController">
|
||||||
|
<summary>
|
||||||
|
中文这是一个Get请求这是一个Get请求
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Knife4jUIDemo.Controllers.WeatherForecastController.Get">
|
||||||
|
<summary>
|
||||||
|
这是一个Get请求
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
|
</doc>
|
@ -8,7 +8,7 @@
|
|||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
"applicationUrl": "http://localhost:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ using Microsoft.Extensions.Configuration;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Knife4jUIDemo
|
namespace Knife4jUIDemo
|
||||||
{
|
{
|
||||||
@ -35,6 +36,9 @@ namespace Knife4jUIDemo
|
|||||||
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
|
||||||
return controllerAction.ControllerName + "-" + controllerAction.ActionName;
|
return controllerAction.ControllerName + "-" + controllerAction.ActionName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var filePath = Path.Combine(System.AppContext.BaseDirectory, "Knife4jUIDemo.xml");
|
||||||
|
c.IncludeXmlComments(filePath, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +58,11 @@ namespace Knife4jUIDemo
|
|||||||
|
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
|
||||||
|
app.UseSwaggerUI(c =>
|
||||||
|
{
|
||||||
|
c.SwaggerEndpoint("/v1/api-docs", "LinCms");
|
||||||
|
});
|
||||||
|
|
||||||
app.UseKnife4UI(c =>
|
app.UseKnife4UI(c =>
|
||||||
{
|
{
|
||||||
c.RoutePrefix = ""; // serve the UI at root
|
c.RoutePrefix = ""; // serve the UI at root
|
||||||
|
Loading…
x
Reference in New Issue
Block a user