Whilst standard FluentValidate rules work, when we apply restrictions with rulesets, the latest versions of ServiceStack and FluentValidate get in conflict, this code does not compile because ApplyTo.Put does not match with the expected parameter type, which is the “string”:
using Customers.ServiceModels;
using FluentValidation;
using ServiceStack;
namespace Customers.Validators
{
public class CustomerValidator: AbstractValidator<CustomerRequest>
{
public CustomerValidator()
{
RuleSet(ApplyTo.Put, () =>
{
RuleFor(x => x.Id).NotEmpty();
});
RuleFor(x => x.Name).NotEmpty();
}
}
}