Lowercase CollectionTypeOptions to match legacy experience (#11272)

This commit is contained in:
Cody Robibero
2024-03-31 21:58:06 -06:00
committed by GitHub
parent d9fe900952
commit 3ade3a8e63
6 changed files with 49 additions and 113 deletions

View File

@@ -1,25 +0,0 @@
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Jellyfin.Extensions.Json.Converters
{
/// <summary>
/// Converts an object to a lowercase string.
/// </summary>
/// <typeparam name="T">The object type.</typeparam>
public class JsonLowerCaseConverter<T> : JsonConverter<T>
{
/// <inheritdoc />
public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return JsonSerializer.Deserialize<T>(ref reader, options);
}
/// <inheritdoc />
public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
{
writer.WriteStringValue(value?.ToString()?.ToLowerInvariant());
}
}
}