feat!: use jinja for templating#13
Open
seblyng wants to merge 15 commits into
Open
Conversation
Swap out our own implementation of substitution with something a lot more powerful like jinja
seblyng
commented
Mar 17, 2026
| Empty, | ||
| Preview(String), | ||
| Request(HttpRequestInfo), | ||
| Request(Box<HttpRequestInfo>), |
Contributor
Author
There was a problem hiding this comment.
This was a clippy lint if you wondered
1. clippy: large size difference between variants
for further information visit https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#large_enum_variant
`#[warn(clippy::large_enum_variant)]` on by default [large_enum_variant]
output.rs:61:5: the largest variant contains at least 328 bytes
output.rs:60:5: the second-largest variant contains at least 24 bytes
output.rs:61:13: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum: `Box<HttpRequestInfo>`
Only place where it is used, so belong more in there than in substitute.rs
We are never setting fallback to anything other than `None`, so the code was essentially dead. Remove it. Jinja handles fallback itself
Need a way to define if we are selecting one or multiple values from a list. We can add custom filters to jinja!
Avoid inlining method just for the sake of it. Make diff a bit smaller and easier to look at
seblyng
commented
Mar 18, 2026
| "title": "Found a bug", | ||
| "body": "I'm having a problem with this.", | ||
| "labels": [ {{ label[, ]["] }} ], | ||
| "labels": ["{{ label | select_multiple | join('", "') }}"], |
Contributor
Author
There was a problem hiding this comment.
We now have something very powerful like jinja (if we merge this), and we can potentially avoid some hardcoded restrictions we have. For example, we have a requirement now for a list to be like this:
[[label]]
name = "foo"
value = "foo"
[[label]]
name = "bar"
value = "bar"
So name and value keys.
I propose that we at least keep it like this for this PR to make the scope a bit smaller, and then potentially do another breaking change if we want.
We can avoid to "map" it internally (like we do in for example the list_option_to_string and other places) and instead just do it like this in the template:
["{{ label | select_multiple | map(attribute="value") | join('", "') }}"]
I haven't thought about potential pitfalls with this though
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI-assisted🤖
Seems to work but I want to look through the code myself as well.
Should also decide if we want to do this since it will be a breaking change.
I am perfectly fine with this since it is probably only us who are using this. We can also just implement something super simple or just ask AI to convert all the old potential http files to use the new syntax. I would expect that to be very easy