This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-4.18.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 6afc860f8272014407fde8d08702633a5ec7b846 Author: micfra <[email protected]> AuthorDate: Tue Mar 3 11:24:37 2026 +0100 CAMEL-23115 Keep base.path it present. Otherwise use context path. (#21678) Co-authored-by: Michael Frankfurter <[email protected]> --- components/camel-openapi-java/src/main/docs/openapi-java.adoc | 4 ++-- .../org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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 3c4b7a707815..38f30fb54fed 100644 --- a/components/camel-openapi-java/src/main/docs/openapi-java.adoc +++ b/components/camel-openapi-java/src/main/docs/openapi-java.adoc @@ -96,10 +96,10 @@ calculate the name as localhost based. |schemes |String |The protocol schemes to use. Multiple values can be separated by comma such as "http,https". The default value is "http". -|base.path |String |*Required*: To set up the base path where the REST services are available. +|base.path |String |To set up the base path where the REST services are available. The path is relative (e.g., do not start with http/https) and camel-openapi-java will calculate the absolute base path at runtime, -which will be `protocol://host:port/context-path/base.path` +which will be `protocol://host:port/base.path`. If the base.path option is not set, context-path will be used. |api.path |String |To set up the path where the API is available (eg /api-docs). The path is relative (e.g., do not start with http/https) and camel-openapi-java will diff --git a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java index cd7fe5b1404e..2cf18df0f1ec 100644 --- a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java +++ b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java @@ -66,10 +66,10 @@ public class OpenApiRestApiProcessorFactory implements RestApiProcessorFactory { options.put("schemes", scheme); } } - // and context path is the base.path - String path = configuration.getContextPath(); - if (path != null) { - options.put("base.path", path); + + // and context path is the base.path if option not present + if (!options.containsKey("base.path") && configuration.getContextPath() != null) { + options.put("base.path", configuration.getContextPath()); } // is cors enabled?
