zema 0.5.1
zema: ^0.5.1 copied to clipboard
A high-performance, type-safe schema validation library for Dart & Flutter.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased #
0.5.1 - 2026-03-25 #
Performance #
ZemaString,ZemaInt,ZemaDouble: issue list is now allocated lazily; no heap allocation on the success pathZemaObject:allIssueslist is now allocated lazily; same benefit on both success and failure pathsZemaI18n: active translations map is cached after the first lookup; locale changes still invalidate the cache automatically
0.5.0 - 2026-03-21 #
Added #
ZemaSeverityenum (error,warning) andZemaIssue.severityfield (defaults toerror)ZemaMetaKeys: compile-time constants forZemaIssue.metakeys (min,max,actual,expected,received,allowed,type,multipleOf,pattern,length)ZemaIssue.expected(String?): expected type/value; populated on all built-ininvalid_typeissuesZemaResult.warnings/ZemaResult.hasWarnings: warning issues from a successful parseZemaSchemaRefinement.refineWarn(): advisory refinement; parse succeeds, issue added towarningsz.string().dateTime(): validates ISO 8601 format; output staysString; producesinvalid_datetime_stringz.coerce().dateTime({DateTime? after, DateTime? before}): coercesString,int(Unix ms), orDateTimeZemaSchema.parseInIsolate(): offloadssafeParse()to a backgroundIsolate(built-in primitives only; closures are not isolate-sendable)- Strict coercion mode (
strictparameter) on all coercion schemas; see Breaking Changes forz.coerce().string()default - i18n translations (en + fr) for
invalid_datetime_stringandasync_refinement_skipped
Changed #
ZemaIssuecopy helpers,operator==,hashCode, andtoString()updated forexpectedandseverityZemaSuccesscarries awarningslist (const []by default);success()factory accepts optionalwarningsz.coerce().boolean/integer/floatsignatures gain astrictparameter (backward-compatible)
Breaking Changes #
safeParse()/parse()on async schemas now returnsZemaFailure(code: 'async_refinement_skipped')instead of silently bypassing the predicate. Migrate: usesafeParseAsync()/parseAsync().z.coerce().string()defaults tostrict: true: arbitrary objects now fail withinvalid_coercion. Migrate: passstrict: falseto restore the old behaviour.
0.4.0 - 2026-03-18 #
Added #
ZemaInt.nonNegative(): accepts zero and positive integers (value >= 0)ZemaDouble.nonNegative(): accepts zero and positive doubles (value >= 0.0)ZemaObject.merge(): merges fields from anotherZemaObjectinstance (fields from the argument win on conflict)ZemaUnion.discriminatedBy(): fast-path validation using a named literal field to select the matching schema directly
Tests #
- Rewrote
object_schema_test.dart: full coverage ofZemaObjectincludingextend(),merge(),pick(),omit(),makeStrict(),objectAs(), and nested error paths - Rewrote
array_schema_test.dart: full coverage ofZemaArrayincluding length constraints and nested object errors - Rewrote
modifiers_test.dart: full coverage ofoptional(),nullable(),withDefault(),catchError(), andbrand() - Added
union_test.dart: covers linear scan,discriminatedBy()fast-path, and error meta fields - Added
double_test.dart: covers type validation, range constraints,positive(),negative(),nonNegative(), andfinite() - Extended
int_test.dartwithnonNegative()tests
0.3.0 - 2026-02-21 #
Added #
.optional()modifier for nullable values.nullable()modifier for explicit null support.default()modifier for fallback values.literal()modifier for fallback values.transform()implementation.datatime()implementation.map()implementation.union()implementation.custom()implementation.catch()implementation.prepreces()implementation.pipe()implementation
Change #
- update ZemaArray with
.min()and.max()support - update ZemaSchema by adding modifiers
0.2.0 - 2026-02-10 #
Added #
- Comprehensive README with examples
- API documentation (dartdoc comments)
- Quick start guide
- Usage examples for all types
- 100+ unit tests
-
85% code coverage
- Integration tests
0.1.0 - 2026-02-08 #
Added #
- Core architecture design
- String validation with
.min(),.max(),.email(),.url(),.regex() - Number validation with
.min(),.max(),.positive(),.negative(),.int() - Boolean validation
- Object validation with
z.object({}) - Array validation with
z.array() .safeParse()method that returns result object.parse()method that throws on validation error