using FluentValidation; namespace GroupService.WebApi.Controllers.GroupRequest { public class GroupRequestRequest { public Guid GroupId { get; set; } public string? Desc { get; set; } } public class GroupRequestRequestValidator : AbstractValidator { public GroupRequestRequestValidator() { RuleFor(r => r.GroupId) .NotEmpty() .NotNull(); RuleFor(r => r.Desc) .MaximumLength(20) .WithMessage("入群描述不可超过20字符") ; } } }