camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [6/8] camel git commit: Added array support for input body paremeter
Date Sat, 22 Oct 2016 09:45:25 GMT
Added array support for input body paremeter

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

Branch: refs/heads/camel-2.18.x
Commit: 51102b2959f9837eaeffa1fd0ea2874ba66d4009
Parents: 836661a
Author: Arturs <asirius4@inbox.lv>
Authored: Fri Oct 21 13:27:05 2016 +0300
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Oct 22 11:44:50 2016 +0200

----------------------------------------------------------------------
 .../org/apache/camel/swagger/RestSwaggerReader.java | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/51102b29/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 8ae5088..251ae38 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
@@ -296,9 +296,19 @@ public class RestSwaggerReader {
                         BodyParameter bp = (BodyParameter) parameter;
 
                         if (verb.getType() != null) {
-                            String ref = modelTypeAsRef(verb.getType(), swagger);
-                            if (ref != null) {
-                                bp.setSchema(new RefModel(ref));
+                            if(verb.getType().endsWith("[]")){
+                                Property prop = modelTypeAsProperty(verb.getType(), swagger);
+                                if (prop != null) {
+                                    ArrayModel arrayModel = new ArrayModel();
+                                    arrayModel.setItems(prop);
+                                    bp.setSchema(arrayModel);
+                                }
+                            }
+                            else {
+                                String ref = modelTypeAsRef(verb.getType(), swagger);
+                                if (ref != null) {
+                                    bp.setSchema(new RefModel(ref));
+                                }
                             }
                         }
                     }


Mime
View raw message