-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[PM-15621] Add support for handling multiple CommandResult validators. #5475
base: main
Are you sure you want to change the base?
Conversation
|
New Issues (2)Checkmarx found the following issues in this Pull Request
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5475 +/- ##
==========================================
+ Coverage 44.48% 44.50% +0.01%
==========================================
Files 1533 1534 +1
Lines 71073 71093 +20
Branches 6379 6383 +4
==========================================
+ Hits 31619 31639 +20
Misses 38087 38087
Partials 1367 1367 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, just some minor feedback.
|
||
public static class CommandResultValidator | ||
{ | ||
public static CommandResult ExecuteValidators(Func<CommandResult>[] validators) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Run synchronous validators, then run async validators" is probably going to be a pretty common pattern. I suggest a combined interface, like ExecuteValidatorsAsync(Func<CommandResult>[], Func<Task<CommandResult>>[])
which can just handle it all for you. That itself would be asynchronous but doesn't matter as long as it's guaranteed to run synchronous validators first.
|
||
namespace Bit.Core.Validators; | ||
|
||
public static class CommandResultValidator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you two have discussed this so I may be out of the loop, but CommandResultValidator
is an odd name to me. You're validating the inputs of the command, not the result. CommandRequestValidator
, or just CommandValidator
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jimmy and I talked about this and we are POC'ing some stuff now about this.
Mostly around the difference between Commands and Validators. There are a few more POC PRs we're putting together to try to get some common types out for everyone to look at.
Reworking somethings. Don't want it to accidentally get merged without others evaluating it.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-15621
📔 Objective
Testing
This code is not wired up, but we have good test coverage for it.
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes