You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/01/10 09:03:36 UTC
(camel) branch camel-4.14.x updated: CAMEL-22833: camel-jbang - Yaml DSL file with only templatedRoute is not loaded
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.14.x by this push:
new 8281874a2011 CAMEL-22833: camel-jbang - Yaml DSL file with only templatedRoute is not loaded
8281874a2011 is described below
commit 8281874a20111f61211b9bd67eefb9253b09de79
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 10 10:02:21 2026 +0100
CAMEL-22833: camel-jbang - Yaml DSL file with only templatedRoute is not loaded
---
.../apache/camel/dsl/jbang/core/commands/Run.java | 24 ++++++++++++----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index b4f60bd8e560..2010106286d9 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -102,6 +102,18 @@ public class Run extends CamelCommand {
private static final Set<String> ACCEPTED_XML_ROOT_ELEMENTS
= new HashSet<>(Arrays.asList(ACCEPTED_XML_ROOT_ELEMENT_NAMES));
+ private static final String[] ACCEPTED_YAML_ROOT_ELEMENT_NAMES = new String[] {
+ "- from:", "- route:",
+ "- routeTemplate:", "- route-template:",
+ "- templatedRoute:", "templated-route:",
+ "- routeConfiguration:", "- route-configuration:",
+ "- rest:", "- beans:",
+ "Pipe" // special for camel-k pipe
+ };
+
+ private static final Set<String> ACCEPTED_YAML_ROOT_ELEMENTS
+ = new HashSet<>(Arrays.asList(ACCEPTED_YAML_ROOT_ELEMENT_NAMES));
+
private static final String OPENAPI_GENERATED_FILE = CommandLineHelper.CAMEL_JBANG_WORK_DIR + "/generated-openapi.yaml";
private static final String CLIPBOARD_GENERATED_FILE = CommandLineHelper.CAMEL_JBANG_WORK_DIR + "/generated-clipboard";
@@ -1871,17 +1883,7 @@ public class Run extends CamelCommand {
}
return ACCEPTED_XML_ROOT_ELEMENTS.contains(info.getRootElementName());
} else {
- // TODO: we probably need a way to parse the content and match against the YAML DSL expected by Camel
- // This check looks very fragile
- return source.content().contains("- from:")
- || source.content().contains("- route:")
- || source.content().contains("- routeTemplate") || source.content().contains("- route-template:")
- || source.content().contains("- routeConfiguration:")
- || source.content().contains("- route-configuration:")
- || source.content().contains("- rest:")
- || source.content().contains("- beans:")
- // also support Pipes.
- || source.content().contains("Pipe");
+ return ACCEPTED_YAML_ROOT_ELEMENTS.stream().anyMatch(tag -> source.content().contains(tag));
}
}
// if the ext is an accepted file then we include it as a potential route