camel git commit: CAMEL-11033 Set `operationId` in generated Swag...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

camel git commit: CAMEL-11033 Set `operationId` in generated Swag...

zregvart
Repository: camel
Updated Branches:
  refs/heads/master db81a114e -> 42c26f1d9


CAMEL-11033 Set `operationId` in generated Swag...

...ger specification

Sets the `operationId` from `id` or if not present `routeId` when
generating Swagger specification.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/42c26f1d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/42c26f1d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/42c26f1d

Branch: refs/heads/master
Commit: 42c26f1d96f6e7376e1957ea58bf9dfd63123431
Parents: db81a11
Author: Zoran Regvart <[hidden email]>
Authored: Fri Mar 17 20:18:36 2017 +0100
Committer: Zoran Regvart <[hidden email]>
Committed: Fri Mar 17 20:19:02 2017 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/camel/swagger/RestSwaggerReader.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/42c26f1d/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
----------------------------------------------------------------------
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
index 58cf1c1..472b8c3 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerReader.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
 import io.swagger.jaxrs.config.BeanConfig;
@@ -197,9 +198,13 @@ public class RestSwaggerReader {
                 op.addTag(pathAsTag);
             }
 
+            final String routeId = verb.getRouteId();
+            final String operationId = Optional.ofNullable(rest.getId()).orElse(routeId);
+            op.operationId(operationId);
+
             // add id as vendor extensions
             op.getVendorExtensions().put("x-camelContextId", camelContextId);
-            op.getVendorExtensions().put("x-routeId", verb.getRouteId());
+            op.getVendorExtensions().put("x-routeId", routeId);
 
             Path path = swagger.getPath(opPath);
             if (path == null) {