Options for custom template files
Needed something similar to #1268 and decided to create a PR that provides for custom templates for the three main code bits I think anyone would want to replace.
Adds:
--serviceTemplate <value> Path to custom service handlebars template to generate the service files
--clientTemplate <value> Path to custom client handlebars template to generate the client file
--indexTemplate <value> Path to custom index handlebars template to generate the index file
@ferdikoomen I think I've got this working well. I've used my fork for some stuff already. Don't know if more templates might be commonly needed enough that they should be in this PR, please let me know if you'd like me to add more.
@ferdikoomen Do you have any feedback or comments on this, I'd like to know if this is something you'd be interested in merging in some form, since some of my teams are already using my fork, and I don't want to forget about this and accidentally leave my fork in for someone else to have to deal with years later. 😜
Woops, didn't mean to push those last two. I'll back those out.
@josh-hemphill I'm curious if you have a sample how to work with these templates that you share?
Sure, I've created gists of the template files I've used with trying to generate reactive VueUse useFetch bindings: https://gist.github.com/josh-hemphill/c6b45fad353e82548e27079b59348469
My useFetchPolyfill import is just a copy of VueUse's useFetch code with some modifications since I didn't like how it handled errors. And the the util imports are pretty self explanatory, I think I just pieced those together by slightly deviating from what openapi-typescript-codegen usually does.
Sure, I've created gists of the template files I've used with trying to generate reactive VueUse
useFetchbindings: https://gist.github.com/josh-hemphill/c6b45fad353e82548e27079b59348469 MyuseFetchPolyfillimport is just a copy of VueUse'suseFetchcode with some modifications since I didn't like how it handled errors. And the the util imports are pretty self explanatory, I think I just pieced those together by slightly deviating from whatopenapi-typescript-codegenusually does.
nice, thank you Josh
I would love this! Any way we can get it merged?