ash icon indicating copy to clipboard operation
ash copied to clipboard

Mix Task for resource generation (similar to mix phx.gen)

Open arosenb2 opened this issue 1 year ago • 1 comments

Describe the solution you'd like

[https://fly.io/phoenix-files/customizing-phoenix-generators/](Customizing Phoenix Generators) shows how to create custom templates to act as overrides to default generators from Phoenix mix tasks. It would be nice to generate a resource from the command line similar to how it can be done for Ecto schemas in traditional Phoenix projects.

Describe alternatives you've considered

Please close if this is already available. I haven't looked at all the CLI options provided, but I don't recall any resource generator tasks.

Express the feature either with a change to resource syntax, or with a change to the resource interface

 mix ash.gen.resource Foo id:uuid title:string

Additional context

Many other decisions go into resource modeling but this could help remove some of the "getting started" pain.

arosenb2 avatar Jan 17 '24 15:01 arosenb2

👋 There is currently a pull request for this which I've provided some feedback on but it's not been wrapped up yet. I'd like to have a better overall generator story with 3.0 as well, but it may have to come after 3.0 releases.

zachdaniel avatar Jan 17 '24 15:01 zachdaniel

I'll close this issue since mix ash.gen.resource is available. Thanks for adding it!

arosenb2 avatar Aug 30 '24 18:08 arosenb2