Skip to content

fea :Add FluentValidation - #3

Open
Abdalrahman-M05 wants to merge 2 commits into
feature/error-handlingfrom
feature/fluent-validation
Open

fea :Add FluentValidation#3
Abdalrahman-M05 wants to merge 2 commits into
feature/error-handlingfrom
feature/fluent-validation

Conversation

@Abdalrahman-M05

Copy link
Copy Markdown
Collaborator

No description provided.



// Add FluentValidation services
builder.Services.AddFluentValidationAutoValidation();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement auto validation will affect old versions of your api

Comment on lines +16 to +18
RuleFor(request => request.Separator)
.Must(separator => separator == '-' || separator == '_')
.WithMessage("Separator must be either '-' or '_'.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the separator is null

Comment on lines +13 to +14
.MaximumLength(500)
.WithMessage("Text must not exceed 500 characters.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the text is null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants