Add method of calling arbitrary user templates
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 https://github.com/deepmap/oapi-codegen/issues/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.
Finally got around to doing the testing I wanted to do. Will get the merge conflicts resolved and mark as ready for review.
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.
@jamietanna Is the awaiting reply tag supposed to auto-remove? And or was there anything else you would like me to change about this?
I have a use case for this PR right now. I need to have the same code in every method of the StrictServerInterface implementation.
I want to generate a struct, that wraps server implementation and adds tracing and validation code to each method
I'll take a look tonight to update the Readme and see if there is anything else I need to do for the docs.