ash-project / ash-project/ash

Code Generation

Open
#577 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Elixir
Stars
2.5k
Forks
422
Avg merge
15h 51m
Merged PRs (30d)
41

Description

**Problem Description**

I've found `mix phx.gen.auth` to be super helpful. Would be great to have code generation like this for Ash, to help reduce the time for new developers to create a working app.

**Desired Solution**

Maybe the best solution would be somehow tied to the Spark DSL builder. I could imagine passing the code generator a yaml file with an app spec. Maybe even a version control system that allows incremental generation, similar in concept to the migration generator.

**Describe alternatives you've considered**

For my own use, I wrote an Ash generator with tooling provided by `Mix.Generator`. You can see the code [here](https://github.com/andyl/mixtasks).

This is something I wrote fast as a proof of concept. It could be expanded, cleaned up for general distribution. But I think it would be possible for an experienced Ash dev to use the Ash tooling and create something more flexible and powerful.

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

As a new Ash developer, I'm not sure what would be the best approach.

**Additional context**

If anyone has suggestions on the optimal design for Ash Code Generation, post them here!

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked mixtasks proof of concept and the roles proposed for Mix.Generator and the Spark DSL builder. Clarify whether the resource syntax or resource interface should drive generation, and resolve the YAML and incremental-generation ideas. Done requires an agreed design and a general-purpose Ash generator scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.