Skip to content

Commit 8708cc3

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

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,31 @@
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>
16+
/// </summary>
717
public class PlayerRequestModelValidator : AbstractValidator<PlayerRequestModel>
818
{
919
public PlayerRequestModelValidator()
1020
{
11-
RuleFor(x => x.FirstName).NotEmpty().WithMessage("FirstName is required.");
21+
RuleFor(player => player.FirstName).NotEmpty().WithMessage("FirstName is required.");
1222

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

15-
RuleFor(x => x.SquadNumber)
25+
RuleFor(player => player.SquadNumber)
1626
.NotEmpty()
1727
.WithMessage("SquadNumber is required.")
1828
.GreaterThan(0)
1929
.WithMessage("SquadNumber must be greater than 0.");
2030

21-
RuleFor(x => x.AbbrPosition)
31+
RuleFor(player => player.AbbrPosition)
2232
.NotEmpty()
2333
.WithMessage("AbbrPosition is required.")
2434
.Must(Position.IsValidAbbr)

0 commit comments

Comments
 (0)