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

camel-swagger-java Semantic error. Methods in rest service with id have the same operationId

    XMLWordPrintableJSON

    Details

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

      Description

      In camel-swagger-java, for this service

       

      <rest id="4f777f7b-f2fd-4107-8271-a50640d4525c" path="/path" produces="application/json">
      <get id="026ea872-e2f8-4772-8d10-6482b8549f11"
      produces="application/json" uri="/get">
      <description/>
      <responseMessage message="OK" code="200" />
      <to uri="direct-vm://restLink"/>
      </get>
      <get id="247f814f-5970-4cc1-975d-374195ff9b42"
      produces="application/json" uri="/get2">
      <description/>
      <responseMessage message="OK" code="200" />
      <to uri="direct-vm://restLink"/>
      </get>
      </rest>

       
      I get next swagger.json, which does not pass validation because 

      Semantic error at paths./path/get2.get.operationId

      Operations must have unique operationIds.
       
       

      { "swagger" : "2.0", "info" :

      { "version" : "1.0", "title" : "REST API" }

      , "host" : "0.0.0.0:9090", "basePath" : "/fesb-rest", "tags" : [ { "name" : "path" } ], "schemes" : [ "http", "https" ], "paths" : { "/path/get" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "4f777f7b-f2fd-4107-8271-a50640d4525c", "produces" : [ "application/json" ], "responses" : { "200" : { "description" : "OK" } } } }, "/path/get2" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "4f777f7b-f2fd-4107-8271-a50640d4525c", "produces" : [ "application/json" ], "responses" : { "200" : { "description" : "OK" } } } } } }
       
       I need the id of the methods and not the service to be used, while the service id should remain
       I looked at the code and found the following in the class RestSwaggerReader. 

       

      String operationId = (String)Optional.ofNullable(rest.getId()).orElse(routeId);
      op.operationId(operationId); 

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: