Interface IValidatorInvoker

Namespace
Cratis.Arc.Validation
Assembly
Cratis.Arc.Core.dll

Defines a system that runs a validator against an instance and expresses the outcome as framework ValidationResult instances.

public interface IValidatorInvoker
Extension Methods

Remarks

This is the only place that knows the validation library's shape — how a validation context is built, how its severities map, and what happens when a validator throws. Keeping it apart from the traversal means the graph walk deals purely in "what should be validated", and swapping or extending the validation library touches one type.

Methods

Invoke(object, IValidator, string, CancellationToken)

Runs a validator against an instance.

Task<IEnumerable<ValidationResult>> Invoke(object instance, IValidator validator, string path, CancellationToken cancellationToken = default)

Parameters

instance object

The instance to validate.

validator IValidator

The FluentValidation.IValidator to run.

path string

The camelCased member path from the graph root to instance, empty at the root.

cancellationToken CancellationToken

Optional CancellationToken for cancelling the validation.

Returns

Task<IEnumerable<ValidationResult>>

The ValidationResult collection describing the outcome, empty when valid.