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/04/05 07:39:43 UTC

[camel] branch main updated: CAMEL-19231: Default REST DSL type in camel-jbang generator

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 2d5757d8bc5 CAMEL-19231: Default REST DSL type in camel-jbang generator
2d5757d8bc5 is described below

commit 2d5757d8bc58a621028b214c197c49bc15d538c4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Apr 5 09:39:32 2023 +0200

    CAMEL-19231: Default REST DSL type in camel-jbang generator
---
 .../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) {