Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WithSeverity - support for errors severity level #4

Closed
bartoszlenar opened this issue Jun 11, 2020 · 1 comment
Closed

WithSeverity - support for errors severity level #4

bartoszlenar opened this issue Jun 11, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@bartoszlenar
Copy link
Owner

Feature description

  • Add severity support to error output.
    • I'm not sure if it's needed... Maybe it's bringing to much complexity into something that should be fairly simple.
  • Severities could be replaced with... multiple validators.

Feature in action

Specification<string> specification = s => s
    .NotEmpty().WithSeverity(10)
    .NotWhitespace().WithSeverity(0)
Specification<string> specification = s => s
    .NotEmpty().WithSeverity(Severity.High)
    .NotWhitespace().WithSeverity(Severity.Low)
result.AnyErrorsWithSeverity(Severity.High);

result.AnyErrorsWithSeverity(10);

result.GetMessageMapWithSeverity(Severity.Medium | Severity.High)

Feature details

  • New parameter command: WithSeverity.
  • Would be marking the entire error output with a severity level.
  • Result would have methods to filter out error outputs that have certain level of severity...
@bartoszlenar bartoszlenar added the enhancement New feature or request label Jun 11, 2020
@bartoszlenar bartoszlenar self-assigned this Jun 11, 2020
@bartoszlenar
Copy link
Owner Author

At least for now, I'm closing the issue.

I explained the reason in the original description. Severities feature does bring extra complexity to the mechanism that should be reasonably simple. If one group of errors is more important than the other, some ways effectively will lead to the same effect:

  • For complete separate groups: construct specification and validator for each.
  • For groups with shared points: use error codes. Apply error code to the rules that you consider more important and then, in the result object, check for the error code.

This issue, though, sparked some ideas for the new features:

  • Merging multiple validation results in one. So the separate groups of rules would end up with a single result. Maybe with the option to assign error code to all the errors coming from a certain group.
  • Search for error codes using wildcards.

@bartoszlenar bartoszlenar added the wontfix This will not be worked on label Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant