Mikhail Lukyanov created CAMEL-14746:
----------------------------------------

             Summary: camel-rest-swagger java.lang.IllegalArgumentException 
when Swagger specification don't have "scheme" object and get this 
specification by by "file;" resource
                 Key: CAMEL-14746
                 URL: https://issues.apache.org/jira/browse/CAMEL-14746
             Project: Camel
          Issue Type: Bug
          Components: camel-rest-swagger
    Affects Versions: 2.25.0
            Reporter: Mikhail Lukyanov


*camelContext*

 

_<?xml version="1.0" encoding="UTF-8"?>_
_<beans xmlns="http://www.springframework.org/schema/beans"_
 _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"_
 _xsi:schemaLocation="http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd 
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd";>_
 _<camelContext id="mytestroute" xmlns="http://camel.apache.org/schema/spring"; 
>_
 _<route>_
 _<!--<from uri="jmstx://TRANSACTION.IN"/>-->_
 _<!--<to uri="jmstx://TRANSACTION.OUT"/>-->_
 _<from uri="direct:swaggerIn"/>_
 _<to 
uri="swagger*:file*:/C:/Users/wunsh/IdeaProjects/camel/components/camel-rest-swagger/src/test/resources/swagger1.json#downloadUsingGET"/>_
 _<to uri="mock:swaggerOut"/>_
 _</route>_
 _</camelContext>_

 _<bean id="swagger" 
class="org.apache.camel.component.rest.swagger.RestSwaggerComponent">_
 _<property name="componentName" value="http" />_
 _</bean>_
_</beans>_

 

*Swagger.json*

 

_{_
 _"swagger": "2.0",_
 _"info": {_
 _"description": "Api Documentation",_
 _"version": "1.0",_
 _"title": "Api Documentation",_
 _"termsOfService": "urn:tos",_
 _"contact": {},_
 _"license": {_
 _"name": "Apache 2.0",_
 _"url": "http://www.apache.org/licenses/LICENSE-2.0"_
 _}_
 _},_
 _"host": "localhost:8182",_
 _"basePath": "/manager",_
 _"tags": [_
 _{_
 _"name": "Logs",_
 _"description": "API for logs"_
 _}_
 _],_
 _"paths": {_
 _"/api/log/download": {_
 _"get": {_
 _"tags": [_
 _"Работа с логами"_
 _],_
 _"summary": "Export",_
 _"operationId": "downloadUsingGET",_
 _"produces": [_
 _"*/*"_
 _],_
 _"responses": {_
 _"200": {_
 _"description": "OK"_
 _},_
 _"401": {_
 _"description": "Unauthorized"_
 _},_
 _"403": {_
 "description": "Forbidden"
 },
 "404": {
 "description": "Not Found"
 }
 },
 "deprecated": false
 }
 }
 }
}

 

*Error*

 

{color:#de350b}Caused by: org.apache.camel.FailedToCreateProducerException: 
Failed to create Producer for endpoint: 
swagger://file:/C:/Users/wunsh/IdeaProjects/camel/components/camel-rest-swagger/src/test/resources/swagger1.json%23downloadUsingGET.
 Reason: java.lang.IllegalArgumentException: The endpoint is not of type: class 
org.apache.camel.component.http.HttpEndpoint but is: 
org.apache.camel.component.file.FileEndpointCaused by: 
org.apache.camel.FailedToCreateProducerException: Failed to create Producer for 
endpoint: 
swagger://file:/C:/Users/wunsh/IdeaProjects/camel/components/camel-rest-swagger/src/test/resources/swagger1.json%23downloadUsingGET.
 Reason: java.lang.IllegalArgumentException: The endpoint is not of type: class 
org.apache.camel.component.http.HttpEndpoint but is: 
org.apache.camel.component.file.FileEndpoint{color}

 

{color:#172b4d}When I get the same swagger specification through the resource 
"http:" everything is ok{color}

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to