Skip to content
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 method of calling arbitrary user templates #1544

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

deefdragon
Copy link
Contributor

Adds an option to the generate options in the configuration yaml, allowing for defining what additional user-defined templates to call. Data passed to template is an object containing both the array of operations as passed to most other templates, and the raw openapi specification.

Resolves #1521

This is a draft for feedback reasons (should I include anything else to pass to the template, format the config options differently etc.), as well as I still need to test locally to confirm one or two things, and don't want it merged in until Ive tested that.

@deefdragon
Copy link
Contributor Author

Finally got around to doing the testing I wanted to do. Will get the merge conflicts resolved and mark as ready for review.

@deefdragon deefdragon marked this pull request as ready for review April 27, 2024 20:09
Copy link
Collaborator

@jamietanna jamietanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this - mind adding an example to examples/ to illustrate how it can be used?

@deefdragon
Copy link
Contributor Author

Added an example set that goes into a bit of detail on how to use the user-provided templates.

The one thing that I was reminded of as I was working on this is that the types array is generates in a different location, and not passed in anywhere in the ops array. Types is one of the things that is likely to be most useful in user template generation stuff, but I don't want to make this PR any larger.

Adding the types to the provided struct would require code changes in other areas to pipe the type array up, and adding more data to the passed in object like that can be done over time.

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

Successfully merging this pull request may close these issues.

Generate code from custom templates
2 participants