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:18 UTC
(camel) branch main 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 main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 77864a152eac CAMEL-22833: camel-jbang - Yaml DSL file with only templatedRoute is not loaded
77864a152eac is described below
commit 77864a152eacbde4d548d6221a86dbef70c1ed45
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 46bf8c9a5bd2..c128e3ee4802 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
@@ -103,6 +103,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";
@@ -1930,17 +1942,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