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 2020/12/06 13:24:31 UTC

[camel] branch master updated: CAMEL-15786: Fixed camel-openapi-java - to not include vendor extension if turned off.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 40e18b7  CAMEL-15786: Fixed camel-openapi-java - to not include vendor extension if turned off.
40e18b7 is described below

commit 40e18b7d6102b08bc1a492f58ba079e931a50566
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 6 14:23:57 2020 +0100

    CAMEL-15786: Fixed camel-openapi-java - to not include vendor extension if turned off.
---
 .../apache/camel/catalog/docs/openapi-java.adoc    |  6 ++--
 .../src/main/docs/openapi-java.adoc                |  6 ++--
 .../org/apache/camel/openapi/OpenApiHelper.java    | 38 +++++-----------------
 .../modules/others/pages/openapi-java.adoc         |  6 ++--
 4 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openapi-java.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openapi-java.adoc
index df2695f..897cab1 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openapi-java.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openapi-java.adoc
@@ -196,6 +196,6 @@ json is returned as the default format.
 
 == Examples
 
-In the Apache Camel distribution we ship
-the `camel-example-openapi-cdi` and `camel-example-openapi-java` which
-demonstrates using this OpenApi component.
+In the Apache Camel distribution we ship the `camel-example-openapi-cdi`
+and `camel-example-spring-boot-rest-openapi-simple` which demonstrates
+using this OpenApi component.
diff --git a/components/camel-openapi-java/src/main/docs/openapi-java.adoc b/components/camel-openapi-java/src/main/docs/openapi-java.adoc
index df2695f..897cab1 100644
--- a/components/camel-openapi-java/src/main/docs/openapi-java.adoc
+++ b/components/camel-openapi-java/src/main/docs/openapi-java.adoc
@@ -196,6 +196,6 @@ json is returned as the default format.
 
 == Examples
 
-In the Apache Camel distribution we ship
-the `camel-example-openapi-cdi` and `camel-example-openapi-java` which
-demonstrates using this OpenApi component.
+In the Apache Camel distribution we ship the `camel-example-openapi-cdi`
+and `camel-example-spring-boot-rest-openapi-simple` which demonstrates
+using this OpenApi component.
diff --git a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiHelper.java b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiHelper.java
index 6c540cf..10e945c 100644
--- a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiHelper.java
+++ b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiHelper.java
@@ -52,59 +52,37 @@ public final class OpenApiHelper {
     public static void clearVendorExtensions(OasDocument openApi) {
 
         if (openApi instanceof Oas20Document) {
-
-            if (openApi.getExtensions() != null) {
-                openApi.getExtensions().clear();
-            }
-
+            openApi.clearExtensions();
             if (((Oas20Document) openApi).definitions.getDefinitions() != null) {
                 for (Oas20SchemaDefinition schemaDefinition : ((Oas20Document) openApi).definitions.getDefinitions()) {
-                    if (schemaDefinition.getExtensions() != null) {
-                        schemaDefinition.getExtensions().clear();
-                    }
+                    schemaDefinition.clearExtensions();
                 }
             }
-
             if (openApi.paths != null) {
                 for (OasPathItem path : openApi.paths.getPathItems()) {
-                    if (path.getExtensions() != null) {
-                        path.getExtensions().clear();
-                    }
+                    path.clearExtensions();
                     for (OasOperation op : getOperationMap(path).values()) {
-                        if (op.getExtensions() != null) {
-                            op.getExtensions().clear();
-                        }
+                        op.clearExtensions();
                     }
                 }
             }
         } else if (openApi instanceof Oas30Document) {
-            if (openApi.getExtensions() != null) {
-                openApi.getExtensions().clear();
-            }
-
+            openApi.clearExtensions();
             if (((Oas30Document) openApi).components != null
                     && ((Oas30Document) openApi).components.schemas != null) {
                 for (Oas30SchemaDefinition schemaDefinition : ((Oas30Document) openApi).components.schemas.values()) {
-                    if (schemaDefinition.getExtensions() != null) {
-                        schemaDefinition.getExtensions().clear();
-                    }
+                    schemaDefinition.clearExtensions();
                 }
             }
-
             if (openApi.paths != null) {
                 for (OasPathItem path : openApi.paths.getPathItems()) {
-                    if (path.getExtensions() != null) {
-                        path.getExtensions().clear();
-                    }
+                    path.clearExtensions();
                     for (OasOperation op : getOperationMap(path).values()) {
-                        if (op.getExtensions() != null) {
-                            op.getExtensions().clear();
-                        }
+                        op.clearExtensions();
                     }
                 }
             }
         }
-
     }
 
     private static Map<HttpMethod, OasOperation> getOperationMap(OasPathItem path) {
diff --git a/docs/components/modules/others/pages/openapi-java.adoc b/docs/components/modules/others/pages/openapi-java.adoc
index 9b247ba..e2c7683 100644
--- a/docs/components/modules/others/pages/openapi-java.adoc
+++ b/docs/components/modules/others/pages/openapi-java.adoc
@@ -198,6 +198,6 @@ json is returned as the default format.
 
 == Examples
 
-In the Apache Camel distribution we ship
-the `camel-example-openapi-cdi` and `camel-example-openapi-java` which
-demonstrates using this OpenApi component.
+In the Apache Camel distribution we ship the `camel-example-openapi-cdi`
+and `camel-example-spring-boot-rest-openapi-simple` which demonstrates
+using this OpenApi component.