|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
using FluentValidation;
|
|
|
|
using FluentValidation;
|
|
|
|
using FluentValidation.Internal;
|
|
|
|
using FluentValidation.Internal;
|
|
|
|
using FluentValidation.Resources;
|
|
|
|
|
|
|
|
using Prowlarr.Http.ClientSchema;
|
|
|
|
using Prowlarr.Http.ClientSchema;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Prowlarr.Http.REST
|
|
|
|
namespace Prowlarr.Http.REST
|
|
|
@ -15,7 +14,7 @@ namespace Prowlarr.Http.REST
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var rule = new PropertyRule(fieldListAccessor.GetMember(), c => GetValue(c, fieldListAccessor.Compile(), fieldName), null, () => CascadeMode.Continue, typeof(TProperty), typeof(TResource));
|
|
|
|
var rule = new PropertyRule(fieldListAccessor.GetMember(), c => GetValue(c, fieldListAccessor.Compile(), fieldName), null, () => CascadeMode.Continue, typeof(TProperty), typeof(TResource));
|
|
|
|
rule.PropertyName = fieldName;
|
|
|
|
rule.PropertyName = fieldName;
|
|
|
|
rule.DisplayName = new StaticStringSource(fieldName);
|
|
|
|
rule.SetDisplayName(fieldName);
|
|
|
|
|
|
|
|
|
|
|
|
AddRule(rule);
|
|
|
|
AddRule(rule);
|
|
|
|
return new RuleBuilder<TResource, TProperty>(rule, this);
|
|
|
|
return new RuleBuilder<TResource, TProperty>(rule, this);
|
|
|
@ -25,12 +24,7 @@ namespace Prowlarr.Http.REST
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var resource = fieldListAccessor((TResource)container).SingleOrDefault(c => c.Name == fieldName);
|
|
|
|
var resource = fieldListAccessor((TResource)container).SingleOrDefault(c => c.Name == fieldName);
|
|
|
|
|
|
|
|
|
|
|
|
if (resource == null)
|
|
|
|
return resource?.Value;
|
|
|
|
{
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resource.Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|