Add template overrides from files in new config#653
Add template overrides from files in new config#653jacklee1792 wants to merge 2 commits intooapi-codegen:masterfrom
Conversation
|
Replacing the templates in the startup seems to break the template functions for me. I've tested overriding the templates in |
|
@Celant Interesting, do you know why moving the overrides to In any case I think your solution is better, feel free to open a PR for your fork. I'll close mine once yours is up. |
|
@Celant hey mate, can you make a release for your branch, please? I heavily relied on template overriding in my project. Thanks! |
|
any plans on moving this PR forward? |
|
Liking this functionality, allows for individual templates to be picked from different directories or file names. That said its still not as easy to use as I just submitted #852 as having to have go .tmpl files in a .yaml file really isn't usable. It restores compatibility with the old command switches which still have their place. With all this in mind would you consider adding a |
stevenh
left a comment
There was a problem hiding this comment.
Some style comments below, but in addition to this I would move this into the codegen package so it works for uses of that and not just oapi-codegen command line.
d70b518 to
b031c5b
Compare
|
In the latest commits I've combined ideas from master...Celant:oapi-codegen:feat/user-template-files together with #707. Template overrides can now be specified by any of the following, in order of lowest to highest precedence:
|
|
Hey @jamietanna @deepmap-marcinr, are there any plans to move forward with this PR or to provide custom template functionality some other way? As it is right now custom templates are basically unusable without either providing them inline in the config file or writing a custom wrapper around |
|
This PR is incredibly useful. Thanks @jacklee1792 |
I would love to see some love or activity on this PR. It is a pretty useful feature. |
|
Apologies on the delay with this one folks! Will try and get a look at it for the next release - would it be possible to get this branch up-to-date with the current state of the repo? 🙏 |
@jamietanna In rebasing I found #968 already allows loading from files, this PR doesn't do much more than adding another option to load from a directory instead of specifying the file mapping one-by-one. So feel free to close! |
|
Interesting, thanks for letting me know! Appreciate the work (and apologies for the delay) with this one. |
Closes #607.
This PR introduces template file overrides from filenames. Overrides listed in
output-options.user-template-fileswill just override whatever is given byoutput-options.user-templates, so this doesn't break any existing configuration files.Example usage: