Skip to main content

Changelog

Version history for every package in the Vali-Validation ecosystem, compiled from each package's PackageReleaseNotes.


Vali-Validation (core)​

3.0.0 — BREAKING CHANGE: Severity-aware validation results​

ValidationResult now tracks failures with a severity (Error/Warning/Info) instead of a flat pass/fail per property. The new ValidationResult.Failures (List<ValidationFailure>) is the source of truth; Errors/ErrorCodes/ErrorsFor/HasErrorFor/FirstError/ToFlatList/ErrorCount/PropertyNames all still work exactly as before, but now only reflect Severity.Error failures — a rule marked .WithSeverity(Severity.Warning) never appears in them and never makes IsValid false.

Migration:

  • No code changes required if you only ever used the old Errors/ErrorCodes/ErrorsFor/HasErrorFor/IsValid surface and never need Warning/Info severities — behavior is identical for validators that never call .WithSeverity().
  • If you directly mutated result.Errors/result.ErrorCodes or assigned them to a variable typed as Dictionary<string, List<string>>, that will now fail to compile — both are now IReadOnlyDictionary<string, List<string>>. Read-only usage (indexer reads, iteration, ContainsKey) is unaffected.
  • To read the new severity-aware data: use result.Failures directly, or result.Failures.Where(f => f.PropertyName == "Email").Select(f => f.Message) instead of result.Errors["Email"].
  • New fluent modifier: .WithSeverity(Severity.Warning) on any property rule (same placement rules as WithMessage/WithErrorCode — only affects the last rule in the chain, and only rules added via the standard property-rule chain, not RequiredIf/EqualToProperty and other cross-property rules).
  • ValidationResult now serializes (System.Text.Json, default options) as a single structured array: { "isValid": bool, "failures": [{ "property", "message", "severity", "errorCode"? }] } — see Severity for the full example.

New features:

  • Severity enum (Error/Warning/Info) in Vali_Validation.Core.Results.
  • ValidationResult.Failures — single structured list, replaces the implicit two-collection (Errors/ErrorCodes) model as the source of truth.
  • ValidationResult.AddFailure(property, message, severity, errorCode) — general-purpose failure-adding method; AddError is now a Severity.Error-only shorthand for it.
  • IRuleBuilder<T,TProperty>.WithSeverity(Severity) — mark a rule as non-blocking. See Severity.
  • CustomValidationContext<T>.AddFailure(..., Severity, ...) overloads — Custom() rules can now raise warnings too.

Rule Sets (new, non-breaking):

  • IRuleBuilder<T,TProperty>.InRuleSet(params string[]) tags a rule; additive across calls. Rules with no InRuleSet call carry the implicit tag "default".
  • Validate(instance, o => o.IncludeRuleSets("name")) / ValidateAsync(...) restrict a single call to rules tagged with any of the named rule sets. Plain Validate(instance)/ValidateAsync(instance) with no options still runs every rule regardless of tag. See Rule Sets.

Block-level When/Unless (new, non-breaking):

  • Protected When(Func<T,bool>, Action)/Unless(Func<T,bool>, Action) on AbstractValidator<T> wrap multiple RuleFor/RuleForEach calls in the constructor under a single shared condition, instead of repeating .When(...)/.Unless(...) on each rule. Nested blocks compose with AND. See Modifiers — Block-Level Conditions.

InjectValidator (new, non-breaking):

  • IRuleBuilder<T,TProperty>.InjectValidator<T,TProperty>(IServiceProvider) resolves a nested IValidator<TProperty> from DI instead of requiring an already-constructed instance, then delegates to SetValidator. Throws InvalidOperationException if no IValidator<TProperty> is registered, or the registered implementation isn't an AbstractValidator<TProperty>. See Dependency Injection.

Localization (new, non-breaking):

  • Built-in rule messages ship in English (default) and Spanish, resolved automatically from CultureInfo.CurrentUICulture. Override per call with Validate(instance, o => o.WithLanguage("es")), or set an app-wide default via ValiValidationOptions.Global.DefaultLanguage.
  • LanguageManager.RegisterLanguage("code", dictionary) adds a new language at startup; partial catalogs are fine — any missing key falls back to English. See Localization.

