Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.13.0, 3.14.0
-
None
-
Unknown
Description
Consider this REST configuration:
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");
The 'paths' object in the generated OpenAPI document is incorrect. It should not have the '/api' context path prefix.
{ "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" } ] }
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?
Attachments
Issue Links
- Testing discovered
-
CAMEL-17535 camel-example-spring-boot-rest-openapi-springdoc generates incorrect api doc
- Resolved
- links to