Lukas Lowinger created CAMEL-21057:
--------------------------------------
Summary: REST OpenApi fails to resolve host from the URL
Key: CAMEL-21057
URL: https://issues.apache.org/jira/browse/CAMEL-21057
Project: Camel
Issue Type: Bug
Affects Versions: 3.18.8
Reporter: Lukas Lowinger
Given simple route
{code}
private final String openApiJsonUrl =
"http://localhost:8080/api/v3/openapi.json";
String a = "{\n" + " \"id\": 13,\n" + " \"name\": \"kooo\",\n" + "
\"category\": {\n" + " \"id\": 1,\n" + " \"name\": \"Dogs\"\n" + " }\n"
+ "}";
@Override
public void configure() throws Exception {
from("timer:test?repeatCount=1").setBody(simple(a)).setHeader(Exchange.CONTENT_TYPE,
simple("application/json")).to("rest-openapi:#addPet?specificationUri=RAW(" +
openApiJsonUrl + ")").to("direct:readPet");
from("direct:readPet").setHeader("petId",
simple("13")).to("rest-openapi:#getPetById?specificationUri=RAW(" +
openApiJsonUrl + ")");
}
{code}
I get
{code}
Caused by: java.net.MalformedURLException: no protocol: /api/v3
at java.net.URL.<init> (URL.java:674)
at java.net.URL.<init> (URL.java:569)
at java.net.URL.<init> (URL.java:516)
at
org.apache.camel.component.rest.openapi.RestOpenApiEndpoint.determineHost
(RestOpenApiEndpoint.java:590)
at
org.apache.camel.component.rest.openapi.RestOpenApiEndpoint.determineEndpointParameters
(RestOpenApiEndpoint.java:459)
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)