From e4c8255d69005424b58ef2d45c7ba5be241f40f4 Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Wed, 21 Aug 2013 12:08:03 -0700 Subject: [PATCH] fixed validation spelling --- NzbDrone.Api/Indexers/IndexerModule.cs | 2 +- NzbDrone.Api/REST/ResourceValidator.cs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NzbDrone.Api/Indexers/IndexerModule.cs b/NzbDrone.Api/Indexers/IndexerModule.cs index 0b5ffc052..fd19ea4a1 100644 --- a/NzbDrone.Api/Indexers/IndexerModule.cs +++ b/NzbDrone.Api/Indexers/IndexerModule.cs @@ -28,7 +28,7 @@ namespace NzbDrone.Api.Indexers SharedValidator.RuleFor(c => c.Name).NotEmpty(); SharedValidator.RuleFor(c => c.Implementation).NotEmpty(); - SharedValidator.RuleForField(c => c.Fields, "Url").NotEmpty(); + SharedValidator.RuleForField(c=>c.Fields,"Url").NotEmpty(); PostValidator.RuleFor(c => c.Fields).NotEmpty(); } diff --git a/NzbDrone.Api/REST/ResourceValidator.cs b/NzbDrone.Api/REST/ResourceValidator.cs index 556a6034b..a5c0e4268 100644 --- a/NzbDrone.Api/REST/ResourceValidator.cs +++ b/NzbDrone.Api/REST/ResourceValidator.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; 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 : AbstractValidator { - public IRuleBuilderInitial RuleForField(Expression>> fieldListAccessor, string filedName) + public IRuleBuilderInitial RuleForField(Expression>> 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(rule);