Add Dict and List sprig functions for template generation#1582
Add Dict and List sprig functions for template generation#1582deefdragon wants to merge 1 commit intooapi-codegen:mainfrom
Conversation
…m templates easier
|
Maybe we can also add support for string to integer conversion and vice-versa. This will help a lot with customization based on status code. Also is this PR ready, or still in draft? @deefdragon In case u are not getting time to wrap this up, maybe I can continue on finishing and adding more Template functions, as this seems to be a good change for better customization support for custom config templates. |
|
Also I feel it would be best to introduce strig as a dep to this project instead of us creating our own duplicate template functions. import "github.com/Masterminds/sprig/v3"
// ...
maps.Copy(TemplateFunctions, sprig.FuncMap())Edit: |
|
For now, since I need this change in my project, I'll fork this project. But I'd love it if these changes can get reviewed/approved 💯 |
|
@jamietanna Maybe you can help here. This PR has been open for a year now. Or maybe you have better ideas around this? |
|
Please feel free to take over. Unfortunately life has gotten in the way of me keeping up with the prs I have open, and my fork that just imports sprig as a dep has worked well enough for me that I've not had a push to work on this. |
|
U can close this one, if u aren't going to contribute anymore. |
This is a starter on what functions to add from the sprig template funcs. This resolves parts of #1536, as it provides atleast a starting point.
This is a draft for conformation that these are good. If this looks good, I will go through and add the appropriate tests as well as add documentation for the functions that are listed and the existing functions.
I think that I will add
failas well if there is no push to not do so. It would assist users id doing their own schema/extension validations IE #1554.