toolbox
toolbox copied to clipboard
Automatic code generation for Fluent
It would be great to enhance vapor cli to add something similar to phx.gen, ie automatic code generator for model and controller based on a quick model description.
http://www.phoenixframework.org/docs/ecto-models
At least the phx.gen.api side at first would be useful. (their documentation isn't up to date, it's now called phx.gen.api instead of phoenix.gen.api)
I think this could be done step by step as they did: https://hexdocs.pm/phoenix/Mix.Tasks.Phoenix.Gen.Model.html
-
Simple Model generator vapor gen.fluentmodel User name:string age:integer
-
Model generator with references vapor gen.fluentmodel Post title user_id:references:User
-
JSON-api generator vapor gen.jsonapi Post title user_id:references:User
-
Leaf generator vapor gen.leafhtml User name:string age:integer
Obsolete thanks to Codable?
Although this might not be what you want, but we recently created this repo for sharing our sourcery templates for faster scaffolding of Vapor code: https://github.com/nodes-vapor/sourcery-templates
Sorry for the lack of documentation at this point.
Could you precise what you mean? That thanks to Codable, we can hope for things like automatic REST api for databases and such? This can be good. But templates would be useful too.
On 18 September 2017 at 17:43, Joannis Orlandos [email protected] wrote:
Obsolete thanks to Codable?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vapor/toolbox/issues/176#issuecomment-330264553, or mute the thread https://github.com/notifications/unsubscribe-auth/AACIKaw-LyvskMhhW5REPOYMp6_ZyEh2ks5sjo-fgaJpZM4NmsaY .
@brunobl most of this can be easily taken over using Swift 4's Codables. They generate boilerplate code for your database, JSON and other models.
Closing as a dupe of #397