From 3ec3e0c1913bc902dbbcaeae2959897df6212ec2 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期四, 28 十一月 2024 15:41:23 +0800
Subject: [PATCH] 更新
---
WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SwaggerSetup.cs | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SwaggerSetup.cs b/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SwaggerSetup.cs
index 54f61d9..2e5a1ce 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SwaggerSetup.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/SwaggerSetup.cs
@@ -30,34 +30,33 @@
if (services == null) throw new ArgumentNullException(nameof(services));
var basePath = AppContext.BaseDirectory;
- //var basePath2 = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath;
- var ApiName = AppSettings.app(new string[] { "ApiName" });
+ var ApiName = AppSettings.Get(new string[] { "ApiName" });
services.AddSwaggerGen(c =>
{
//閬嶅巻鍑哄叏閮ㄧ殑鐗堟湰锛屽仛鏂囨。淇℃伅灞曠ず
- typeof(ApiVersions).GetEnumNames().ToList().ForEach(version =>
+ //typeof(ApiVersions).GetEnumNames().ToList().ForEach(version =>
+ //{
+ c.SwaggerDoc("v1", new OpenApiInfo
{
- c.SwaggerDoc(version, new OpenApiInfo
- {
- Version = version,
- Title = $"{ApiName} 鎺ュ彛鏂囨。鈥斺�攞RuntimeInformation.FrameworkDescription}",
- Description = $"{ApiName} HTTP API " + version,
- });
- c.OrderActionsBy(o => o.RelativePath);
+ Version = "v1",
+ Title = $"{ApiName} 鎺ュ彛鏂囨。鈥斺�攞RuntimeInformation.FrameworkDescription}",
+ Description = $"{ApiName} HTTP API " + "v1"
});
+ c.OrderActionsBy(o => o.RelativePath);
+ //});
c.UseInlineDefinitionsForEnums();
try
{
//杩欎釜灏辨槸鍒氬垰閰嶇疆鐨剎ml鏂囦欢鍚�
- //var xmlPath = Path.Combine(basePath, "WIDESEAWCS_Server.xml");
+ var xmlPath = Path.Combine(basePath, "WIDESEAWCS_Server.xml");
//榛樿鐨勭浜屼釜鍙傛暟鏄痜alse锛岃繖涓槸controller鐨勬敞閲婏紝璁板緱淇敼
- //c.IncludeXmlComments(xmlPath, true);
+ c.IncludeXmlComments(xmlPath, true);
//杩欎釜灏辨槸Model灞傜殑xml鏂囦欢鍚�
- //var xmlModelPath = Path.Combine(basePath, "WIDESEAWCS_Server.Model.xml");
- //c.IncludeXmlComments(xmlModelPath);
+ var xmlModelPath = Path.Combine(basePath, "WIDESEAWCS_Server.Model.xml");
+ c.IncludeXmlComments(xmlModelPath);
}
catch (Exception ex)
{
@@ -121,11 +120,7 @@
/// <summary>
/// V1 鐗堟湰
/// </summary>
- V1 = 1,
- /// <summary>
- /// V2 鐗堟湰
- /// </summary>
- V2 = 2,
+ V1 = 1
}
}
}
--
Gitblit v1.9.3