camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/8] camel git commit: Added array support for input body paremeter
Date Sat, 22 Oct 2016 09:45:21 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/a61e8df3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a61e8df3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a61e8df3

Branch: refs/heads/master
Commit: a61e8df3d048196aeae9bd4ffff9ff67f2c65adf
Parents: 5c09c64
Author: Arturs <asirius4@inbox.lv>
Authored: Fri Oct 21 13:27:05 2016 +0300
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Oct 22 09:36:18 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/a61e8df3/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