Features
Zorphy keeps the source declarations tiny and pushes the heavy lifting into generated code.
Core generation
- Immutable concrete classes generated from
$-prefixed abstract definitions. copyWithhelpers for partial updates.- Structural equality,
hashCode, andtoString. - Optional
compareTohelpers for diffing two instances. - Optional patch APIs for controlled updates.
JSON serialization
toJsonandfromJsonfor every generated class.- Lean JSON output for clean payloads when you want to remove metadata.
- Manual converters via
@JsonKey(toJson: ..., fromJson: ...). - Polymorphic JSON for sealed and explicit subtype hierarchies.
Polymorphism
- Sealed bases with
$$. explicitSubTypesfor safe JSON dispatch.nonSealedfor open hierarchies used in domain entities.
Generics
- Generic entities with
genericArgumentFactories. - Custom converters for generic fields.
Query helpers
- Field descriptors for filters and sorting.
- Built-in filter operators:
eq,gt,lt,contains,and,or. - In-memory query helpers for quick iteration.
Quality of life
- Default values via
@JsonKey(defaultValue: ...). - Hidden constructors with factory methods.
- Nullability annotations that align with generated code.