diff --git a/IRaCIS.Core.API/_ServiceExtensions/SwaggerSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/SwaggerSetup.cs index 7ef4bce72..1632056c7 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/SwaggerSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/SwaggerSetup.cs @@ -74,6 +74,15 @@ public static class SwaggerSetup return versions.Any(v => v.ToString() == docName); }); + + //添加注释 + var basePath = AppContext.BaseDirectory; + var xmlPath1 = Path.Combine(basePath, "IRaCIS.Core.Application.xml"); + var xmlPath2 = Path.Combine(basePath, "IRaCIS.Core.API.xml"); + options.IncludeXmlComments(xmlPath1, true); + options.IncludeXmlComments(xmlPath2, true); + + // 在header中添加token,传递到后台 options.OperationFilter<SecurityRequirementsOperationFilter>(); @@ -87,17 +96,6 @@ public static class SwaggerSetup //Type = "apiKey" }); - //添加注释 - var basePath = AppContext.BaseDirectory; - var xmlPath1 = Path.Combine(basePath, "IRaCIS.Core.Application.xml"); - var xmlPath2 = Path.Combine(basePath, "IRaCIS.Core.API.xml"); - options.IncludeXmlComments(xmlPath1, true); - options.IncludeXmlComments(xmlPath2, true); - - // 在header中添加token,传递到后台 - options.OperationFilter<SecurityRequirementsOperationFilter>(); - - //// 添加登录按钮 //options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme() //{ @@ -140,19 +138,7 @@ public static class SwaggerSetup return versions.Any(v => v.ToString() == docName); }); - options.OperationFilter<SecurityRequirementsOperationFilter>(); - - - // 添加登录按钮 - options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme() - { - Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", - Name = "Authorization", - - //In = "header", - //Type = "apiKey" - }); - + //添加注释 var basePath = AppContext.BaseDirectory; var xmlPath1 = Path.Combine(basePath, "IRaCIS.Core.Application.xml"); @@ -164,15 +150,15 @@ public static class SwaggerSetup options.OperationFilter<SecurityRequirementsOperationFilter>(); - //// 添加登录按钮 - //options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme() - //{ - // Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", - // Name = "Authorization", + // 添加登录按钮 + options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme() + { + Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", + Name = "Authorization", + //In = "header", + //Type = "apiKey" + }); - // //In = "header", - // //Type = "apiKey" - //}); }); }