-
Notifications
You must be signed in to change notification settings - Fork 2
fix(zfa make): always generate data repo impl + wire per-method DI for entity presets (#284) #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,7 +101,19 @@ class DiPlugin extends FileGeneratorPlugin implements CliAwarePlugin { | |
| force: context.core.force, | ||
| verbose: context.core.verbose, | ||
| revert: context.core.revert, | ||
| methods: context.data['methods']?.cast<String>().toList() ?? [], | ||
| // #284: Apply the same entity-methods default the usecase/repository | ||
| // plugins use, so DI sees `isEntityBased=true` for canonical | ||
| // `zfa make Product --preset=crud` invocations and routes to | ||
| // _generateEntityUseCaseDIFiles (per-method DI files matching the | ||
| // per-method usecases the usecase plugin emits). Without this default, | ||
| // DI falls into the _generateCustomUseCaseDI branch and emits | ||
| // `product_usecase_di.dart` referencing a `ProductUseCase` | ||
| // class that is never generated, breaking the build. | ||
| methods: | ||
| context.data['methods']?.cast<String>().toList() ?? | ||
| (context.get<bool>('no-entity') == true | ||
| ? [] | ||
| : ['get', 'update', 'toggle']), | ||
|
Comment on lines
+104
to
+116
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Keep the default method contract consistent with downstream allowlists. Both changed defaults advertise
This is required for the PR objective that default 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| domain: context.data['domain'], | ||
| repo: context.data['repo'], | ||
| service: context.data['service'], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Build the entity import from
config.nameSnake.Line 77 uses
domainSnakefor both the entity directory and file name. Ifdomaindiffers from the entity name, aProductcontroller can importdomain/entities/catalog/catalog.dartinstead ofdomain/entities/product/product.dart.ProductPatchandProductFieldsthen remain unresolved.Use
config.nameSnakefor the entity directory and file name.Proposed fix
Based on learnings, the fixed v5 entity layout is
lib/src/domain/entities/{entity_snake}/{entity_snake}.dart, for examplelib/src/domain/entities/product/product.dart.📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Learnings