You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "James Netherton (Jira)" <ji...@apache.org> on 2022/01/14 14:45:00 UTC
[jira] [Created] (CAMEL-17491) camel-openapi-java - Operation paths are incorrect if contextPath is set
James Netherton created CAMEL-17491:
---------------------------------------
Summary: camel-openapi-java - Operation paths are incorrect if contextPath is set
Key: CAMEL-17491
URL: https://issues.apache.org/jira/browse/CAMEL-17491
Project: Camel
Issue Type: Bug
Components: camel-openapi-java
Affects Versions: 3.14.0, 3.13.0
Reporter: James Netherton
Consider this REST configuration:
{code}
restConfiguration()
.host("localhost")
.apiHost("localhost")
.contextPath("/api")
.port(8080)
.apiContextPath("/api-docs");
rest("/service")
.get("/testing").description("Test Service")
.outType(String.class)
.route().setBody().constant("Hello World");
{code}
The 'paths' object in the generated OpenAPI document is incorrect. It should not have the '/api' context path prefix.
{code}
{
"openapi" : "3.0.2",
"info" : { },
"servers" : [ {
"url" : "/api"
} ],
"paths" : {
"/api/service/testing" : {
"get" : {
"tags" : [ "/service" ],
"responses" : {
"200" : { }
},
"operationId" : "verb1",
"summary" : "Test Service"
}
}
},
"components" : { },
"tags" : [ {
"name" : "/service"
} ]
}
{code}
The OpenAPI spec states:
"Unless specified otherwise, all properties that are URLs MAY be relative references as defined by RFC3986. Relative references are resolved using the URLs defined in the Server Object as a Base URI.".
If you try to execute the service in the Swagger UI, then it tries to hit http://localhost:8080/api/api/service/testing (duplicate /api/api in the path).
Maybe the code we had before CAMEL-17063 was implemented was more correct?
--
This message was sent by Atlassian Jira
(v8.20.1#820001)