diff --git a/src/Danom.Validation/README.md b/src/Danom.Validation/README.md index 14b0e55..fcba327 100644 --- a/src/Danom.Validation/README.md +++ b/src/Danom.Validation/README.md @@ -27,7 +27,8 @@ using FluentValidation; public record Attendee( string Name, int Age, - Option EmailAddress); + Option Email, + Option AlternateEmail); public class AttendeeValidator : AbstractValidator @@ -36,14 +37,16 @@ public class AttendeeValidator { RuleFor(x => x.Name).NotEmpty(); RuleFor(x => x.Age).GreaterThan(0); - RuleFor(x => x.EmailAddress).WhenSome(x => x.EmailAddress()); + RuleFor(x => x.Email).Required(x => x.EmailAddress()); + RuleFor(x => x.AlternateEmail).Optional(x => x.EmailAddress()); } } var input = new Attendee( Name: "John Doe", Age: 30, - EmailAddress: Option.None()); + Email: Option.Some("john@doe.com"), + AlternateEmail: Option.None()); var result = ValidationResult