Skip to content

Options for custom template files #1472

Open
josh-hemphill wants to merge 15 commits into
ferdikoomen:mainfrom
josh-hemphill:custom-templates
Open

Options for custom template files #1472
josh-hemphill wants to merge 15 commits into
ferdikoomen:mainfrom
josh-hemphill:custom-templates

Conversation

@josh-hemphill

Copy link
Copy Markdown

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

@josh-hemphill josh-hemphill changed the title Custom templates Options for custom template files Apr 11, 2023
@josh-hemphill

Copy link
Copy Markdown
Author

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

@josh-hemphill

Copy link
Copy Markdown
Author

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

@josh-hemphill

Copy link
Copy Markdown
Author

Woops, didn't mean to push those last two. I'll back those out.

@noneall

noneall commented Sep 29, 2023

Copy link
Copy Markdown

@josh-hemphill I'm curious if you have a sample how to work with these templates that you share?

@josh-hemphill

Copy link
Copy Markdown
Author

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.

@noneall

noneall commented Sep 29, 2023

Copy link
Copy Markdown

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.

nice, thank you Josh

@kmahlqvist

Copy link
Copy Markdown

I would love this!
Any way we can get it merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants