Fixing the json serializer

This commit is contained in:
Zoe Roux
2021-02-28 05:15:44 +01:00
parent faf453e64a
commit 7e8ab3b173
3 changed files with 10 additions and 10 deletions
+6 -8
View File
@@ -11,14 +11,12 @@ namespace Kyoo.Controllers
{
JsonProperty property = base.CreateProperty(member, memberSerialization);
// TODO this get called only once and get cached.
// if (member?.GetCustomAttributes<LoadableRelationAttribute>() != null)
// property.NullValueHandling = NullValueHandling.Ignore;
// if (member?.GetCustomAttributes<SerializeIgnoreAttribute>() != null)
// property.ShouldSerialize = _ => false;
// if (member?.GetCustomAttributes<DeserializeIgnoreAttribute>() != null)
// property.ShouldDeserialize = _ => false;
if (member?.GetCustomAttribute<LoadableRelationAttribute>() != null)
property.NullValueHandling = NullValueHandling.Ignore;
if (member?.GetCustomAttribute<SerializeIgnoreAttribute>() != null)
property.ShouldSerialize = _ => false;
if (member?.GetCustomAttribute<DeserializeIgnoreAttribute>() != null)
property.ShouldDeserialize = _ => false;
return property;
}
}
+2 -1
View File
@@ -24,7 +24,7 @@ namespace Kyoo.CommonApi
where.Remove(key);
}
string[] fields = context.HttpContext.Request.Query["fields"].ToArray();
string[] fields = string.Join(',', context.HttpContext.Request.Query["fields"]).Split(',');
context.HttpContext.Items["fields"] = fields;
if (context.ActionDescriptor is ControllerActionDescriptor descriptor)
@@ -68,6 +68,7 @@ namespace Kyoo.CommonApi
Type pageType = Utility.GetGenericDefinition(result.DeclaredType, typeof(Page<>));
// TODO loading is case sensitive. Maybe convert them in the first check.
if (pageType != null)
{
foreach (IResource resource in ((dynamic)result.Value).Items)