Skip to content

feat: add validator composition, pluggable messages, and opt-in strict rules (v1.3.0) - #6

Open
divyanshub024 wants to merge 1 commit into
mainfrom
dv/1.3-composition-and-strict-validation
Open

feat: add validator composition, pluggable messages, and opt-in strict rules (v1.3.0)#6
divyanshub024 wants to merge 1 commit into
mainfrom
dv/1.3-composition-and-strict-validation

Conversation

@divyanshub024

Copy link
Copy Markdown
Member

Summary

Releases 1.3.0. The headline change is that the package no longer requires
Flutter — lib/ has no Flutter imports and the flutter: environment
constraint is dropped, so the validators now run in server-side and CLI Dart
projects. Flutter form usage is unchanged.

What's new

  • Composition — generic FieldValidator<T> with compose, aggregate,
    any, conditional/when/unless, transform, and fluent chaining
    (.and(), .or(), .withMessage()).
  • MessagesValidationMessage/ValidationMessages resolve errors via a
    pluggable resolver keyed by stable IDs, with no intl dependency. An
    explicit errorMessage: still takes precedence.
  • New validators — IBAN, BIC, CVC, card expiry, ISBN-10/13, fixed-length
    hashes, MIME types, data URIs, ISO-8601 dates, 24-hour times, numeric
    ranges, divisibility, text boundaries, and word counts.
  • Opt-in strict modes — JWT, Base32, credit card, URL, email, FQDN, and
    UUID accept configuration; all default to 1.2 behavior.
  • Docs — README rewritten; new guides under doc/ for composition,
    messages, migration, and strict validation. Examples are covered by tests.
  • Example app — five interactive validation flows with widget tests.

Compatibility

No public symbol was removed: all 42 existing Validator.* factories are
retained and 20 added. Non-required validators still accept null and empty so
they compose with required. Strict validation is opt-in.

Note: Validator is now abstract final, so it can no longer be
instantiated 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 doc with zero warnings ·
pure-Dart smoke test · dart pub publish --dry-run with zero warnings.


Supersedes #5, which GitHub auto-closed when its head branch was renamed.

🤖 Generated with Claude Code

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