diff --git a/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs b/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
index 79ba0c41..03516ab0 100644
--- a/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
+++ b/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
@@ -17,11 +17,13 @@
// along with Kyoo. If not, see .
using System;
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
+using Kyoo.Abstractions.Models.Attributes;
using Sprache;
namespace Kyoo.Abstractions.Models.Utils;
@@ -115,9 +117,12 @@ public abstract record Filter : Filter
return property.Then(prop =>
{
- PropertyInfo? propInfo = typeof(T).GetProperty(prop, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
+ Type[] types = typeof(T).GetCustomAttribute()?.Types ?? new[] { typeof(T) };
+ PropertyInfo? propInfo = types
+ .Select(x => x.GetProperty(prop, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance))
+ .FirstOrDefault();
if (propInfo == null)
- throw new ValidationException($"The given filter {property} is invalid.");
+ throw new ValidationException($"The given filter '{prop}' is invalid.");
Parser