Skip to content

Options for custom template files #1472

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

josh-hemphill
Copy link

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
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
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
Author

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

@noneall
Copy link

noneall commented Sep 29, 2023

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

@josh-hemphill
Copy link
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
Copy link

noneall commented Sep 29, 2023

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

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