zorphy_annotation 3.0.1
zorphy_annotation: ^3.0.1 copied to clipboard
Annotations for zorphy code generation package that provides clean class definitions with copyWith, JSON serialization, toString, equality, and inheritance support
3.0.1 - 2026-12-02 #
Changed #
- Carries the annotation side of the
schemaVersionwire envelope (issue #542). The annotations themselves are unchanged: no argument is renamed and no annotation is removed.
3.0.0-dev.10 - 2026-11-30 #
Added #
- 100% mutation merge gate (#423, AC3 of #415). A PR that touches the runtime-scope lib sources must now carry mutation evidence that kills 100% of the runtime mutants: the
mutation_gateCI job (ci.yaml + dart.yml) regenerates the scoped sweep (zorphy/mutation-scope.xml— thetest/runtimescope fixed by #395) andscripts/mutation_gate.shfails closed below 100%, reading the xunit report's totals. A missing/stale/gapped report is a gap, never an assumption. Together with the TDD artifact gate (#392) this makes the 100% TDD gate mechanical, unblocking the3.0.0-dev.10publish (#397).
Removed #
- The agent annotation family is gone:
@AgentTool,@AgentRisk,@AgentInternal,@AgentExclude,@AgentToolParam,@AgentDirectiveandAgentRiskTierwere deleted withlib/src/agent_annotations.dart. They have been dead since the v3 migration gate (#233) removedagent_directive_generator.dartand theAgentDirectivemodel: the annotations still exported and their doc comment still promised anAgentDirectiveconst in the generated.zorphy.dart, but no generator read them and no test covered them, so every consumer that annotated a class was silently ignored. Replacement path: none — the v3 archetype surface (@ZorphyEntity/@ZorphyValue/@ZorphyUnion/@ZorphyIntent/@ZorphyState) is the only class annotation API; an agent/MCP exposure layer belongs in the consuming plugin, not in the annotation package. Deleting a module underlib/src/is acknowledged here per the #358 tree-diff guard.
Change #
- SDK floor raised to
>=3.12.0 <4.0.0(was>=3.11.0) (#365). Moves withzorphy/zorphy_migrator: the 3.11.0 floor was unsatisfiable for the generator's build/test workflow (json_serializable6.15 needssdk: ^3.12.0, and the 3.11-compatible 6.14 capsanalyzerbelow the^14.0.0zorphyrequires). 3.13.3 and stable stay supported.
3.0.0-dev.8 - 2026-11-28 #
Change #
- lib/src tree-diff release guard (#358); cost_guards self-skip under host overload (#359); carries public merge API export from dev.7, unblocks zuraffa#2216
3.0.0-dev.7 - 2026-11-28 #
Change #
- restore smart-merge module (#348/#355); ban Impl class/file names (#341); unblocks zuraffa#2212
3.0.0-dev.6 - 2026-11-28 #
Change #
- concrete-enum toJson fix (#336); collection diff equality + nested-nullable decode (#339); enterprise remediation + hygiene
3.0.0-dev.5 - 2026-11-27 #
Change #
- ZorphyNested, fromJson/toJson aliases, enum boundary wire, colocated .zorphy.dart (retires br), wire-capability matrix, stacked-PR integrity, clean-checkout release gate
- Added exported
zorphyCollectionEquals/zorphyCollectionHashruntime helpers and theZorphyPatchAlgebraextension for three-way patch operations
3.0.0-dev.4 - 2026-11-27 #
Change #
- ZorphyField.asObject erasure + static registry (#301), ZorphyNested (#303), union factory fixes, autoId removal (#300)
3.0.0-dev.3 - 2026-11-26 #
Documentation (#275, ZRP-006) #
- No change to the exported annotation surface in this release: the dev.3
additions (#271 redirecting union factories, #272 codec-parameterized generic
toWire/fromWire, #273 nullable generic parameters) are emitted by thezorphygenerator, not declared here. The v3 archetype annotations these forms build on (@ZorphyEntity/@ZorphyValue/@ZorphyUnion/@ZorphyState/@ZorphyIntent) are unchanged. The README and website documentation pass (#275) records the dev.3 forms.
3.0.0-dev.2 - 2026-11-26 #
Changed (BREAKING — v3.0.0) #
- Legacy annotation surface removed (#233).
@Zorphy,@Zorphy2,ZorphyPreset,ZorphyKind,ZValueObject,ZorphyNamedConstructor,ZorphyXand everygenerate*constructor toggle are gone, along with thegetGenericToJsonFn/getFromJsonToGenericFnhelpers. The v3 archetypes (@ZorphyEntity/@ZorphyValue/@ZorphyUnion/@ZorphyState/@ZorphyIntent) are the only class annotations, and none carries a codegen toggle. - Dependency gate reconciled (#175, #176). The #176 zero-external-dependency
goal is met except for two runtime requirements recorded as a reviewed
amendment in #175:
crypto(the SHA-256 intent-digest requirement, #189, the stdlib cannot provide) andjson_annotation(@JsonKeyis the v3 field-level wire annotation the generator reads by name and the migrator emits — it is re-exported so the documented singlezorphy_annotationimport resolves it).collectionis replaced by a localListEquality/MapEqualityshim (src/equality.dart); themeta/quiverre-exports and dependencies are removed.
Added #
-
Three-way merge primitives on
PatchBase(#248).PatchBase(the base every generated<Name>Patchextends) gainsSet<String> get changedPaths(the JSON pointers a patch touches, expanding a carriedPatchNestedto its leaf paths),Set<String> conflictingPaths(PatchBase other)(the exact intersection of two patches' changed paths) andcomposePatches(next)(an alias ofcompose).ZorphyPatchWire.listValue<E>decodes an atomic list field's bare JSON array, all-or-nothing likelistDelta. -
Patch wire codecs (#192):
ZorphyPatchWireis the total decode layer a generated patchfromWirecalls. Every read is anistest, so a corrupt payload becomes aFieldViolationat a JSON pointer instead of a thrownTypeError/CastError;as/asDouble/asDateTime/enumByName/asObjectdecode one value each, andlistDelta/mapDeltadecode a collection delta ALL-OR-NOTHING (a single bad step fails the field rather than silently dropping that step).enumByNamematches a value by NAME, never by index, so inserting an enum member cannot re-point a wire message;astakesnullable: truefor a field whosenullis a deliberate clear. The polymorphic envelope keys (entityType,patchKind,principalKey,ops) are named here, andopsOf/opsPathOfaccept a baretoWire()map and an envelope alike, reporting a violation under/ops/<field>when the caller sent an envelope. -
boundary.dartis exported frompackage:zorphy_annotation/zorphy.dart, the surface generated code imports, so an emittedfromWirecan nameZorphyBoundaryResultwithout a second import (#192). -
Collection delta patches (#183):
ListPatchDelta<E>andMapPatchDelta<K, V>carry an ordered sequence ofListPatchOp/MapPatchOpsteps and implement the full v3 algebra — minimaldiff(no op for an unchanged collection, one op per appended/removed/edited element or put/removed key), fold-orderedapplythat never mutates, concatenatingcompose, round-trippinginvert, andtoWirerendering each step as a descriptor. Both also implement the legacyPatch<T>arm, which is how a generatedpatchWithapplies them. -
PatchNestedimplementsPatch<Sub>as well asZorphyPatch<Sub>, so a parent patch's carried nested patch resolves through the same legacy arm, and gainedinvertNested(before)for inverting a carried sub-patch (#183). -
PatchBaseis const-constructible throughPatchBase.empty(), which backs the generated<Name>Patch.empty()constructor: the empty patch is the allocation-free neutral element ofcomposeandapplyreturns its target unchanged (#182). -
The v3 patch algebra:
ZorphyPatch<T>(isEmpty/isNotEmpty,apply,compose,invert,toWire) with its laws documented on the interface, plus the field-level shapes it composes with —PatchValue<V>(unchanged/set),PatchNested<Sub, SubPatch>,ListPatchOp<E>(replaceAll/append/removeAt/updateAt) andMapPatchOp<K, V>(replaceAll/put/remove) (#181). Every op returns a fresh collection and never mutates its input. -
The five v3 archetypes, all zero-toggle:
ZorphyEntity(principalKey),ZorphyState,ZorphyUnion,ZorphyIntent(replaySafe, required) andZorphyValue, plus the marker interfacesZorphyEntityBase<Id>,ZorphyStateBase,ZorphyUnionBase,ZorphyIntentBase,ZorphyValueBaseand the sharedZorphyPolymorphicBase(#175, #176). A class is annotated with exactly one archetype; polymorphism is declared throughdiscriminator(default'kind') andexplicitSubTypes. -
ZorphyMock— a field-level seed hint, not a toggle — andZorphyMockPresets, the reservedpresetnames (email,uuid,price,url) as constants so a consumer and the generator share one closed set. -
ZorphyLens<S, V>— a typed, JSON-Pointer-addressed lens (path,get,set) withthencomposition, so a consumer can subscribe to or update one nested field with full static type safety (#185).
Changed #
- Wire-codec hardening from the #215 review, all still inside the Unreleased
codec:
asDateTimerejects aDateTime.tryParsenormalization (an invalid calendar component is now a violation);asNumkeeps anintintact for a declarednumfield; violation paths use RFC 6901 tokens (/tags/ops/0,/scores/a~1b); a decoded delta preserves successfulnulloperands and checks required members; negative and known-out-of-range list indices are rejected beforeapplycan throwRangeError; and a map delta's step list is no longer keyed byops, so a literal map key namedoporopsround-trips.PatchWireSetis the unambiguous explicit-set spelling andPatchWireReplacementmarks a whole-value nested replacement. ZorphyNamedConstructoris removed. No library in this package declares or exports it, so code that uses@ZorphyNamedConstructormust be migrated.- SDK floor raised to
>=3.11.0to match what the tracked lockfile resolves and whatzorphy/zorphy_migratoralready declare.dartxdropped: it had no reference in this package. The package also gains its first dev dependency,test, for the archetype suite intest/annotations_test.dart(previously its tests ran from thezorphypackage only).
Change #
- Version synced with
zorphy3.0.0. The 3.0.0 breaking change in this package is the removal of the legacy annotation surface (see Changed above), alongside the generator's shared-part output layout (lib/_br_/). Consumers on the pre-v3 surface must first set their dependency to^3.0.0and rundart pub get, then run thezorphy:migrate_v3codemod (which ships with v3) before upgrading.
2.5.0 - 2026-11-16 #
Change #
- Version synced with
zorphy2.5.0 (no annotation API changes). - No constraint changes:
zorphy_annotationkeeps its own>=3.8.0SDK floor because its dependency set (collection, dartx, json_annotation, meta, quiver) resolves there. Consumers ofzorphyinheritzorphy's>=3.11.0floor, which is the binding minimum for the generator's dependency set.
2.4.6 - 2026-11-15 #
2.4.5 - 2026-11-10 #
Change #
- Version synced with
zorphy2.4.5 (no annotation API changes in this release; generator-side fixes #142 and #148 ship inzorphy).
2.4.4 - 2026-10-20 #
Change #
- Version synced with
zorphy2.4.4 (no annotation API changes in this release).
2.4.3 - 2026-09-18 #
Change #
- Version synced with
zorphy2.4.3 (no annotation API changes in this release).
2.4.2 - 2026-09-18 #
Change #
- Version synced with
zorphy2.4.2 (no annotation API changes in this release).
2.4.1 - 2026-09-18 #
Change #
- Version synced with
zorphy2.4.1 (no annotation API changes in this release).
2.4.0 - 2026-09-13 #
Change #
- Version synced with
zorphy2.4.0 (no annotation API changes in this release).
2.3.1 - 2026-08-27 #
Change #
- Version synced with
zorphy2.3.1 (no annotation API changes in this release).
2.3.0 - 2026-08-23 #
Feat #
- Added
equalityExcludesto@Zorphy,@Zorphy2, andZorphyXfor excluding selected fields from generated equality, lean JSON, and comparison surfaces. - Added agent annotations:
@AgentTool,@AgentRisk,@AgentInternal,@AgentExclude, and@AgentToolParam. - Added
@ZorphyNamedConstructorsupport for custom constructor bodies.
2.2.0 - 2026-08-21 #
Change #
- Version synced with
zorphy2.2.0 (no annotation API changes in this release).
2.1.1 - 2026-08-21 #
Change #
- Version synced with
zorphy2.1.1 (no annotation API changes in this release).
2.1.0 - 2026-08-03 #
2.0.0 - 2026-08-16 #
Feat #
@Zorphy(autoId: true)— auto-generated identity: the generated concrete constructor'sidparameter is optional and defaults to a freshUuid().v4()at construction time (zuraffa#307 — entities likeChatMessage/TelemetryEventno longer need callers to supply ids). The annotated class declaresString get id;and the library importspackage:uuid/uuid.dart.ZorphyKind(entity/valueObject) on@Zorphy/@Zorphy2plus the@ZValueObjectconst alias — marks a class as an immutable composition type with no identity. Codegen (equality, copyWith, JSON) is unchanged; the kind is consumed by the zfamakepipeline to skip root plugins.ZorphyXinterface extended withkindandautoIdgetters.
[2.1.0] - 2026-08-03 #
Feat #
- Added
MergeModeenum (smart/force) for future per-class merge control — re-exported fromzorphy_annotation.dartfor consumer access
Change #
- SDK constraint aligned to
>=3.8.0 <4.0.0(matcheszorphypackage) - Version synced with
zorphy2.1.0
[2.0.0] - 2026-07-30 #
Break #
- All feature flags on
@Zorphy/@Zorphy2are nowbool?(defaultnull= inherit from preset). Source-compatible for named-argument use; the resolved semantics are unchanged for defaults ZorphyX.generateFiltergetter type changedbool→bool?
Feat #
- New
ZorphyPresetenum (lean/standard/full) andpresetparameter on both annotations (defaultstandard, reproducing 1.9.0 output) - New flags:
generateCopyWith,generatePropertyHelpers,generateEqualsToString,generateChangeTo @zorphy2/Zorphy2deprecated — the generator is single-pass since 2.0; the alias behaves identically and will be removed in a later major
1.9.0 - 2026-07-21 #
Break #
- Removed
ZorphyJsonHelperandZorphyJsonCastErrorclasses — no longer used; JSON deserialization is now fully handled byjson_serializable's nativechecked: truegeneration - Removed
export 'src/json_helper.dart'andexport 'src/json_cast_error.dart'fromzorphy.dart
1.8.1 - 2026-07-20 #
Feature #
- Added
ZorphyJsonCastErrorandZorphyJsonHelperclasses for shared safe JSON casting with field-level error messages
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.6 - 2026-04-05 #
Feature #
- Added
PatchBaseclass to centralize JSON serialization for leaner patch generation.
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