feat: add validator composition, pluggable messages, and opt-in strict rules (v1.3.0) - #5
Closed
divyanshub024 wants to merge 1 commit into
Closed
feat: add validator composition, pluggable messages, and opt-in strict rules (v1.3.0)#5divyanshub024 wants to merge 1 commit into
divyanshub024 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Releases 1.3.0. The headline change is that the package no longer requires
Flutter —
lib/has no Flutter imports and theflutter:environmentconstraint is dropped, so the validators now run in server-side and CLI Dart
projects. Flutter form usage is unchanged.
What's new
FieldValidator<T>withcompose,aggregate,any,conditional/when/unless,transform, and fluent chaining(
.and(),.or(),.withMessage()).ValidationMessage/ValidationMessagesresolve errors via apluggable resolver keyed by stable IDs, with no
intldependency. Anexplicit
errorMessage:still takes precedence.hashes, MIME types, data URIs, ISO-8601 dates, 24-hour times, numeric
ranges, divisibility, text boundaries, and word counts.
UUID accept configuration; all default to 1.2 behavior.
doc/for composition,messages, migration, and strict validation. Examples are covered by tests.
Compatibility
No public symbol was removed: all 42 existing
Validator.*factories areretained and 20 added. Non-required validators still accept null and empty so
they compose with
required. Strict validation is opt-in.Note:
Validatoris nowabstract final, so it can no longer beinstantiated or subclassed. It has only ever exposed static members.
Verification
dart format·dart analyze· 184 Dart tests ·flutter analyze·5 widget tests · 96.64% line coverage ·
dart docwith zero warnings ·pure-Dart smoke test ·
dart pub publish --dry-runwith zero warnings.