Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

feat: Ability to override built-in generators #835

Closed
josegonzalez opened this issue Jan 8, 2018 · 4 comments
Closed

feat: Ability to override built-in generators #835

josegonzalez opened this issue Jan 8, 2018 · 4 comments

Comments

@josegonzalez
Copy link
Contributor

It would be great to build an application and ship a set of generators with that application. An example use-case might be automatically generating json-api compatible resources.

Note that you'd want to support multiple generator "skeletons", so something like the following for an application structure might work:

/
/generators/skeletons
/generators/skeletons/json-api/files/go/here

Then usage would be like so:

--skeleton json-api

Skeletons would be installed within the application code, and would not be shared from any other golang application namespace.

Optionally, Buffalo could also follow the same spec, and would use the default skeleton name. When grabbing a template, if a user overrode the template in their own app-local default skeleton, then you would respect that decision.

@stanislas-m
Copy link
Member

Hum, I'm not fan of having an override like that. The problem with that approach, is that we loose control on the generation templates: the users can override the way they like. When we'll have to remove or change a variable in the generator, it'll break some setups we can't test. It also makes the debug difficult, for the same reasons.

I understand what you mean though. Using a custom Buffalo plugin can be an option for your use case.

@josegonzalez
Copy link
Contributor Author

An option for that would be to build objects that you send into the templates. Then you'd have a "contract" on what that object provides, but can change the underlying implementation at will. Doesn't really fix things though.

@github-actions
Copy link

github-actions bot commented Aug 7, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants