zorphy 3.0.0-dev.2
zorphy: ^3.0.0-dev.2 copied to clipboard
A powerful code generation package for Dart/Flutter that provides clean class definitions with copyWith, JSON serialization, toString, equality, and inheritance support
3.0.0-dev.2 - 2026-11-26 #
Migration guide (#236) #
This release closes the #175 re-audit release gate (#236): 3.0.0 is the agreed
v3 artifact, and the codemod plus the notes below are the supported path from
2.x. The full side-by-side table (@Zorphy → the archetypes, copyWith →
ZorphyPatch, toJson/fromJson → toWire/fromWire, ProductFields /
Product.descriptor, and the migrate_v3 codemod) lives in the README's
Migrating v2 → v3 section. The short version:
- Bump
zorphyandzorphy_annotationto^3.0.0(they move in lockstep), thendart pub get. Themigrate_v3executable ships with 3.0, not 2.x. - Preview with
dart run zorphy:migrate_v3 <path>, then rewrite in place withdart run zorphy:migrate_v3 <path> --apply. The codemod strips everypreset:/generate*argument, emits the zero-preset archetypes (@ZorphyEntity(principalKey: #id)/@ZorphyValue()/@ZorphyUnion()/@ZorphyState()/@ZorphyIntent(replaySafe: …)), and moves codec call sites to.fromWire(...)/.toWire(). - Delete the 2.x
<file>.zorphy.dartfiles and any hand-writtenpart '*.zorphy.dart';line — 3.0 emits one shared<library>.part.dartunderlib/_br_/andbuild_runnerinserts thepartdirective itself. - Run
dart run build_runner build(no--delete-conflicting-outputs— the flag was removed in build_runner 2.17), thendart analyze.
Changed (BREAKING — v3.0.0) #
- List patch fields are replaced atomically (#248). A generated
<Name>Patchnow carries a changedList<E>field as the whole new list value (a bare JSON array on the wire), never as positional index ops (ListPatchOp/ListPatchDelta). Concurrent edits to the same list are therefore an exact/tagsconflict instead of silent index corruption. TheListPatchDelta/ListPatchOptypes remain inzorphy_annotationfor direct use but are no longer emitted for entity list fields; the list wire form changes from{'ops': [...]}to a bare array. Map fields keep theirMapPatchDelta. - Legacy
@Zorphy/@Zorphy2generation path removed (#233). After the v3 migration gate the generator runs only the zero-preset archetype pass (@ZorphyEntity/@ZorphyValue/@ZorphyUnion/@ZorphyState/@ZorphyIntent). The legacy orchestrator, the 14 legacy generators, the legacy hierarchy emitters and the plugin pipeline are deleted, along with the dead legacy analyzer layer (class_analyzer,annotation_parser,class_graph,field_resolver,interface_collector,generation_config).ZorphyGeneratorno longer registers the legacy type checkers and emits only the v3 surface. - No generated archetype emits
fromJson/toJson(#188, #233). The v3 wire codecs (fromWire/toWire) are unconditional; the legacy JSON codec generation is gone. - The cross-entity import detector now recognizes every v3 archetype
annotation, not just the legacy
@Zorphy/@Zorphy2. - The CLI entity scaffolder emits v3 archetypes (
@ZorphyEntity(principalKey: #id)/@ZorphyValue()/@ZorphyUnion()) and no longer writes a json_serializable.g.dartpart;project_validatorscans for the v3 archetypes.
Added #
- Three-way merge primitives on every generated patch (#248).
<Name>Patchnow exposesSet<String> get changedPaths(the JSON pointers it touches, e.g.{'/price', '/title'}, with nested edits expanded to the leaf),Set<String> conflictingPaths(other)(the exact intersection — disjoint edits return{}, an overlapping scalar or concurrent list replacement returns the shared pointer), andcomposePatches(next)(an alias ofcomposewith the same left-to-right semantics, so three-way sync has one composition behaviour under its own name). They live onPatchBaseinzorphy_annotation, so every generated patch inherits one implementation. dart run zorphy:migrate_v3 <path>— a v2 → v3 AST migration codemod (#194). It strips every v2preset:andgenerate*boolean argument and rewrites the zero-preset archetypes:@Zorphy/@Zorphy2on anid-bearing class becomes@ZorphyEntity(principalKey: #id), on anid-less class@ZorphyValue(), and@ZorphySealedbecomes@ZorphyUnion. Codec call sites move to the wire codecs —.fromJson(map)→.fromWire(map)(with a// TODO(trust-boundary): handle BoundaryErrmarker) and.toJson()→.toWire()— but only when the receiver is a zorphy-generated type, so unrelated serializers are untouched. Anidinherited from a supertype is recognised; the trust-boundary TODO is indented with the call and emitted once per line. Span-based over the analyzer parse tree, so only the matched annotation / method spans change; dry-run by default,--applyrewrites in place.
Changed #
- Patch wire codecs hardened from the #215 review: generated
toWire()writes enum NAMES (sojsonEncode(toEnvelope())survives a transport hop),toEnvelope({principalKey: ...})carries caller-supplied row identity besideops, a nested whole-value replacement is wrapped so it is never decoded as an edit of the old value, explicit nulls are handled before shape dispatch, anumfield keeps integers, and nestedList<List<T>>/Map<K, Map<...>>decoders keep their full type arguments. Generating a patch with a field named after an envelope key (ops,patchKind,entityType,principalKey) is now refused — the bare/envelope dual shape cannot tell such a field apart from metadata. A nested class inside a collection that arrives as a JSON map still needs the entity's own boundary codec; the emitted decoder documents that limitation.
Added #
-
Generated patches now carry a trust-boundary codec (#192). Every concrete
<Name>Patchgetsstatic ZorphyBoundaryResult<X> fromWire(Map<String, Object?> raw)— decoding each field it carries per shape (scalar, enum by NAME,DateTimefrom ISO-8601,PatchNested,ListPatchOp/MapPatchOpdeltas) and collectingFieldViolations at JSON pointers instead of throwing, plustoEnvelope()rendering{entityType, patchKind, ops}for the polymorphic transport. A nullable field's deliberatenulldecodes as a clear, never as a failed read (the guard is the violation count). Polymorphic roots get a dispatchingfromWirekeyed onpatchKind(sharedvs subtype) that rejects a missing/unknown kind and a foreignentityType, and rejects any op the root patch cannot express rather than silently dropping it. -
Generated
<Name>Patchclasses now patch nested and collection fields deeply instead of overwriting them (#183).diffcarries aPatchNested<Sub, SubPatch>built fromSubPatch.diff(previous.x, next.x)for a nested@ZorphyEntity/@ZorphyStatefield, and aListPatchDelta<E>/MapPatchDelta<K, V>for aList<E>/Map<K, V>field — granularListPatchOp/MapPatchOpsteps rather than a whole-collection replace.invertinverts the value the patch actually carried, andtoWirerenders a delta as itsopslist. A nullable nested field treats a null on either side as a whole-value transition, since there is no sub-patch to apply. Scalar fields are unchanged. -
PatchBaseimplementsZorphyPatch<TEntity>, so a generated<Name>Patchsatisfies the bound aPatchNested<Sub, SubPatch>declares and suppliesisNotEmptyas the negation ofisEmpty(#183). -
Generated
<Name>Patchclasses now carry the v3 patch algebra (#182):static diff(previous, next)(O(1) and allocation-free when the two areidentical),apply(target)(returnstargetitself when the patch is empty),compose(next)(coalesces bursts left-to-right),invert(before)(captures prior values for undo),isEmpty, andtoWire()(field-name keyed). Emission lives inlib/src/emission/patch_emitter.dartand is built entirely frompackage:code_builderspecs — no presets, no toggles, no string assembly. The legacy fluentwith*builders and cross-entity helpers are unchanged. -
PatchBasegained a constPatchBase.empty()constructor so a generated patch can exposeconst <Name>Patch.empty()alongside its mutable default constructor (#182).
Change #
- BREAKING: generated output is now a shared part. The builder declares
adds_to_library: trueand emits one<library>.part.dartper library underlib/_br_/, instead of a<file>.zorphy.dartbeside every source file.build_runnerinserts thepartdirective itself, so a consumer writes no directive for zorphy at all — a project with 71 annotated libraries goes from 71 generated files to 71 parts in one directory, andimport/partchurn in diffs disappears. Consumers must delete the 2.x<file>.zorphy.dartfiles and drop any hand-writtenpart '*.zorphy.dart';line, then runbuild_runner build. (--delete-conflicting-outputsis no longer that cleanup step: build_runner 2.17 removed the flag and only warns about it.) This is the breaking change of the major. - Removed the deprecated
zorphy2Builder(lib/builder2.dart).builder2had been a no-op alias since 2.0;zorphy2Buildernow fails loudly instead of resolving to nothing. zorphy_annotationmoves to 3.0.0 in lockstep (check_version_sync.sh); its legacy annotation surface is removed in this major (see Changed above).zorphy_migratormoves to 3.0.0; itsleansubcommand is removed andmigratenow emits the v3 archetypes (see its CHANGELOG).
Fix #
update<Type>Atno longer emits an always-redundantas <Type>cast: the receiver is alreadyList<Type>, so every consumer used to get anunnecessary_castwarning. The example project masked this because it excludeslib/_br_/**from analysis.
2.5.0 - 2026-11-16 #
Change #
- SDK floor corrected to
>=3.11.0 <4.0.0(was>=3.8.0). The declared dependency set cannot resolve on Dart 3.8–3.10 at all —analyzer14.x,source_gen4.3.1,build5.0.0 anddart_style3.1.14 all require^3.11.0— so 2.4.6 was already unsatisfiable there and the old floor was misleading rather than a supported range. Dart 3.11/3.12 consumers resolveanalyzer14.0.0–14.5.x inside^14.0.0; the committed lock keeps 14.7.0 for development (that single version needs^3.13.0). zorphy_migratorreceives the same SDK-floor correction (>=3.8.0→>=3.11.0); its version line is unchanged (2.0.0).- Third-party dependency constraints are unchanged from 2.4.6 — the declared ranges
already resolve to the latest published versions (analyzer 14.7.0,
build 5.0.0, source_gen 4.3.1, code_builder 4.13.0, dart_style 3.1.14,
build_runner 2.17.1). In
zorphy/pubspec.yaml,zorphy_annotationis declared as^2.5.0(with local development usingpubspec_overrides.yaml). Onlyzorphy_migrator/pubspec.lockmoved: its committed lock still namedzorphy_annotation2.4.5 while the tree is 2.4.6.
Test #
- New release gate
test/release/analyze_clean_gate_test.dart: generates.zorphy.dartfor one fixture per feature family (plain,fullpreset, inheritance, sealed polymorphism, enum fields, plus JSON variants), then re-analyzes the output in process with the analyzer version pinned inpubspec.lockand asserts zero diagnostics. Goldens prove the emitted bytes did not change; only re-analysis proves the emitted code still compiles under the analyzer 14.6+undefined_*_read/undefined_*_writediagnostics. JSON fixtures are allowed exactly the unresolved json_serializable part symbols (_$XToJson/_$XFromJson), which a consumer build generates. - New
test/release/sdk_floor_alignment_test.dart,test/release/dependency_constraints_unchanged_test.dartandtest/release/version_sync_test.dartpin the published contract: the SDK floor admits 3.11.0 and rejects 3.10.9, the declared dependency constraints equal the 2.4.6 set, and both packages sit at the same version. - The gate documents arrrrny/zorphy#159 as a characterization test: a sealed
base with
explicitSubTypesemits subtypetoJson/fromJsoncalls even with JSON generation off, so that generated part does not compile. Output is byte-identical in 2.5.0, so the defect is tracked separately.
2.4.6 - 2026-11-15 #
Change #
- Maintenance release: no generator source changes; Dependabot dependency bumps —
analyzer(constraint normalized to caret form^14.0.0, same>=14.0.0 <15.0.0range),code_builder,dart_style,glob(#152–#157)
2.4.5 - 2026-11-10 #
Fix #
- fix #142: generated
$$bases stay implementable across libraries (cross-library sealed-base rejection resolved by PR #146) - fix #148: generator no longer hard-casts
List<Map<String, dynamic>>fields at copyWithField/patch arms (raw JSON payloads no longer TypeError)
2.4.4 - 2026-10-20 #
Change #
- Support
build5.x so the latestbuild_runnerresolves.zorphypinnedbuild: ^4.0.4, butbuild_runner2.17.1 requiresbuild >=5.0.0 <5.1.0, so no consumer could use zorphy together with the current build_runner — pub version solving failed outright. The blocker was zorphy's ownbuildconstraint, notsource_gen:source_gen4.3.1 already allowsbuild >=3.0.2 <6.0.0. The constraint is nowbuild: ">=4.0.4 <6.0.0", withsource_gen: ^4.3.1andanalyzer: ">=14.0.0 <15.0.0"(whatsource_gen4.3.x requires), and the dev dependency onbuild_runnermoves to^2.17.1. Verified against build 5.0.0 / build_runner 2.17.1 / source_gen 4.3.1 / analyzer 14.5.0: the generator test suite is green and the emitted code is unchanged (#143)
2.4.3 - 2026-09-18 #
2.4.2 - 2026-09-18 #
2.4.1 - 2026-09-18 #
2.4.0 - 2026-09-13 #
Feat #
- Generators: custom decorators on entities are now preserved during code generation, enabling integration with third-party annotation libraries.
- Gym: real exercises framework for zorphy with warmup phases (dependencies, build, smoke tests) and lift-json-payload benchmark.
- Generators: value-equality surface, interface copyWith support, and agent annotations fully integrated into the generation pipeline.
Fix #
- CI: fixed archive prepare-workspace race condition and pub get failures in CI Gate jobs.
- CLI: addressed review comments on entity creation and error handling.
Chore #
- Restored monorepo dependency_overrides with full test suite verification.
Docs #
- Speckit analysis: verified 3/3 mutation testing passing; tdd verification complete.
2.3.1 - 2026-08-27 #
Fix #
- CLI: escape special characters (apostrophes, backslashes, dollar signs) in
@JsonKey(name:)annotations when generating entity code (PR #133). - Generators:
copyWithFieldon child classes with interfaces now uses the parent'sField<Parent, T>type with@overrideinstead ofcovariant, keeping LSP-safe polymorphic dispatch via Dart's declaration-site covariance. - Generators:
copyWithFieldon child classes handles ALL fields (parent + own) — no need for separatecopyWith{Interface}Fieldmethods.
2.3.0 - 2026-08-23 #
Feat #
- Generators: value-comparison surface for
autoIdentities (issue #127, proposal #2). Every@Zorphy(autoId: true)concrete class now gets two NEW methods on the generated class:bool valueEquals(Object other)—trueiffotheris the same concrete type AND every field EXCEPT the autoId field (id) is equal to this instance's. Identity equality (the default==/hashCode) is preserved;valueEqualsis an additive surface for consumers that need value comparison.Map<String, dynamic> toJsonValue()— the fulltoJson()output with the autoId field (id) key removed. Stable across two instances with the same field values; use a canonical serialized representation (e.g.,toJsonValue().toString()) or an explicit value-key type for deduplication. Emitted only whengenerateJson: true(it calls_$XToJson(this)). Both methods also drop any field listed inequalityExcludes(see below). The autoIdidis always dropped by these methods.
- Annotation: field-level equality exclusion via
@Zorphy(equalityExcludes: ['id'])(issue #127, proposal #1). Fields listed inequalityExcludesare dropped from four generated surfaces:operator ==,hashCode,toJsonLean()andcompareToX().toJson()andtoString()keep every field — the entity still round-trips through JSON for persistence and the id stays in debug output. Defaults to an empty list (the v2.2.0 byte-for-byte output is preserved for non-autoId entities and for autoId entities that already existed — those now gain the NEWvalueEquals()/toJsonValue()methods while their existing==/hashCode/toJsonLean()/compareToX()behavior is unchanged). Field names are matched against the Dart field name (NOT a@JsonKey(name: ...)alias). zorphy_annotationbumped to 2.3.0 (newequalityExcludesfield on@Zorphy/@Zorphy2/ZorphyX; backward-compatible — defaults toconst []).zorphydepends on^2.3.0and uses adependency_overridespath to../zorphy_annotationfor in-tree development (matches thezorphy_migratorpattern).
Docs #
- Annotation:
Zorphy.autoIdnow documents the value-semantics caveat (the minted uuid is identity noise — two instances with the same field values compare unequal by default) and points to the two opt-outs (equalityExcludesfor full field-level exclusion,valueEquals/toJsonValuefor additive value comparison without changing identity equality).
Test #
- Add regression test
test/regression/issue_127_value_equality_test.dart(21 assertions) exercising three fixtures inexample/lib/various/issue127_value_equality_example.dart:$AutoIdDefault— back-compat default:==/hashCode/toJsonLean()/compareToX()still includeid, and the NEWvalueEquals/toJsonValuemethods drop it.$AutoIdExcludesId— opt-out:==/hashCode/toJsonLean()/compareToX()dropid;toJson()keeps it;valueEquals/toJsonValuealso drop it.$NonAutoIdExcludesCreatedAt— non-autoId opt-out:createdAtis dropped from the four surfaces; novalueEquals/toJsonValuemethods (autoId-only surface). All assertions pass; full test suite (253 tests) passes;dart analyzeis clean onzorphy,zorphy_annotation, andexample.
2.2.0 - 2026-08-21 #
Refactor #
- Generators: extract the cross-entity import guidance detector (issue #117)
into a public, testable, analyzer-free helper —
CrossEntityImportDetectoratpackage:zorphy/src/analysis/cross_entity_import_detector.dart. TheZorphyGeneratorstill emits the same guidance comment; the detector is now unit-tested directly.
Test #
- Add regression tests for issue #117 (cross-entity
patchWith/fromJsoncast targets the concrete entity type) and issue #119 (subtypepatchWithcast strips the leading$), withexample/lib/variousfixtures. - Add unit tests for
CrossEntityImportDetector(pre-filter, self-reference skip, missing-import detection, generic type arguments, snake_case conversion, and comment/string-literal-safe import scanning).
2.1.1 - 2026-08-21 #
Feat #
- CLI:
--staticflag emits static class members on generated entities (closes #107). - Generators:
Patch+FieldEnumgeneration for nonSealed abstract base classes (closes #111). - Generators: bare
Function/Function?callback fields on value-object entities no longer break json_serializable (closes #105).
2.1.0 - 2026-08-21 #
Feat #
- Polymorphic dispatch:
EntityConfiggainstypeKey(default__typename) andsubtypeWireValuefor custom polymorphic JSON keys/values, and the generatedChangeToextension now serializes sealed subtypes via aswitch (this)that calls the correcttoJson()per subtype (fixes malformed polymorphic payloads for explicit-subtype hierarchies).
Fix #
- Generators: strip the leading
$frompatchWith/fromJsoncast types for explicit-subtype fields — the generatedas $Credentials?cast (undefined in the consuming file) now resolves toas Credentials?(fixes arrrrny/zorphy#119).
2.0.1 - 2026-08-19 #
Fix #
- Generators: typed
patchWith— the generated_patchMapternary chains collapse todynamic; patched values are now cast with postfixas T(valid for nullable types too) instead of invalid prefix(T)?casts. - Generators:
toJsonLeansanitizes the map in place and returns the typedMap<String, dynamic>instead of returning thedynamicsanitizer result. - CLI:
ImportResolveremits relative sibling-entity imports for!Type(external) fields when the referenced entity exists on disk — cross-entity references now generate resolvable code (fixes json_serializableInvalidTypefailures).
Generated code from both fixes passes dart analyze with zero findings.
2.0.0 - 2026-08-16 #
Feat #
autoIdsupport: a@Zorphy(autoId: true)class whose source declaresString get id;gets an optionalString? idconstructor parameter defaulting toconst Uuid().v4()— the generated class is constructible without an explicit identity (zuraffa#307). The@ZValueObject/ZorphyKind.valueObjectkind is parsed and threaded intoGenerationConfigfor framework consumers.EntityConfig/template:autoIdandkindoptions —zfa entity create --auto-idemits theidgetter, the uuid import and theautoId: trueannotation option;--kind=value_objectemitskind: ZorphyKind.valueObject.zorphy_annotationbumped to 2.2.0 (newZorphyKind,autoId,ZValueObjectannotation surface).
[2.1.0] - 2026-08-03 #
Feat #
- AST-based smart regeneration engine — non-destructive merge of generated output with user edits (region markers, structural diff, conflict reporting)
- Plugin API & registry (
ZorphyPlugin,PluginContext,PluginRegistry) — post-spec transform hooks with topological ordering, import injection, and diagnostic accumulation MergeModeenum (smart/force) andisForcebuilder/ generator flag to bypass smart mergeZorphyPluginabstract class exported fromzorphy.dart
Change #
- Version synced with
zorphy_annotation2.1.0 zorphy_annotationdependency bumped to^2.1.0
[2.0.0] - 2026-07-30 #
Break #
analyzerconstraint widened to>=13.0.0 <15.0.0— consumers on modern Dart toolchains (analyzer 14.x) now resolve without overridesbuild.yamlconsolidated to a single builder: one generation pass per library (roughly 2x faster consumer builds). The second pass (zorphy2builder) no longer exists;@zorphy2/@Zorphy2keep working as deprecated aliases of@zorphy- Removed process-global static cross-asset state (
_allAnnotatedClasses) — annotated-class graphs are now built per library, so build_runner caching/invalidation works correctly - Fieldless explicit subtypes now emit a minimal patch class and identity
patchWith—changeToextensions reference them (previously produced undefined-method errors)
Feat #
ZorphyPreset(lean/standard/full) plus per-featurebool?flags (generateCopyWith,generatePropertyHelpers,generateEqualsToString,generateChangeTo, and existing flags now nullable) —nullinherits from the preset, explicit values override itstandardpreset reproduces 1.9.0 output semantics — upgrading with no annotation changes keeps full output (see note ongenerateFilterbelow)leanpreset emits only class + constructor + copyWith +==/hashCode/toString;fulladdscopyWithFn- All flag resolution is centralized in
GenerationConfig; generators no longer read annotations directly - CI matrix verifies
dart testagainst analyzer 13.x and 14.x
Note #
- The deprecated
const zorphy/const zorphy2top-level constants previously carriedgenerateFilter: false(while the class default wastrue); in 2.0 both paths resolve consistently to thestandardpreset (generateFilter: true). Affected files gainFieldsfilter descriptors on regeneration. PingenerateFilter: falseexplicitly to opt out.
See MIGRATION-v2.md for the upgrade path.
1.9.0 - 2026-07-21 #
Breaking #
- Replaced inline
_zc/ZorphyJsonHelpersafe-cast approach with nativejson_serializabledeserialization usingchecked: true— field-level error messages are now provided byCheckedFromJsonExceptionfrom thejson_serializablepackage rather than customZorphyJsonCastError - Removed
zorphy_annotationsource files:json_helper.dartandjson_cast_error.dart— these are no longer needed; all JSON deserialization is handled byjson_serializabledirectly
Fix #
Map<K, V>fields (e.g.Map<String, String>?,Map<String, Entity>?) now correctly deserialize becausechecked: true+ native generation produces recursive.map((k, e) => MapEntry(k, e as String))conversions in the.g.dartfile, resolving runtimetype '_Map<String, dynamic>' is not a subtype of type 'Map<String, String>'errors
Chore #
- Upgraded
build_runnerto ^2.15.2,source_gento ^4.2.3,json_annotationto ^4.12.0 - Removed
dependency_overridesforanalyzerandmeta— packages now resolve coherently against the SDK
Features preserved from earlier releases (cherry-picked) #
- Refined nullable-string property helpers:
text?.isNotEmpty == trueinstead oftext != null && text.isNotEmpty - Const constructor support for non-sealed abstract classes
1.8.10 - 2026-07-21 #
Fix #
- Replaced deprecated
@JsonKey(ignore: true)with@JsonKey(includeToJson: false, includeFromJson: false)onhashCodegetter Map<K,V>fields now use direct(json['f'] as Map<K,V>?)cast instead ofZorphyJsonHelper.castto avoid runtime type erasure issues (e.g.Map<String, dynamic>vsMap<String, String>)
1.8.9 - 2026-07-21 #
Fix #
- Replaced deprecated
@JsonKey(ignore: true)with@JsonKey(includeToJson: false, includeFromJson: false)onhashCodegetter
1.8.8 - 2026-07-21 #
Fix #
hashCodegetter is now annotated with@JsonKey(ignore: true)to prevent json_serializable from including it intoJsonoutput (regression fromcreateFactory: falsechanges)
1.8.7 - 2026-07-21 #
Fix #
List<Object>and other identity-cast list fields now cast directly to the target type (as List<Object>?) instead of going throughList<dynamic>which isn't assignable in Dart 3- Fields like
List<Object>? get matchnow generate(json['match'] as List<Object>?)
1.8.6 - 2026-07-20 #
Fix #
- Reverted
List/Setfield casts fromZorphyJsonHelper.cast<List<dynamic>>back to(json['f'] as List<dynamic>)— generic function return types don't satisfy Dart 3's type system for downstream typed list parameters - Enum detection now scans analyzer-level type arguments, catching enums that only appear inside generic types like
List<TransformationType>without a bareTransformationTypefield
1.8.5 - 2026-07-20 #
Fix #
List<EnumType>fields in fromJson now use$enumDecode(_$EnumTypeEnumMap, e)for element conversion instead of incorrectly callingEnumType.fromJson(e as Map<String, dynamic>)
1.8.4 - 2026-07-20 #
Fix #
- Fields with
@JsonKey(fromJson: someConverter)but noincludeFromJson: falsenow correctly call the converter instead of falling through to.fromJson()on the raw type
1.8.3 - 2026-07-20 #
Fix #
- Non-sealed abstract classes with
constconstructors now correctly generateconst ClassName();instead ofClassName();
1.8.2 - 2026-07-20 #
1.8.1 - 2026-07-20 #
Fix #
- Replaced per-class
_zc<T>()static helpers with sharedZorphyJsonHelper.cast<T>()fromzorphy_annotationfor Dart 3.12+ compatibility - Added
ZorphyJsonCastErrorwith field-level context in error messages
1.8.0 - 2026-07-20 #
Feature #
- Safe fromJson casts with field-level error messages — replaces json_serializable delegates with inline
_zc<T>()wrapper that throwsTypeError.withStackTraceincluding field name, expected type, actual type, and the value itself - Example error:
Zorphy: Field 'id' expected String, got int (42)
1.6.9 - 2026-04-27 #
Change #
- Revert property helper generation to ownFields and fix automated publishing flow
1.6.8 - 2026-04-27 #
Change #
- Streamline release process and fix PropertyHelpers extension generation for inherited fields
1.6.7 - 2026-04-06 #
Fix #
- Factory method parameter types now preserve import prefixes (
asclauses) in generated code
1.6.6 - 2026-04-05 #
Feature #
- Extracted Patch class boilerplate into
PatchBaseto drastically reduce generated code size. - Fixed
toJson()bug on abstract base classes in explicit subtypeschangeToextension.
1.6.1 - 2026-02-15 #
Change #
- Refactored CLI code to be more robust and consumable
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.
1.5.7 - 2026-02-14 #
Fix #
- Modified skip logic in
getProperties()to not skip fields that exist in both parentFields and ownFields (overridden fields) - Prevents duplicate
@overrideannotation when source already has it - Constructor generation
isParentFieldcheck now excludes fields in ownFields so overridden fields usethis.fieldsyntax - Added
_getCovariantFields()helper to detect fields where class type differs from interface type getInterfaceCopyWithMethods()now uses class field types (not interface types) for parameters and adds covariant where neededgetInterfaceCopyWithFnMethods()now uses class field types for parameters
1.5.6 - 2026-02-14 #
Chore #
- Updated docs and created docusaurus website
- Create public constructors by default and only create private when hidden
1.5.4 - 2026-02-13 #
Change #
- Allow hybrid serialization with json_serializable for generic field types
1.5.3 - 2026-02-13 #
Fix #
- Fixed JsonKey and other annotations not being caught due to Analyzer 10 changes
1.5.2 - 2026-02-12 #
Fix #
- Updated copyWith generation to use a sentinel parameter pattern, preserving non-nullable fields while allowing explicit nulls for nullable fields
1.1.0 - 2026-02-05 #
Change #
- Fixed edge case where a class extends a sealed class and implements another class causing parameters not passed in super constructor
1.0.0 - 2026-02-04 #
Added #
- Initial release of zorphy_annotation package
- Core
@Zorphy()annotation with full configuration support generateJsonoption for JSON serializationgenerateCompareTooption for diff generationgenerateCopyWithFnoption for function-based copyWithexplicitSubTypesoption for sealed class hierarchies- Support for generic type parameters
- Support for nested object patching
- Support for self-referencing types
- Support for multiple inheritance via interfaces
- Support for enum fields
- Support for constant constructors
- Full TypeScript-style type safety
Features #
- Immutable data class generation
- Automatic constructor generation
- Smart copyWith methods
- Advanced patching system with fluent API
- JSON serialization with lean JSON option
- Sealed classes with polymorphic serialization
- Multiple inheritance support
- Generic class support
- Enum integration
- Self-referencing type support
- Comparison and diff generation
- Equality and hashCode generation
- ToString generation
- Type-safe field enums
Documentation #
- Comprehensive README with examples
- Quick start guide
- Feature reference
- Real-world usage examples