Skip to content

Commit

Permalink
Исправляет snake_case в enum (#1590)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmem authored Sep 13, 2023
1 parent 2d08df5 commit 0c98bd2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion VkNet/Utils/JsonConverter/TolerantStringEnumConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ namespace VkNet.Utils.JsonConverter;
/// <inheritdoc />
public class TolerantStringEnumConverter : StringEnumConverter
{
/// <inheritdoc />
public TolerantStringEnumConverter()
{
NamingStrategy = new SnakeCaseNamingStrategy();
}

/// <inheritdoc />
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
try
{
NamingStrategy = new SnakeCaseNamingStrategy();
return base.ReadJson(reader, objectType, existingValue, serializer);
}
catch(System.Exception e)
Expand Down

0 comments on commit 0c98bd2

Please sign in to comment.