diff --git a/CHANGELOG.md b/CHANGELOG.md index 664f96e..250facd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file. - [ ] `example/` updated when the change touches the canonical consumer scaffold - [ ] `flutter test` green; `dart analyze` clean; `dart format` no diff; `dart pub publish --dry-run` no blocking errors +## [0.0.5] - 2026-07-26 + ### Added - **`Model.save()` now exposes the backend's per-field 422 errors instead of discarding them.** `save()` returned only a `bool`, so a form that wrote through the ORM could tell that a remote save failed but not why, and every 422 collapsed into a generic "something went wrong" toast. A failed remote save now captures the Laravel validation shape (`{"message": ..., "errors": {"field": ["message"]}}`) into two new members on `InteractsWithPersistence`: `validationErrors` (`Map>`) and `validationError(field)` (the first message for one field). The map is cleared at the start of every remote save, so it stays empty after a save that succeeded or carried no field errors, and it also stays empty when the remote leg throws (a transport failure), which is how a caller distinguishes a field-validation failure from a network failure: an empty map plus a `false` return means "render a generic error". It is deeply unmodifiable (both the map and each message list), and it tracks the REMOTE leg rather than `save()`'s return value, so a hybrid model (`useRemote` and `useLocal`) whose remote save 422s while its local write succeeds returns `true` with the errors filled. The `bool` return contract is unchanged, so this is purely additive for existing callers. Touches `lib/src/database/eloquent/concerns/interacts_with_persistence.dart`; covered by the `InteractsWithPersistence validation errors` group in `test/database/eloquent/model_test.dart`; documented in `doc/eloquent/getting-started.md` (Inserting & Updating -> Validation Errors) and `skills/magic-framework/references/forms-validation.md` (Server Error Mapping). diff --git a/example/pubspec.lock b/example/pubspec.lock index d038cd1..7e66c71 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -531,7 +531,7 @@ packages: path: ".." relative: true source: path - version: "0.0.4" + version: "0.0.5" matcher: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index a490d27..e8a802a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -36,7 +36,7 @@ dependencies: cupertino_icons: ^1.0.9 magic: path: .. - version: 0.0.4 + version: 0.0.5 fluttersdk_artisan: ^0.0.8 dev_dependencies: diff --git a/pubspec.yaml b/pubspec.yaml index a3fe1a7..2591b89 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: magic description: "A Laravel-inspired Flutter framework with Eloquent ORM, routing, and MVC architecture." -version: 0.0.4 +version: 0.0.5 homepage: https://magic.fluttersdk.com repository: https://github.com/fluttersdk/magic issue_tracker: https://github.com/fluttersdk/magic/issues