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 2023/03/31 15:25:37 UTC

[camel] branch camel-3.x updated: CAMEL-19231: Default REST DSL type in camel-jbang generator (#9736)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.x by this push:
     new d05e30f4400 CAMEL-19231: Default REST DSL type in camel-jbang generator (#9736)
d05e30f4400 is described below

commit d05e30f44008786d60c6f151346e745860571754
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Fri Mar 31 11:25:29 2023 -0400

    CAMEL-19231: Default REST DSL type in camel-jbang generator (#9736)
    
    * Implements CAMEL-19231
    
    * Format imports
---
 .../org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java
index 2da2829ef68..31431befa54 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java
@@ -50,7 +50,7 @@ public class CodeRestGenerator extends CamelCommand {
     private String input;
     @CommandLine.Option(names = { "-o", "--output" }, description = "Output REST DSL file name")
     private String output;
-    @CommandLine.Option(names = { "-t", "--type" }, description = "REST DSL type (YAML or XML)")
+    @CommandLine.Option(names = { "-t", "--type" }, description = "REST DSL type (YAML or XML)", defaultValue = "yaml")
     private String type;
     @CommandLine.Option(names = { "-r", "--routes" }, description = "Generate routes (YAML)")
     private boolean generateRoutes;
@@ -73,9 +73,9 @@ public class CodeRestGenerator extends CamelCommand {
         Configurator.setRootLevel(Level.OFF);
         try (CamelContext context = new LightweightCamelContext()) {
             String text = null;
-            if (type.equalsIgnoreCase("yaml")) {
+            if ("yaml".equalsIgnoreCase(type)) {
                 text = RestDslGenerator.toYaml(document).generate(context, generateRoutes);
-            } else if (type.equalsIgnoreCase("xml")) {
+            } else if ("xml".equalsIgnoreCase(type)) {
                 text = RestDslGenerator.toXml(document).generate(context);
             }
             if (text != null) {