PluralKit/Myriad/Serialization/JsonSnakeCaseStringEnumConverter.cs

17 lines
571 B
C#
Raw Normal View History

2021-08-27 15:03:47 +00:00
using System;
2021-03-18 10:34:35 +00:00
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Myriad.Serialization
{
public class JsonSnakeCaseStringEnumConverter: JsonConverterFactory
{
private readonly JsonStringEnumConverter _inner = new(new JsonSnakeCaseNamingPolicy());
public override bool CanConvert(Type typeToConvert) =>
_inner.CanConvert(typeToConvert);
public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) =>
_inner.CreateConverter(typeToConvert, options);
}
}