-
Bug
-
Resolution: Done
-
Normal
-
None
-
None
-
False
-
-
False
-
-
-
-
0
-
+
The implementation of the OpenAPI contract doesn't work with camel quarkus if the contextPath is set in the restConfiguration.
restConfiguration() .apiContextPath("/api/openapi") .contextPath("/camel") .hostNameResolver(RestHostNameResolver.none); rest("/camel") .openApi() .specification("openapi/contract.json"); from("direct:fetchMessage") .routeId(ROUTE_ID) .autoStartup(enabled) .log("Request Received...") .setBody().constant("Success");
Contract:
{ "openapi": "3.0.1", "info": { "title": "Test API", "version": "1.0.0", "description": "NA" }, "paths": { "/fetch": { "get": { "tags": [ "fetch" ], "summary": "fetch Message", "operationId": "fetchMessage", "description": "NA", "requestBody": { "required": false }, "responses": { "200": { "description": "Message successfully fetch from the queue.", "content": { "application/json": { "schema": { "type": "string" }}}}}}}}}
Now if you run: http://localhost:8080/camel/api/openapi
It generates:
"servers" : [ { "url" : "/" } ],
Now, accessing http://localhost:8080/camel/fetch gives 404
If we remove the .contextPath("/camel") from the restConfiguration, it works but now, it registers the API endpoint on the root ("/") context:
- mentioned on