camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/8] camel git commit: added support to exclude a route from documentation
Date Mon, 14 Mar 2016 19:17:47 GMT
added support to exclude a route from documentation


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

Branch: refs/heads/master
Commit: bcd6b6b9d225d0768b0e38bb599cf01a13d9379e
Parents: f647d33
Author: Simion Hantig <simion.hantig@hgdata.com>
Authored: Mon Mar 14 12:10:27 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Mar 14 19:50:30 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/model/rest/RestDefinition.java  |  6 ++++++
 .../java/org/apache/camel/model/rest/VerbDefinition.java  | 10 ++++++++++
 .../java/org/apache/camel/swagger/RestSwaggerReader.java  |  7 ++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bcd6b6b9/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index cd815f4..7f732a5 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -501,6 +501,12 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         return this;
     }
 
+    public RestDefinition excludeFromDocs() {
+        VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
+        verb.setExcludeFromDocs(true);
+        return this;
+    }
+
     public RouteDefinition route() {
         // add to last verb
         if (getVerbs().isEmpty()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/bcd6b6b9/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 8d1e686..d3a9aba 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -98,6 +98,8 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
     private RestDefinition rest;
     @XmlAttribute
     private String routeId;
+    @XmlAttribute
+    private Boolean excludeFromDocs;
 
     @Override
     public String getLabel() {
@@ -369,6 +371,14 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
         return rest.verb(verb, uri);
     }
 
+    public Boolean getExcludeFromDocs() {
+        return excludeFromDocs;
+    }
+
+    public void setExcludeFromDocs(Boolean excludeFromDocs) {
+        this.excludeFromDocs = excludeFromDocs;
+    }
+
     public String asVerb() {
         // we do not want the jaxb model to repeat itself, by outputting <get method="get">
         // so we defer the verb from the instance type

http://git-wip-us.apache.org/repos/asf/camel/blob/bcd6b6b9/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 e3e65ef..67f975e 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
@@ -117,6 +117,9 @@ public class RestSwaggerReader {
         // gather all types in use
         Set<String> types = new LinkedHashSet<>();
         for (VerbDefinition verb : verbs) {
+            if (verb.getExcludeFromDocs() != null && verb.getExcludeFromDocs()) {
+                continue;
+            }
             String type = verb.getType();
             if (ObjectHelper.isNotEmpty(type)) {
                 if (type.endsWith("[]")) {
@@ -161,7 +164,9 @@ public class RestSwaggerReader {
         String basePath = rest.getPath();
 
         for (VerbDefinition verb : verbs) {
-
+            if (verb.getExcludeFromDocs() != null && verb.getExcludeFromDocs()) {
+                continue;
+            }
             // the method must be in lower case
             String method = verb.asVerb().toLowerCase(Locale.US);
             // operation path is a key


Mime
View raw message