You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/09/27 00:37:39 UTC

[cxf] branch master updated: CXF-8600: Swagger2Feature : Upgrade SwaggerUiConfig to add more configs (tryItOutEnabled) (#856)

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

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 840666d  CXF-8600: Swagger2Feature : Upgrade SwaggerUiConfig to add more configs (tryItOutEnabled) (#856)
840666d is described below

commit 840666d155ce5593801d1b9228e5bcf7f720eb7f
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sun Sep 26 20:37:31 2021 -0400

    CXF-8600: Swagger2Feature : Upgrade SwaggerUiConfig to add more configs (tryItOutEnabled) (#856)
---
 distribution/src/main/release/samples/pom.xml            |  2 +-
 parent/pom.xml                                           |  2 +-
 .../org/apache/cxf/jaxrs/swagger/ui/SwaggerUiConfig.java | 16 ++++++++++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/distribution/src/main/release/samples/pom.xml b/distribution/src/main/release/samples/pom.xml
index cfbbca5..36491d8 100644
--- a/distribution/src/main/release/samples/pom.xml
+++ b/distribution/src/main/release/samples/pom.xml
@@ -34,7 +34,7 @@
         <spring.cloud.eureka.version>3.0.3</spring.cloud.eureka.version>
         <cxf.jetty9.version>9.4.43.v20210629</cxf.jetty9.version>
         <cxf.httpcomponents.client.version>4.5.13</cxf.httpcomponents.client.version>
-        <cxf.swagger.ui.version>3.38.0</cxf.swagger.ui.version>
+        <cxf.swagger.ui.version>3.52.1</cxf.swagger.ui.version>
         <cxf.tika.version>1.27</cxf.tika.version>
         <cxf.tomcat.version>9.0.53</cxf.tomcat.version>
         <graalvm.version>21.1.0</graalvm.version>
diff --git a/parent/pom.xml b/parent/pom.xml
index c16d65a..923fcc2 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -201,7 +201,7 @@
         <cxf.spring.security.version>5.5.2</cxf.spring.security.version>
         <cxf.spring.version>5.3.10</cxf.spring.version>
         <cxf.stax-ex.version>1.8.3</cxf.stax-ex.version>
-        <cxf.swagger.ui.version>3.38.0</cxf.swagger.ui.version>
+        <cxf.swagger.ui.version>3.52.1</cxf.swagger.ui.version>
         <cxf.swagger.v3.version>2.1.9</cxf.swagger.v3.version>
         <cxf.swagger2.version>1.6.2</cxf.swagger2.version>
         <cxf.swagger2.guava.version>27.0-jre</cxf.swagger2.guava.version>
diff --git a/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/ui/SwaggerUiConfig.java b/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/ui/SwaggerUiConfig.java
index 10d802a..940bdbd 100644
--- a/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/ui/SwaggerUiConfig.java
+++ b/rt/rs/description-swagger-ui/src/main/java/org/apache/cxf/jaxrs/swagger/ui/SwaggerUiConfig.java
@@ -61,6 +61,8 @@ public class SwaggerUiConfig {
     private Boolean showCommonExtensions;
     // Set a different validator URL, for example for locally deployed validators
     private String validatorUrl;
+    // Controls whether the "Try it out" section should be enabled by default.
+    private Boolean tryItOutEnabled;
     
     public String getConfigUrl() {
         return configUrl;
@@ -245,6 +247,11 @@ public class SwaggerUiConfig {
         return this;
     }
 
+    public SwaggerUiConfig tryItOutEnabled(boolean tryItOut) {
+        setTryItOutEnabled(tryItOut);
+        return this;
+    }
+
     public Map<String, String> getConfigParameters() {
         final Map<String, String> params = new TreeMap<>();
         
@@ -262,6 +269,7 @@ public class SwaggerUiConfig {
         put("showExtensions", getShowExtensions(), params);
         put("showCommonExtensions", getShowCommonExtensions(), params);
         put("validatorUrl", getValidatorUrl(), params);
+        put("tryItOutEnabled", isTryItOutEnabled(), params);
 
         return params;
     }
@@ -283,4 +291,12 @@ public class SwaggerUiConfig {
             params.put(name, value);
         }
     }
+
+    public Boolean isTryItOutEnabled() {
+        return tryItOutEnabled;
+    }
+
+    public void setTryItOutEnabled(Boolean tryItOutEnabled) {
+        this.tryItOutEnabled = tryItOutEnabled;
+    }
 }