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 01:40:56 UTC
[cxf] 01/02: 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 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 07c15ddcbbc8c9443d3ca2ef296bceda28fb24f3
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)
(cherry picked from commit 840666d155ce5593801d1b9228e5bcf7f720eb7f)
# Conflicts:
# parent/pom.xml
---
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 f8718de..ce426f0 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>2.2.3.RELEASE</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 f68db89..3c60cce 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -202,7 +202,7 @@
<cxf.spring.security.version>5.3.11.RELEASE</cxf.spring.security.version>
<cxf.spring.version>5.2.17.RELEASE</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.6</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;
+ }
}