From 4a37e781ea5a65a9d95085243680f7dcafeb8411 Mon Sep 17 00:00:00 2001 From: Oleg Zhuk Date: Tue, 22 Nov 2022 16:48:04 +0200 Subject: [PATCH] Address Email can be null or empty or valid address. (#39) --- .../Validators/AddressValidator.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/AddressValidator.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/AddressValidator.cs index 66224fe0..d803e2fd 100644 --- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/AddressValidator.cs +++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/AddressValidator.cs @@ -9,9 +9,7 @@ public class AddressValidator : AbstractValidator
public AddressValidator() { RuleFor(x => x.Email) - .NotNull() - .NotEmpty() - .Must(x => x.IsValidEmail()) + .Must(x => string.IsNullOrEmpty(x) || x.IsValidEmail()) .WithMessage("Invalid email format an the address"); } }