update 控制器上注释展示

This commit is contained in:
luoyunchong 2020-08-13 00:14:20 +08:00
parent d108d99e32
commit 5ea5c57450
16 changed files with 73 additions and 43 deletions

View File

@ -11,12 +11,13 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/luoyunchong/IGeekFan.AspNetCore.Knife4jUI.git</RepositoryUrl>
<RootNamespace>IGeekFan.AspNetCore.Knife4jUI</RootNamespace>
<Version>0.0.2</Version>
<Version>0.0.3</Version>
<Company />
<Authors>igeekfan;xiaoym;</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Copyright>Apache License 2.0</Copyright>
<PackageLicenseExpression></PackageLicenseExpression>
<AssemblyVersion>0.0.3.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">

View File

@ -6,19 +6,19 @@
<meta name=viewport content="width=device-width,initial-scale=1">
<link rel=icon href=favicon.ico>
<title>%(DocumentTitle)</title>
<link href=knife4j/css/app.8f08f96a.css rel=preload as= style>
<link href=knife4j/js/app.c02977a4.js rel=preload as=script>
<link href=knife4j/css/app.b932f742.css rel=preload>
<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/css/app.8f08f96a.css rel=stylesheet>
<link href=knife4j/css/app.b932f742.css rel=stylesheet>
%(HeadContent)
</head>
<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>
<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>
window.onload = function () {
}
</script>
</body>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,21 +1,5 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53224"
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Basic": {
"commandName": "Project",
"launchBrowser": true,

View File

@ -50,9 +50,9 @@ namespace Basic
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()
{
Url = "",
@ -104,7 +104,7 @@ namespace Basic
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("/gp/api-docs", "되쩌친욥");
});

View File

@ -7,8 +7,11 @@ using Microsoft.Extensions.Logging;
namespace Knife4jUIDemo.Controllers
{
/// <summary>
/// 中文这是一个Get请求这是一个Get请求
/// </summary>
[ApiController]
[Route("[controller]")]
[Route("api/WeatherForecast")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
@ -23,6 +26,10 @@ namespace Knife4jUIDemo.Controllers
_logger = logger;
}
/// <summary>
/// 这是一个Get请求
/// </summary>
/// <returns></returns>
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{

View File

@ -1,19 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>cb2091c6-d10b-4c1a-89c7-c72588c6ffe0</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>cb2091c6-d10b-4c1a-89c7-c72588c6ffe0</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" Version="0.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>Knife4jUIDemo.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\IGeekFan.AspNetCore.Knife4jUI\IGeekFan.AspNetCore.Knife4jUI.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" />
<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>

View 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>

View File

@ -8,7 +8,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
"applicationUrl": "http://localhost:5000"
}
}
}

View File

@ -6,6 +6,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using System.IO;
namespace Knife4jUIDemo
{
@ -35,6 +36,9 @@ namespace Knife4jUIDemo
var controllerAction = apiDesc.ActionDescriptor as ControllerActionDescriptor;
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.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/v1/api-docs", "LinCms");
});
app.UseKnife4UI(c =>
{
c.RoutePrefix = ""; // serve the UI at root