Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14746

camel-rest-swagger java.lang.IllegalArgumentException when Swagger specification don't have "scheme" object and get this specification by "file;" resource

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.25.0
    • Fix Version/s: 3.2.0
    • Component/s: camel-rest-swagger
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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="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

       

      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

       

      When I get the same swagger specification through the resource "http:" everything is ok

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dmvolod Dmitry Volodin
                Reporter:
                lukymiv Mikhail Lukyanov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m