-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to use custom T4 template when generating client code #273
Comments
Currently you can provide your own TemplateFactory and render your own code... but it cannot be used in the command line because there is no way to load external DLLs into the process and instantiate a template factory. However we could add a new cmd line parameters:
This way you can implement the template factory and then use it in the cmd line tool. |
Another option would be to use another template engine which can also compile/run templates at runtime, see #263 |
Your suggestion regarding additional cmd line parameters to provide own extension assembly with custom template factory type seems good to me, it should cover most cases that I can think of. |
Looks like even using NSwag not from command line it is not possible to use custom template, as I need pass into template's constructor instance ClientTemplateModel, which is internal :(
|
ClientTemplateModel and the other models will be public in the next version... |
Please write your own simple cmd line tool until this feature has been implemented. |
See #263 |
Currently I could not find ability to customize T4 template without using custom NSwag build and there are many cases when using base class or partial method does not cover the extensibility needs.
Swagger codegen allows to use custom templates, but it has other issues (java runtime :)
If it is not possible to use custom T4 template directly from command line, may be it would be possible to load compiled T4 template as dll and use it such way.
The text was updated successfully, but these errors were encountered: