|
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
using FluentValidation;
|
|
|
|
|
using FluentValidation.Internal;
|
|
|
|
|
using FluentValidation.Resources;
|
|
|
|
|
using Prowlarr.Http.ClientSchema;
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
rule.PropertyName = fieldName;
|
|
|
|
|
rule.DisplayName = new StaticStringSource(fieldName);
|
|
|
|
|
rule.SetDisplayName(fieldName);
|
|
|
|
|
|
|
|
|
|
AddRule(rule);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
if (resource == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resource.Value;
|
|
|
|
|
return resource?.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|