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 2025/07/09 09:53:36 UTC

(camel) branch main updated: camel-jbang: Fix TODO

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 c72072524cb camel-jbang: Fix TODO
c72072524cb is described below

commit c72072524cb6b4d332d8f3245553e66250d4529a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jul 9 11:53:22 2025 +0200

    camel-jbang: Fix TODO
---
 .../core/commands/generate/CodeSchemaGenerator.java     | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-plugin-generate/src/main/java/org/apache/camel/dsl/jbang/core/commands/generate/CodeSchemaGenerator.java b/dsl/camel-jbang/camel-jbang-plugin-generate/src/main/java/org/apache/camel/dsl/jbang/core/commands/generate/CodeSchemaGenerator.java
index c09b65bfd75..2a2c944a857 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-generate/src/main/java/org/apache/camel/dsl/jbang/core/commands/generate/CodeSchemaGenerator.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-generate/src/main/java/org/apache/camel/dsl/jbang/core/commands/generate/CodeSchemaGenerator.java
@@ -28,6 +28,7 @@ import com.github.victools.jsonschema.generator.SchemaGeneratorConfig;
 import com.github.victools.jsonschema.generator.SchemaGeneratorConfigBuilder;
 import com.github.victools.jsonschema.generator.SchemaVersion;
 import com.github.victools.jsonschema.module.jackson.JacksonModule;
+import org.apache.camel.catalog.DefaultCamelCatalog;
 import org.apache.camel.dsl.jbang.core.commands.CamelCommand;
 import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
 import org.apache.camel.main.download.DependencyDownloaderClassLoader;
@@ -61,8 +62,8 @@ public class CodeSchemaGenerator extends CamelCommand {
     private String fullyQualifiedName;
 
     @CommandLine.Option(names = { "--camel-version" },
-                        description = "Camel version to use (default: 4.12.0)")
-    private String camelVersion = "4.12.0"; // TODO get current version
+                        description = "Camel version to use")
+    private String camelVersion;
 
     @CommandLine.Option(names = { "--output" },
                         description = "Output file path (default: stdout)")
@@ -70,12 +71,16 @@ public class CodeSchemaGenerator extends CamelCommand {
 
     @CommandLine.Option(names = { "--verbose" },
                         description = "Enable verbose logging")
-    private boolean verbose = false;
+    private boolean verbose;
 
     @CommandLine.Option(names = { "--download" }, defaultValue = "true",
                         description = "Whether to allow automatic downloading JAR dependencies (over the internet)")
     boolean download = true;
 
+    @CommandLine.Option(names = { "--repos" },
+                        description = "Additional maven repositories (Use commas to separate multiple repositories)")
+    String repositories;
+
     public CodeSchemaGenerator(CamelJBangMain main) {
         super(main);
     }
@@ -83,8 +88,11 @@ public class CodeSchemaGenerator extends CamelCommand {
     @Override
     public Integer doCall() throws Exception {
         try {
-            if (verbose) {
+            if (camelVersion == null) {
+                camelVersion = new DefaultCamelCatalog().getCatalogVersion();
+            }
 
+            if (verbose) {
                 printer().println("Generating JSON Schema for component: " + camelComponent);
                 printer().println("Class: " + fullyQualifiedName);
                 printer().println("Camel version: " + camelVersion);
@@ -190,6 +198,7 @@ public class CodeSchemaGenerator extends CamelCommand {
             MavenDependencyDownloader downloader = new MavenDependencyDownloader();
             downloader.setClassLoader(cl);
             downloader.setDownload(download);
+            downloader.setRepositories(repositories);
             downloader.start();
 
             if (verbose) {