Michael Frankfurter created CAMEL-23115:
-------------------------------------------

             Summary: camel-openapi-java - base.path option will never survive 
if context-path is set
                 Key: CAMEL-23115
                 URL: https://issues.apache.org/jira/browse/CAMEL-23115
             Project: Camel
          Issue Type: Bug
          Components: camel-openapi-java
    Affects Versions: 4.19.0
            Reporter: Michael Frankfurter


The OpenApi specification allows us to specify the host, port & path that is 
serving the API. In OpenAPI V3 it is part of the {{servers}} field.

In camel-openapi-java it is possible to influence this via three different 
options: host, schemes, base.path.

Unfortunately, this {{base.path}} option will not be used every time 
{{contextPath}} is present. But this is exactly what should be replaced.

The current code in 
[OpenApiRestApiProcessorFactory|https://github.com/apache/camel/blob/main/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java#L70]
 should be changed from
{code:java}
String path = configuration.getContextPath();
if (path != null) {
  options.put("base.path", path);
}{code}
to
{code:java}
if (!options.contains("base.path") && configuration.getContextPath() != null) {
  options.put("base.path", configuration.getContextPath());
}{code}
to fulfill that replacement.

I have just put the affected version 4.19.0 but it is like that in all of the 
version.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to