You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Mikhail Lukyanov (Jira)" <ji...@apache.org> on 2020/03/16 13:22:00 UTC

[jira] [Updated] (CAMEL-14724) camel-swagger-java Semantic error. Methods in rest service with id have the same operationId

     [ https://issues.apache.org/jira/browse/CAMEL-14724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikhail Lukyanov updated CAMEL-14724:
-------------------------------------
    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 
h4. 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|http://0.0.0.0:9090/]", "basePath" : "/fesb-rest", "tags" : [ \{ "name" : "path" } ], "schemes" : [ "http", "https" ], "paths" : { "/path/get" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "{color:#ff0000}4f777f7b-f2fd-4107-8271-a50640d4525c{color}{color:#000000}", "produces" : [ "application/json" ], "responses" : \{ "200" : { "description" : "OK" } } } }, "/path/get2" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "{color}{color:#ff0000}4f777f7b-f2fd-4107-8271-a50640d4525c{color}{color:#000000}", "produces" : [ "application/json" ], "responses" : \{ "200" : { "description" : "OK" } } } } } }{color}
  
  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); 

  was:
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 
h4. 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|http://0.0.0.0:9090/]", "basePath" : "/fesb-rest", "tags" : [ \{ "name" : "path" } ], "schemes" : [ "http", "https" ], "paths" : { "/path/get" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "{color:#ff0000}4f777f7b-f2fd-4107-8271-a50640d4525c{color}{color:#000000}", "produces" : [ "application/json" ], "responses" : \{ "200" : { "description" : "OK" } } } }, "/path/get2" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "{color}{color:#ff0000}4f777f7b-f2fd-4107-8271-a50640d4525c{color}{color:#000000}", "produces" : [ "application/json" ], "responses" : \{ "200" : { "description" : "OK" } } } } } }{color}
 
 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); 


> camel-swagger-java Semantic error. Methods in rest service with id have the same operationId
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-14724
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14724
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-swagger
>    Affects Versions: 3.1.0
>            Reporter: Mikhail Lukyanov
>            Priority: Major
>
> 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 
> h4. 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|http://0.0.0.0:9090/]", "basePath" : "/fesb-rest", "tags" : [ \{ "name" : "path" } ], "schemes" : [ "http", "https" ], "paths" : { "/path/get" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "{color:#ff0000}4f777f7b-f2fd-4107-8271-a50640d4525c{color}{color:#000000}", "produces" : [ "application/json" ], "responses" : \{ "200" : { "description" : "OK" } } } }, "/path/get2" : { "get" : { "tags" : [ "path" ], "summary" : "", "operationId" : "{color}{color:#ff0000}4f777f7b-f2fd-4107-8271-a50640d4525c{color}{color:#000000}", "produces" : [ "application/json" ], "responses" : \{ "200" : { "description" : "OK" } } } } } }{color}
>   
>   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); 



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