Problem
FluentValidation supports a Severity property on validation rules (Error, Warning, Info), but Blazilla currently treats all ValidationFailure results as errors — they all go into the ValidationMessageStore, which means:
- Warning-severity rules block form submission (because
EditContext.Validate() checks GetValidationMessages())
- No way to display warnings differently from errors (e.g. amber vs red styling)
- No way to show advisory messages that inform the user without preventing submission
This is a common need in business applications where some fields are "recommended but not required" — for example, showing "Description is recommended" as a warning while still allowing the form to submit.
Proposed Solution
Route non-error severity failures to an EditContext.Properties side-channel instead of the ValidationMessageStore. This is a non-breaking change — existing error behavior is completely untouched.
The core idea:
- In
ApplyValidationResults, check validationFailure.Severity — only add Severity.Error failures to the ValidationMessageStore
- Store warning/info failures in
EditContext.Properties via a small static helper class
- Provide extension methods on
EditContext to retrieve warnings (GetWarnings, GetAllWarnings, HasWarnings)
- Optionally provide a
WarningValidationMessage<TValue> component analogous to ValidationMessage<TValue> that reads from the warnings side-channel
I've successfully implemented this approach in a fork of the Blazored.FluentValidation library (v2.2.0) and have been using it in production. The changes are well-contained and the approach works reliably with both sync and async validation, field-level and model-level validation, and mixed error/warning rule sets.
Happy to submit a PR if there's interest.
Problem
FluentValidation supports a
Severityproperty on validation rules (Error,Warning,Info), but Blazilla currently treats allValidationFailureresults as errors — they all go into theValidationMessageStore, which means:EditContext.Validate()checksGetValidationMessages())This is a common need in business applications where some fields are "recommended but not required" — for example, showing "Description is recommended" as a warning while still allowing the form to submit.
Proposed Solution
Route non-error severity failures to an
EditContext.Propertiesside-channel instead of theValidationMessageStore. This is a non-breaking change — existing error behavior is completely untouched.The core idea:
ApplyValidationResults, checkvalidationFailure.Severity— only addSeverity.Errorfailures to theValidationMessageStoreEditContext.Propertiesvia a small static helper classEditContextto retrieve warnings (GetWarnings,GetAllWarnings,HasWarnings)WarningValidationMessage<TValue>component analogous toValidationMessage<TValue>that reads from the warnings side-channelI've successfully implemented this approach in a fork of the Blazored.FluentValidation library (v2.2.0) and have been using it in production. The changes are well-contained and the approach works reliably with both sync and async validation, field-level and model-level validation, and mixed error/warning rule sets.
Happy to submit a PR if there's interest.