Skip to content

Commit 1c08b7e

Browse files
committed
chore: clarify validator parameter
1 parent 17ccd5e commit 1c08b7e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/Dotnet.Samples.AspNetCore.WebApi/Validators/PlayerRequestModelValidator.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,30 @@
44

55
namespace Dotnet.Samples.AspNetCore.WebApi.Validators;
66

7+
/// <summary>
8+
/// Validator for PlayerRequestModel.
9+
/// This class uses FluentValidation to define validation rules for the
10+
/// PlayerRequestModel.
11+
/// </summary>
12+
/// <remarks>
13+
/// This class is part of the FluentValidation library, which provides a fluent
14+
/// interface for building validation rules.
15+
/// </remarks>
716
public class PlayerRequestModelValidator : AbstractValidator<PlayerRequestModel>
817
{
918
public PlayerRequestModelValidator()
1019
{
11-
RuleFor(x => x.FirstName).NotEmpty().WithMessage("FirstName is required.");
20+
RuleFor(player => player.FirstName).NotEmpty().WithMessage("FirstName is required.");
1221

13-
RuleFor(x => x.LastName).NotEmpty().WithMessage("LastName is required.");
22+
RuleFor(player => player.LastName).NotEmpty().WithMessage("LastName is required.");
1423

15-
RuleFor(x => x.SquadNumber)
24+
RuleFor(player => player.SquadNumber)
1625
.NotEmpty()
1726
.WithMessage("SquadNumber is required.")
1827
.GreaterThan(0)
1928
.WithMessage("SquadNumber must be greater than 0.");
2029

21-
RuleFor(x => x.AbbrPosition)
30+
RuleFor(player => player.AbbrPosition)
2231
.NotEmpty()
2332
.WithMessage("AbbrPosition is required.")
2433
.Must(Position.IsValidAbbr)

0 commit comments

Comments
 (0)