2021-08-27 15:03:47 +00:00
|
|
|
using System.Text.Json;
|
2020-12-22 12:15:26 +00:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
namespace Myriad.Serialization
|
|
|
|
{
|
|
|
|
public static class JsonSerializerOptionsExtensions
|
|
|
|
{
|
2021-01-30 00:07:43 +00:00
|
|
|
public static JsonSerializerOptions ConfigureForMyriad(this JsonSerializerOptions opts)
|
2020-12-22 12:15:26 +00:00
|
|
|
{
|
|
|
|
opts.PropertyNamingPolicy = new JsonSnakeCaseNamingPolicy();
|
|
|
|
opts.NumberHandling = JsonNumberHandling.AllowReadingFromString;
|
|
|
|
opts.IncludeFields = true;
|
|
|
|
|
|
|
|
opts.Converters.Add(new PermissionSetJsonConverter());
|
|
|
|
opts.Converters.Add(new ShardInfoJsonConverter());
|
2020-12-25 12:58:45 +00:00
|
|
|
opts.Converters.Add(new OptionalConverterFactory());
|
2020-12-22 12:15:26 +00:00
|
|
|
|
|
|
|
return opts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|