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

IValidator<T> and ValidationResult<T> #5483

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jrmccannon
Copy link
Contributor

📔 Objective

This is a POC of how IValidator<T> can be used to produce a ValidationResult<T>.

The idea behind IValidator<T> is to be used within a command to validate the request against the

Valid<T> will be an object that has been run through the normal business logic to ensure the action can be performed.

Invalid<T> should be used to pass any Error<T> back to the command. Here it can be programmatically dealt with and potentially passed back onto the client.

IValidtor<T> should only be "validation" logic with no side effects. Logging could potentially done, but it might be best to just allow the command to decide what to do with the error.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

Copy link

codecov bot commented Mar 10, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 44.37%. Comparing base (6e7c5b1) to head (551d953).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...AdminConsole/Shared/Validation/ValidationResult.cs 40.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5483   +/-   ##
=======================================
  Coverage   44.36%   44.37%           
=======================================
  Files        1535     1536    +1     
  Lines       70586    70618   +32     
  Branches     6315     6316    +1     
=======================================
+ Hits        31318    31338   +20     
- Misses      37924    37935   +11     
- Partials     1344     1345    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Logo
Checkmarx One – Scan Summary & Details785aa05b-190e-4d14-9dc4-28bfd43878f2

New Issues (3)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationDomainController.cs: 94
detailsMethod Verify at line 94 of /src/Api/AdminConsole/Controllers/OrganizationDomainController.cs gets a parameter from a user request from orgId. This...
Attack Vector
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationDomainController.cs: 94
detailsMethod Verify at line 94 of /src/Api/AdminConsole/Controllers/OrganizationDomainController.cs gets a parameter from a user request from id. This pa...
Attack Vector
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 143
detailsMethod Post at line 143 of /src/Api/Controllers/CollectionsController.cs gets a parameter from a user request from model. This parameter value flow...
Attack Vector
Fixed Issues (1)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Billing/Controllers/AccountsController.cs: 142

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.

1 participant