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 4267d94f246 CAMEL-20483: camel-openapi-java - Rest DSL with 
api-context-path may append null in host name
4267d94f246 is described below

commit 4267d94f246a07eb0b77e0e480880d785d486a3a
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Feb 28 17:06:42 2024 +0100

    CAMEL-20483: camel-openapi-java - Rest DSL with api-context-path may append 
null in host name
---
 .../src/main/java/org/apache/camel/openapi/BeanConfig.java     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/BeanConfig.java
 
b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/BeanConfig.java
index f932623c646..be00b572c8b 100644
--- 
a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/BeanConfig.java
+++ 
b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/BeanConfig.java
@@ -133,7 +133,15 @@ public class BeanConfig {
             openApi.setInfo(info);
         }
         for (String scheme : this.schemes) {
-            Server server = new Server().url(scheme + "://" + this.host + 
this.basePath);
+            String url = scheme + "://" + this.host;
+            if (this.basePath != null) {
+                if (this.basePath.startsWith("/")) {
+                    url += this.basePath;
+                } else {
+                    url = url + "/" + this.basePath;
+                }
+            }
+            Server server = new Server().url(url);
             openApi.addServersItem(server);
         }
         if (isOpenApi31()) {

Reply via email to