From 918c0cc41fd46f17fd177680d935542ba3d390bd Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Mon, 24 Jan 2022 00:40:46 +0100 Subject: [PATCH] fix validation for integrations + derived types --- zero.Core/Configuration/Integrations/IntegrationStore.cs | 4 ++-- zero.Core/Validation/ZeroMergedValidator.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zero.Core/Configuration/Integrations/IntegrationStore.cs b/zero.Core/Configuration/Integrations/IntegrationStore.cs index 68009cc2..2a73b9ed 100644 --- a/zero.Core/Configuration/Integrations/IntegrationStore.cs +++ b/zero.Core/Configuration/Integrations/IntegrationStore.cs @@ -137,9 +137,9 @@ public class IntegrationStore : IIntegrationStore result.Errors.Add(new ValidationFailure("__nofield", "@integration.errors.alreadycreated")); } - if (type != null && type.Validator != null) + if (type != null) { - ValidationResult innerResult = await type.Validator.ValidateAsync(new ValidationContext(model)); + ValidationResult innerResult = await Operations.Validate(model); result.Errors.AddRange(innerResult.Errors); } } diff --git a/zero.Core/Validation/ZeroMergedValidator.cs b/zero.Core/Validation/ZeroMergedValidator.cs index 5d3a5ac6..a33e5fe0 100644 --- a/zero.Core/Validation/ZeroMergedValidator.cs +++ b/zero.Core/Validation/ZeroMergedValidator.cs @@ -35,7 +35,7 @@ public class ZeroMergedValidator : IZeroMergedValidator /// public IEnumerable> ResolveFor(T model) { - Type type = typeof(T); + Type type = model.GetType(); if (!TypeCache.TryGetValue(type, out IEnumerable> validators)) {