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

sergeyb 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 1503b42  [CXF-7525] Introducing OpenApiConfiguration to be able to 
customize the conversion process
1503b42 is described below

commit 1503b428b353697b51c4c98c704651ed8208d62b
Author: Sergey Beryozkin <sberyoz...@gmail.com>
AuthorDate: Thu Dec 7 14:00:04 2017 +0000

    [CXF-7525] Introducing OpenApiConfiguration to be able to customize the 
conversion process
---
 .../swagger/openapi/OpenApiConfiguration.java      | 31 ++++++++++++++++++++++
 .../jaxrs/swagger/openapi/SwaggerOpenApiUtils.java | 21 ++++++++++++---
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git 
a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/OpenApiConfiguration.java
 
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/OpenApiConfiguration.java
new file mode 100644
index 0000000..c0f2256
--- /dev/null
+++ 
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/OpenApiConfiguration.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxrs.swagger.openapi;
+
+public class OpenApiConfiguration {
+    private boolean createRequestBodies;
+
+    public boolean isCreateRequestBodies() {
+        return createRequestBodies;
+    }
+
+    public void setCreateRequestBodies(boolean createRequestBodies) {
+        this.createRequestBodies = createRequestBodies;
+    }
+}
diff --git 
a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerOpenApiUtils.java
 
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerOpenApiUtils.java
index 13d2ced..f8d5051 100644
--- 
a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerOpenApiUtils.java
+++ 
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/openapi/SwaggerOpenApiUtils.java
@@ -49,15 +49,20 @@ public final class SwaggerOpenApiUtils {
     }
     
     public static String getOpenApiFromSwaggerLoc(String loc) {
-        return getOpenApiFromSwaggerLoc(loc, BusFactory.getThreadDefaultBus());
+        return getOpenApiFromSwaggerLoc(loc, null);
     }
-    public static String getOpenApiFromSwaggerLoc(String loc, Bus bus) {
+    
+    public static String getOpenApiFromSwaggerLoc(String loc, 
OpenApiConfiguration cfg) {
+        return getOpenApiFromSwaggerLoc(loc, cfg, 
BusFactory.getThreadDefaultBus());
+    }
+    
+    public static String getOpenApiFromSwaggerLoc(String loc, 
OpenApiConfiguration cfg, Bus bus) {
         try {
             InputStream is = ResourceUtils.getResourceStream(loc, bus);
             if (is == null) {
                 return null;
             }
-            return getOpenApiFromSwaggerStream(is);
+            return getOpenApiFromSwaggerStream(is, cfg);
         } catch (Exception ex) {
             LOG.warning("Problem with processing a user model at " + loc);
         }
@@ -65,10 +70,18 @@ public final class SwaggerOpenApiUtils {
     }
     
     public static String getOpenApiFromSwaggerStream(InputStream is) throws 
IOException {
-        return getOpenApiFromSwaggerJson(IOUtils.readStringFromStream(is));
+        return getOpenApiFromSwaggerStream(is, null);
+    }
+    
+    public static String getOpenApiFromSwaggerStream(InputStream is, 
OpenApiConfiguration cfg) throws IOException {
+        return getOpenApiFromSwaggerJson(IOUtils.readStringFromStream(is), 
cfg);
     }
     
     public static String getOpenApiFromSwaggerJson(String json) throws 
IOException {
+        return getOpenApiFromSwaggerJson(json, null);
+    }
+    
+    public static String getOpenApiFromSwaggerJson(String json, 
OpenApiConfiguration cfg) throws IOException {
         JsonMapObjectReaderWriter readerWriter = new 
JsonMapObjectReaderWriter();
         JsonMapObject sw2 = readerWriter.fromJsonToJsonObject(json);
         JsonMapObject sw3 = new JsonMapObject();

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <commits@cxf.apache.org>'].

Reply via email to