question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WithSeverity doesn't work

See original GitHub issue

FluentValidation Version: 8.6.2 .NET Core 3.1

I have this kind of validator:

public class StatRequestValidator : AbstractValidator<StatRequest>
    {
        public StatRequestValidator()
        {
            RuleFor(req => req.FromDate)
                .NotEmpty()
                .WithSeverity(Severity.Info);

            RuleFor(req => req.ToDate)
                .NotEmpty()
                .WithSeverity(Severity.Info);
        }
    }
Injecting in StartUp: .AddTransient<IValidator<StatRequest>, StatRequest>()
Calling like this:  var result = _requestValidator.Validate(requestModel);

The ValidationResult (result) has two errors, like: “FromDate should not be empty” and “FromDate should not be empty”.

If I correctly understand the main purpose of WithSeverity, ValidationResult should not have any errors and should not throw an exception if I call ValidateAndThrow.

Please, Could you check it? If I’m right let me know if no, correct me.

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AndrewGumenyukcommented, Jun 9, 2020

Wow, awesome. 5 minutes ago) image

0reactions
AndrewGumenyukcommented, Jun 9, 2020

So, the issue was helpful - it’s good)

Thanks, I’ve already read in PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting severity on a analyzer message does nothing #45417
Changing the severity of an analyzer from the editor lightbulb doesn't update the EditorConfig unless the EditorConfig is open #53488.
Read more >
visual studio - When to use `silent` code analysis severity?
I think silent shows up in the editor as the "three dots" or ghosted text, while none doesn't show up. I might recall...
Read more >
Analyzer configuration - Visual Studio (Windows)
Learn how to customize Roslyn analyzer rules. See how to adjust analyzer severities, suppress violations, and designate files as generated ...
Read more >
Xamarin.Android layout analyzer configuration severity ` ...
The problem is that the severity ignore works the same as informational so the warnings are shown as messages in the VS's error...
Read more >
Severity Mapping doesn't work - ArcSight User Discussions
Hello everyone ! I'm quite newby on arcsight products, so maybe i'm doing something wrong, but I can't have the severity mapping working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found