fix: allow {basename} in template file-refs with different extensions and resolve Qute {#include} for remote catalogs - #2646
Open
maxandersen wants to merge 2 commits into
Conversation
Split extension validation from placeholder substitution in Init:
- validateTemplateExtension() checks the primary entry only (first
{filename}, or first {basename} if no {filename} exists)
- resolveBaseName() now only does substitution, no validation
This allows templates like:
{filename}=src.java.qute
prefixed-{basename}.tf=infra.tf.qute
where the .tf file uses {basename} without triggering an extension
mismatch error.
Fixes jbangdev#1318
Contributor
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The Qute template engine's locate() callback could not resolve relative
{#include} paths (e.g. {#include aws/header.java.qute /}) when the
template came from a remote catalog. The locate() method only tried
ResourceRef.forResource() which doesn't know the catalog's base URL.
Fix: pass the catalog-aware ResourceResolver into TemplateEngine so
locate() can resolve relative paths against the catalog base URL during
template rendering.
maxandersen
force-pushed
the
1318-basename-in-template-file-refs
branch
from
August 23, 2026 22:41
6f936a4 to
76bf3fb
Compare
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.
Supersedes #1319 (stale since 2022, could not be rebased).
Changes
1. Allow
{basename}in template file-refs with different extensions (fixes #1318)Splits extension validation from placeholder substitution in
Init:validateTemplateExtension()checks the primary entry only (first{filename}, or first{basename}if no{filename}exists)resolveBaseName()now only does substitution, no validationThis allows templates like:
where the
.tffile uses{basename}without triggering an extension mismatch error.Addresses the review feedback from @quintesse on #1319 — validates at least the primary entry, while allowing other
{basename}entries to use any extension.2. Resolve Qute
{#include}directives in remote catalog templatesThe Qute template engine's
locate()callback could not resolve relative{#include}paths (e.g.{#include aws/header.java.qute /}) when the template came from a remote catalog — it only triedResourceRef.forResource()which doesn't know the catalog's base URL.Fix: pass the catalog-aware
ResourceResolverintoTemplateEnginesolocate()can resolve relative paths against the catalog base URL during template rendering.Verified working with
jbang init -t=q-aws-lambda-tf@nandorholozsnyak/jbang-cloud wonka.java.