mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-27 01:57:21 +00:00
fixed validation spelling
This commit is contained in:
parent
66ce8e8b27
commit
e4c8255d69
2 changed files with 6 additions and 4 deletions
|
@ -28,7 +28,7 @@ public IndexerModule(IIndexerService indexerService)
|
|||
SharedValidator.RuleFor(c => c.Name).NotEmpty();
|
||||
SharedValidator.RuleFor(c => c.Implementation).NotEmpty();
|
||||
|
||||
SharedValidator.RuleForField<string>(c => c.Fields, "Url").NotEmpty();
|
||||
SharedValidator.RuleForField<string>(c=>c.Fields,"Url").NotEmpty();
|
||||
|
||||
PostValidator.RuleFor(c => c.Fields).NotEmpty();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
using System.Linq.Expressions;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Internal;
|
||||
using FluentValidation.Resources;
|
||||
using NzbDrone.Api.ClientSchema;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -10,10 +11,11 @@ namespace NzbDrone.Api.REST
|
|||
{
|
||||
public class ResourceValidator<TResource> : AbstractValidator<TResource>
|
||||
{
|
||||
public IRuleBuilderInitial<TResource, TProperty> RuleForField<TProperty>(Expression<Func<TResource, IEnumerable<Field>>> fieldListAccessor, string filedName)
|
||||
public IRuleBuilderInitial<TResource, TProperty> RuleForField<TProperty>(Expression<Func<TResource, IEnumerable<Field>>> fieldListAccessor, string fieldName)
|
||||
{
|
||||
var rule = new PropertyRule(fieldListAccessor.GetMember(), c => GetValue(c, fieldListAccessor.Compile(), filedName), null, () => { return CascadeMode.Continue; }, typeof(TProperty), typeof(TResource));
|
||||
rule.PropertyName += "." + filedName;
|
||||
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);
|
||||
|
||||
AddRule(rule);
|
||||
return new RuleBuilder<TResource, TProperty>(rule);
|
||||
|
|
Loading…
Reference in a new issue