ash-project / spark

Tooling for building DSLs in Elixir
MIT License
105 stars 23 forks source link

[Question] Where do I start? #13

Closed alissonfpmorais closed 1 year ago

alissonfpmorais commented 1 year ago

First of all, congratulations for the whole Ash's family of projects.

Reading about Spark looks very promising to me and I'm tempted to give a try. I looked for some examples, but couldn't find any besides Ash itself. Ash is definitely great, but there are a couple of files using Spark and I'm not really sure what to look for.

So, what would be a good starting point? Any specific Ash's project file or maybe a demo project?

Thanks in advance!

zachdaniel commented 1 year ago

Hey there! Since spark was originally inside of Ash, it unfortunately hasn't gotten its own great documentation setup even though we've extracted it out.. We'd love to change this over time. For now, the best place to look at how to work with spark is to look at Ash and some of the ash extensions that are out there.

The big pieces:

The definition of what we call a "Spark", which is the core of the DSLS. I could link to Ash.Resource but that is got a lot of cruft. Instead, I'll link you to Ash.Registry, which is a simple DSL for storing a compile time list of modules: https://github.com/ash-project/ash/blob/main/lib/ash/registry/dsl.ex

By default, no DSL exists for a Spark. Instead, you attach default extensions, as in the above. The simple DSL extension for Ash.Registry can be found here: https://github.com/ash-project/ash/blob/main/lib/ash/registry/dsl.ex.

Additionally, there is a small extension you can add to the registry to perform some ash specific validations: https://github.com/ash-project/ash/blob/main/lib/ash/registry/extensions/resource_validations/resource_validations.ex

Finally, there is the introspection module, where you can get all of the information out: https://github.com/ash-project/ash/blob/main/lib/ash/registry/info.ex

I unfortunately don't have too much time to write in depth spark documentation, but I think this project has a lot of potential to be useful for others so I'd love to see the community contribute on that front, and I will support where I can. Additionally, we have more interesting features coming soon, like the automatic generation of introspection modules so you don't have to hand write it yourself.

zachdaniel commented 1 year ago

I'll leave this issue open for a while to allow for conversation.