Global Configuration (new, non-breaking):

  • ValiValidationOptions.Global exposes DefaultCascadeMode, DefaultLanguage, DisplayNameResolver, and PropertyNameResolver as app-wide defaults set once at startup, before any concurrent validation runs. See Global Configuration.

PropertyValidator (new, non-breaking):

  • IPropertyValidator<TProperty> (and the PropertyValidator<TProperty> convenience base) let you implement a custom rule as a reusable, unit-testable class instead of an inline .Must(...) predicate. Attach with RuleFor(x => x.Prop).SetPropertyValidator(new MyValidator()) — integrates with WithSeverity/WithErrorCode/When/Unless/WithMessage like any other rule. See Property Validators.

.NET 10 support:

  • Multi-targeting extended to net7.0;net8.0;net9.0;net10.0.

Fixes:

  • .WithMessage()/.WithErrorCode()/.WithSeverity()/.When()/.Unless() chained after .MustAsync(...)/.DependentRuleAsync(...) now correctly apply to that async rule instead of silently being dropped or reassigned to an earlier synchronous rule.

Vali-Validation.AspNetCore​

1.1.0​

  • Adds net10.0 to the multi-targeted frameworks (now net7.0/net8.0/net9.0/net10.0).
  • Now depends on Vali-Validation 3.0.0+, which brings Severity-aware ValidationResult, Rule Sets, block-level When/Unless, InjectValidator, Localization (English/Spanish built in), ValiValidationOptions.Global, and Property Validators to any validator used through this package's middleware/filter/attribute. No changes to this package's own public API.

1.0.0 — Initial release​

  • ValiValidationMiddleware catches ValidationException, returns RFC 7807 problem+json.
  • ValiValidationFilter<T> (IEndpointFilter) for Minimal API endpoint validation.
  • ValiValidateAttribute (IAsyncActionFilter) for MVC controller action validation.
  • UseValiValidationExceptionHandler() middleware registration.
  • WithValiValidation<T>() fluent extension for Minimal API routes.
  • AddValiValidationProblemDetails() DI helper.

Vali-Validation.MediatR​

1.1.0 — published today, previously 1.0.3​

  • Adds net10.0 to the multi-targeted frameworks (now net7.0/net8.0/net9.0/net10.0).
  • Now depends on Vali-Validation 3.0.0+, which brings Severity-aware ValidationResult, Rule Sets, block-level When/Unless, InjectValidator, Localization (English/Spanish built in), ValiValidationOptions.Global, and Property Validators to any validator run through this pipeline behavior. No changes to this package's own public API.

1.0.0 — Initial release​

  • ValidationBehavior<TRequest, TResponse> implementing MediatR IPipelineBehavior.
  • Validates request via IValidator<TRequest> resolved from DI.
  • Throws ValidationException if validation fails (use Vali-Validation.ValiMediator for Result<T>-based flow).
  • AddMediatRWithValidation() convenience extension for one-call registration.
  • AddValiValidationBehavior() for manual MediatR setup.

Vali-Validation.ValiMediator​

1.1.0​

  • Adds net10.0 to the multi-targeted frameworks (now net7.0/net8.0/net9.0/net10.0).
  • Now depends on Vali-Validation 3.0.0+, which brings Severity-aware ValidationResult, Rule Sets, block-level When/Unless, InjectValidator, Localization (English/Spanish built in), ValiValidationOptions.Global, and Property Validators to any validator run through this pipeline behavior. No changes to this package's own public API.

1.0.0 — Initial release​

  • ValidationBehavior<TRequest, TResponse> implementing Vali-Mediator IPipelineBehavior.
  • Validates request via IValidator<TRequest> resolved from DI.
  • When TResponse is Result<T>: returns Result.Fail(errors, ErrorType.Validation) — no throw.
  • When TResponse is any other type: throws ValidationException.
  • AddValiValidationBehavior() extension on ValiMediatorConfiguration.
  • AddValiMediatorWithValidation() convenience extension on IServiceCollection.

Vali-Validation.TestHelpers​

1.0.0 — Initial release​

  • ShouldHaveValidationErrorFor(string propertyName)
  • ShouldHaveValidationErrorFor(string propertyName, string expectedMessage)
  • ShouldNotHaveValidationErrorFor(string propertyName)