I want to generate my phoenix scaffolding from a uml or textual model rather than from command line, is there a way to do it -
There are some options:
1 - a [text] bash script or otherwise to generate the scaffolding
2 - write a code generator to input the UML/text and generate source code files
3 - read the UML file during compilation and generate the code using metaprogramming.
Neither of these sound worthwhile to me, but you might have a use case that would make such an approach sensible
Do you mean you’d rather not use mix? I’m not quite following your question to be honest.
Thanks for replies Onor and Talkat , I can use mix but my requirement is something like this -
I should be able to generate and regenerate from a text file like the following -
Customer{
firstName:String
lastName:String
}
Order{
customer:Customer references Customer
orderItems:OrderItem contains many
}
…
If you’re building a text file of that sort would it be that much more work to create a DDL representation of it? I mean you’re almost giving a SQL definition of the table layout–maybe just spend a little more time and create a SQL script?
DDL is not as expressive as a real DSL for instance I can specify complex
validation statements within my text file, hope you can see the point -
Mongoose for instance provides a DSL for the mongo database , similary we
should have one for phoenix but one that is a lot richer than DDL
As far as I know you can specify relatively complex validation via DDL as well. Check constraints can go a long way toward bounding the data which can be entered into a column. I’m not sure I see a lot of gain for the amount of work which would be required to create a DSL for Phoenix because any DSL would probably just be a superset of DDL anyway.