mirror of
https://github.com/anjoy8/Blog.Core.git
synced 2024-09-20 23:48:27 +08:00
Merge pull request #254 from gkLeo/EnableDescriptionOfEnumForSwagger
Enable description of enum in swagger
This commit is contained in:
commit
46e7967d8c
|
@ -18,6 +18,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Reflection;
|
||||
|
@ -126,6 +127,8 @@ namespace Blog.Core
|
|||
//options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
|
||||
//设置本地时间而非UTC时间
|
||||
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local;
|
||||
//添加Enum转string
|
||||
options.SerializerSettings.Converters.Add(new StringEnumConverter());
|
||||
});
|
||||
|
||||
services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>());
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<PackageReference Include="nacos-sdk-csharp-unofficial.Extensions.Configuration" Version="0.8.5" />
|
||||
<PackageReference Include="nacos-sdk-csharp-unofficial.IniParser" Version="0.8.5" />
|
||||
<PackageReference Include="nacos-sdk-csharp.AspNetCore" Version="1.1.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.6.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Blog.Core.Extensions
|
|||
c.OrderActionsBy(o => o.RelativePath);
|
||||
});
|
||||
|
||||
|
||||
c.UseInlineDefinitionsForEnums();
|
||||
try
|
||||
{
|
||||
//这个就是刚刚配置的xml文件名
|
||||
|
@ -106,6 +106,7 @@ namespace Blog.Core.Extensions
|
|||
|
||||
|
||||
});
|
||||
services.AddSwaggerGenNewtonsoftSupport();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user