ash-project / spark

Tooling for building DSLs in Elixir
MIT License
127 stars 25 forks source link

fix: ensure atom before check compiled #99

Closed rapidfsub closed 3 months ago

rapidfsub commented 3 months ago

We have something like

defmodule MyApp.Post do
  use MyApp.Resource, comment: "blah blah"
end

and the "blah blah" is passed as an extension to spark formatter. so before calling Code.ensure_compiled/1, is_atom/1 or any other type validation should be performed, I think.

rapidfsub commented 3 months ago

+ I have a question about spark. How can I configure section order for my own Spark.Dsl.Extension?

zachdaniel commented 3 months ago

🚀 Thank you for your contribution! 🚀

zachdaniel commented 3 months ago

All sections are configured by the end-user in the same place, in the entity configuration. i.e

configure :spark, :formatter,
  "Ash.Resource": [
    section_order: [....]
  ]

So you or any users of your extension would need to put the sections in that section_order list.