Добавлен парсинг EnumMember
All checks were successful
Release / pack-and-publish (release) Successful in 32s

This commit is contained in:
FrigaT
2026-04-23 17:16:18 +03:00
parent 815283a776
commit 8c5dca1491
2 changed files with 52 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using YandexMusic.API.Extensions;
using YandexMusic.API.Models.Landing.Entity.Entities;
namespace YandexMusic.API.Models.Landing.Entity;
@@ -26,7 +27,8 @@ public class YLandingEntityConverter : JsonConverter<List<YLandingEntity>>
var typeProp = root.GetProperty("type");
var typeStr = typeProp.GetString();
if (!Enum.TryParse<YLandingEntityType>(typeStr, true, out var entityType))
if (!EnumHelper.TryEnumFromMemberValue<YLandingEntityType>(typeStr, true, out var entityType))
throw new JsonException($"Неизвестный тип сущности: {typeStr}");
YLandingEntity? entity = null;