[ 
https://issues.apache.org/jira/browse/CAMEL-21057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17873235#comment-17873235
 ] 

Claus Ibsen commented on CAMEL-21057:
-------------------------------------

Maybe this should be backported to 4.4.x branch

> 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
>          Components: camel-rest-openapi
>    Affects Versions: 3.18.8, 4.7.0
>            Reporter: Lukas Lowinger
>            Assignee: Zheng Feng
>            Priority: Major
>             Fix For: 4.8.0
>
>         Attachments: rest-openapi-camel.zip
>
>
> 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}
> Reproducer:
> # Unzip  [^rest-openapi-camel.zip] 
> # Run `docker run -p 8080:8080 swaggerapi/petstore3`
> # mvn camel:run



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

Reply via email to