Quickstart
Get started with using Waystone.Monads.FluentValidation in under a minute.
2
Last updated
Was this helpful?
Get started with using Waystone.Monads.FluentValidation in under a minute.
See Fluent Validation: Creating your first validator for more detailed information
record UserInput(int Range, string Search);
class UserInputValidator : AbstractValidator<UserInput>
{
public UserInputValidator()
{
RuleFor(x => x.Range).GreaterThan(0);
RuleFor(x => x.Search).NotEmpty();
}
}UserInput input = new(1, "bob");
UserInputValidator validator = new();
Result<UserInput, ValidationErr> result = input.Validate(validator);
// or
Result<UserInput, ValidationErr> result = await input.ValidateAsync(validator, cancellationToken);See Waystone.Monads to learn how to work with a Result
Last updated
Was this helpful?
Was this helpful?