toolbox icon indicating copy to clipboard operation
toolbox copied to clipboard

Automatic code generation for Fluent

Open brunobl opened this issue 8 years ago • 5 comments

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)

brunobl avatar May 25 '17 18:05 brunobl

I think this could be done step by step as they did: https://hexdocs.pm/phoenix/Mix.Tasks.Phoenix.Gen.Model.html

  1. Simple Model generator vapor gen.fluentmodel User name:string age:integer

  2. Model generator with references vapor gen.fluentmodel Post title user_id:references:User

  3. JSON-api generator vapor gen.jsonapi Post title user_id:references:User

  4. Leaf generator vapor gen.leafhtml User name:string age:integer

brunobl avatar May 27 '17 10:05 brunobl

Obsolete thanks to Codable?

Joannis avatar Sep 18 '17 15:09 Joannis

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.

steffendsommer avatar Sep 19 '17 07:09 steffendsommer

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 avatar Sep 23 '17 08:09 brunobl

@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.

Joannis avatar Sep 23 '17 09:09 Joannis

Closing as a dupe of #397

0xTim avatar Jan 25 '24 12:01 0xTim