df_generate_dart_models 0.19.3
df_generate_dart_models: ^0.19.3 copied to clipboard
A tool for generating data models and classes from annotations, offering greater flexibility than json_serializable or freezed.
Changelog #
0.19.3 #
- fix:
df_generate_dart_models_from_dbmlround-trip fidelity: quoted array column types ("uuid[]","text[]") are now parsed (were silently dropped) and emit a typedList<E>;jsonb/jsoncolumns map to a plain nestedMap<String, dynamic>(thePG_jsonb-Mapmarker JSON-encoded the value to a String, breaking the wire shape + round-trips); and$in a note is escaped so it isn't treated as Dart interpolation.
0.19.2 #
- fix:
df_generate_dart_models_from_dbmlnow preserves DBML enum value casing verbatim (PENDING, notpending). Since the model layer serialises enums via.name, camel-casing the value silently changed the persisted/wire value; enum constants are now emitted exactly as declared in the DBMLenum {...}block.
0.19.1 #
- fix:
df_generate_dart_models_from_dbmlround-trip fidelity — table notes are now matched case-insensitively (note:/Note:); multi-line'''...'''table notes are captured (and no longer mis-parsed as phantom columns); composite[pk]index settings, enum-array column types (weekday_kind[]), andnote:values written in any quote style ('...',"...",'''...''') are all preserved. A DBML → model → DBML round-trip now retains the full schema semantics (types, defaults, indexes, notes), re-emitted in the generator's canonical style.
0.19.0 #
- feat:
df_generate_dart_models_from_dbml(the reverse generator) now captures columndefault:values intoField.columnDefaultand fullindexes { ... }blocks intoGenerateDartModel.indexes(columns,unique,name,note). Combined with 0.18.0's forward emitter, a DBML → model → DBML round-trip is now byte-exact for defaults, indexes, table/column notes, and enum types.
0.18.0 #
- feat:
df_generate_dbmlnow emits columndefault:values (fromField.columnDefault),indexes { ... }blocks (fromGenerateDartModel.indexes), and a table-levelnote:(from the modeldescription), so a hand-authored schema's defaults, indexes, and notes can round-trip through the models. - change: enum-typed columns are emitted as the bare DBML enum type name (
status invite_status) referencing the emittedEnum "invite_status" { ... }block, instead of the non-standardenum(invite_status)wrapper. This is standard DBML and matches hand-authored schemas; the reversedf_generate_dart_models_from_dbmlstill resolves it via the enum block. Regenerating an existing schema rewrites enum column types to the bare form. - Requires
df_generate_dart_models_core ^0.11.2for the newcolumnDefault/indexesannotation slots.
0.17.2 #
- chore: bump
df_stringto^0.4.0,df_gen_coreto^0.8.1, anddf_generate_dart_models_coreto^0.11.1, adopting df_string 0.4.0's case-conversion digit-boundary change. Behavioural (opt-in on regeneration): field/wire keys derived from identifiers with embedded digits now emitphone_e164instead ofphone_e_164,line1instead ofline_1. Re-run the generator to adopt the new keys; existing generated files are unchanged until regenerated. All 213 tests pass against df_string 0.4.0.
0.17.1 #
- fix: exclude generated .g.dart from analysis in example too
0.17.0 #
- Released @ 7/2026 (UTC)
- New:
df_generate_dart_models_from_dbmlcommand (alias--models-from-dbml) — the inverse ofdf_generate_dbml. Reads a DBML schema (Tables,enumblocks, inline/standaloneRef:s, notes) and emits one annotated@GenerateDartModelabstract class per table, then runs the forwarddf_generate_dart_modelscodegen automatically (pass--no-codegento stop after the annotation files) - New:
--dialect(postgres | sqlite | generic) controls the emittedfieldTypevocabulary; foreign keys becomereferences:/foreignKey:, DBML enums round-trip into Dart enums, and a shareddbml_enums.dartsidecar is written when any enum is present - New: out-of-tree runs bootstrap a minimal pub workspace (with a local
df_generate_dart_models_coreoverride when a sibling checkout is found) so the forward codegen can resolve
0.16.2 #
- Released @ 6/2026 (UTC)
- Fix:
df_generate_dbmlwas built intobin/but missing from theexecutables:block, sodart pub global activatedid not install it as a CLI. Adding it (plus a--dbmlalias) makesdf_generate_dbmlavailable globally
0.16.1 #
- Released @ 6/2026 (UTC)
- New:
tableName:annotation slot — explicit override for the DBML table name; falls back to stripping theModelmarker (prefix or suffix) from the class and snake-casing. No automatic English pluralisation.ModelUser→user,HelloModel→hello,ModelModel→model - New:
schema:annotation slot acts as the DBML emission gate. Models withoutschema:are skipped (nested/embedded children drop out naturally). Distinct schema values produce one<schema>.dbmlfile each — multi-schema projects supported out of the box - New:
static const tableNameemitted on every generated class — runtime introspection without the annotation handshake (ModelUser.tableName) - New:
XxxFieldNames.$values/$primaryKey/$foreignKeys— surface declaration-order field names, the primary key, and the foreign-key → referenced-class map without reflection - New:
references:accepts aStringliteral (references: 'ModelUser') in addition to a Type literal — lets cross-package references skip the import chain - New: FK target column now resolves to the parent's actual primary-key column (e.g.
permissions.key) instead of hardcoded.id; FK target table honours the parent's explicittableName: - New: DBML emitter's
--outputis now treated as the directory for per-schema files (a*.dbmlvalue uses its parent dir — old ergonomics still work) - Fix: default template URL is now version-pinned (
v$version) — old binaries no longer pullmaintemplate changes silently. Falls back tomainonly for dev checkouts - Fix: no-pluralisation rule replaces the previous naive English heuristic that produced
activitys/contact_address/ etc. - Pulls in df_generate_dart_models_core 0.11.0
0.15.0 #
- Released @ 6/2026 (UTC)
- New:
fieldPathdual-shape — dot-separatedStringorIterable<String>; multi-segment paths emit deep null-aware accessors (json?['profile']?['id']) - New: enum detection without
Type/Enumsuffix — analyzer-driven via@enumsentinel; legacy suffix-based detection still works - New: Equatable opt-in by inheritance —
extends BaseModelopts out (const-set-safe), everything else getsEquatableMixin - New: dialect support —
PG_*,SQLITE_*,FS_*,STRICT-prefix vocabulary with composable mappers - New: DBML schema export via
df_generate_dbmlCLI — PKs, FKs, sized varchar/numeric, enums, JSONB columns - Fix:
fromOrNull/fromJsonStringOrNull/fromUriOrNulltemplates honor the null-return contract (no more silent throws on the null/empty/wrong-path input) - Fix: AI prompt no longer collapses field path segments via
join('')— uses.separator - Fix: AI generator uses safe
FieldUtilsaccessors instead of dynamic property access - Fix: top-level catch logs the actual exception, not just a generic message
- Removed: obsolete
df_generate_dart_models_gemeniexecutable - Pulls in df_gen_core 0.8.0 and df_generate_dart_models_core 0.10.0
0.14.3 #
- Released @ 12/2025 (UTC)
- Update dependencies