df_generate_dart_models 0.19.3 copy "df_generate_dart_models: ^0.19.3" to clipboard
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_dbml round-trip fidelity: quoted array column types ("uuid[]", "text[]") are now parsed (were silently dropped) and emit a typed List<E>; jsonb/json columns map to a plain nested Map<String, dynamic> (the PG_jsonb-Map marker 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_dbml now preserves DBML enum value casing verbatim (PENDING, not pending). 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 DBML enum {...} block.

0.19.1 #

  • fix: df_generate_dart_models_from_dbml round-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[]), and note: 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 column default: values into Field.columnDefault and full indexes { ... } blocks into GenerateDartModel.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_dbml now emits column default: values (from Field.columnDefault), indexes { ... } blocks (from GenerateDartModel.indexes), and a table-level note: (from the model description), 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 emitted Enum "invite_status" { ... } block, instead of the non-standard enum(invite_status) wrapper. This is standard DBML and matches hand-authored schemas; the reverse df_generate_dart_models_from_dbml still 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.2 for the new columnDefault / indexes annotation slots.

0.17.2 #

  • chore: bump df_string to ^0.4.0, df_gen_core to ^0.8.1, and df_generate_dart_models_core to ^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 emit phone_e164 instead of phone_e_164, line1 instead of line_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_dbml command (alias --models-from-dbml) — the inverse of df_generate_dbml. Reads a DBML schema (Tables, enum blocks, inline/standalone Ref:s, notes) and emits one annotated @GenerateDartModel abstract class per table, then runs the forward df_generate_dart_models codegen automatically (pass --no-codegen to stop after the annotation files)
  • New: --dialect (postgres | sqlite | generic) controls the emitted fieldType vocabulary; foreign keys become references:/foreignKey:, DBML enums round-trip into Dart enums, and a shared dbml_enums.dart sidecar is written when any enum is present
  • New: out-of-tree runs bootstrap a minimal pub workspace (with a local df_generate_dart_models_core override when a sibling checkout is found) so the forward codegen can resolve

0.16.2 #

  • Released @ 6/2026 (UTC)
  • Fix: df_generate_dbml was built into bin/ but missing from the executables: block, so dart pub global activate did not install it as a CLI. Adding it (plus a --dbml alias) makes df_generate_dbml available globally

0.16.1 #

  • Released @ 6/2026 (UTC)
  • New: tableName: annotation slot — explicit override for the DBML table name; falls back to stripping the Model marker (prefix or suffix) from the class and snake-casing. No automatic English pluralisation. ModelUseruser, HelloModelhello, ModelModelmodel
  • New: schema: annotation slot acts as the DBML emission gate. Models without schema: are skipped (nested/embedded children drop out naturally). Distinct schema values produce one <schema>.dbml file each — multi-schema projects supported out of the box
  • New: static const tableName emitted 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 a String literal (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 explicit tableName:
  • New: DBML emitter's --output is now treated as the directory for per-schema files (a *.dbml value uses its parent dir — old ergonomics still work)
  • Fix: default template URL is now version-pinned (v$version) — old binaries no longer pull main template changes silently. Falls back to main only 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: fieldPath dual-shape — dot-separated String or Iterable<String>; multi-segment paths emit deep null-aware accessors (json?['profile']?['id'])
  • New: enum detection without Type/Enum suffix — analyzer-driven via @enum sentinel; legacy suffix-based detection still works
  • New: Equatable opt-in by inheritance — extends BaseModel opts out (const-set-safe), everything else gets EquatableMixin
  • New: dialect support — PG_*, SQLITE_*, FS_*, STRICT- prefix vocabulary with composable mappers
  • New: DBML schema export via df_generate_dbml CLI — PKs, FKs, sized varchar/numeric, enums, JSONB columns
  • Fix: fromOrNull / fromJsonStringOrNull / fromUriOrNull templates 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 FieldUtils accessors instead of dynamic property access
  • Fix: top-level catch logs the actual exception, not just a generic message
  • Removed: obsolete df_generate_dart_models_gemeni executable
  • 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
3
likes
120
points
625
downloads

Documentation

API reference

Publisher

verified publisherdev-cetera.com

Weekly Downloads

A tool for generating data models and classes from annotations, offering greater flexibility than json_serializable or freezed.

Homepage
Repository (GitHub)
View/report issues

Topics

#build-runner #cli #codegen #freezed #json-serializable

Funding

Consider supporting this project:

www.buymeacoffee.com
www.patreon.com
github.com

License

MIT (license)

Dependencies

ai_broker, analyzer, df_collection, df_config, df_gen_core, df_generate_dart_models_core, df_log, df_string, df_type, path

More

Packages that depend on df_generate_dart_models