camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/4] camel git commit: rest-dsl and swagger-java adjusted to better support swagger 2.0 spec.
Date Thu, 25 Feb 2016 09:32:29 GMT
rest-dsl and swagger-java adjusted to better support swagger 2.0 spec.


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

Branch: refs/heads/camel-2.16.x
Commit: dbae5f1b832b41a3e1a6f4ba85e7d57bf28a1d4f
Parents: e425660
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Feb 25 10:21:00 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Feb 25 10:32:14 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/model/rest/AllowMultiple.java  | 15 ----------
 .../camel/model/rest/CollectionFormat.java      | 31 ++++++++++++++++++++
 .../rest/RestOperationParamDefinition.java      | 24 +++++++--------
 .../apache/camel/model/rest/RestParamType.java  |  2 +-
 .../org/apache/camel/model/rest/jaxb.index      |  1 +
 .../rest/FromRestExplicitComponentTest.java     |  4 +--
 .../camel/component/rest/FromRestGetTest.java   |  8 ++---
 .../rest/FromRestIdAndDescriptionTest.java      |  4 +--
 .../management/ManagedFromRestGetTest.java      |  8 ++---
 .../rest/SpringFromRestConfigurationTest.xml    |  4 +--
 .../component/rest/SpringFromRestGetTest.xml    |  4 +--
 .../rest/SpringFromRestIdAndDescriptionTest.xml |  4 +--
 .../apache/camel/swagger/RestSwaggerReader.java | 20 +++++++++----
 .../component/swagger/RestSwaggerReader.scala   |  2 +-
 .../component/rest/FromRestGetTest.java         |  5 ++--
 .../rest/FromRestConfigurationTest.xml          |  4 +--
 .../component/rest/FromRestGetTest.xml          |  4 +--
 .../rest/FromRestIdAndDescriptionTest.xml       |  4 +--
 18 files changed, 87 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/main/java/org/apache/camel/model/rest/AllowMultiple.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/AllowMultiple.java b/camel-core/src/main/java/org/apache/camel/model/rest/AllowMultiple.java
deleted file mode 100644
index 76b8b4b..0000000
--- a/camel-core/src/main/java/org/apache/camel/model/rest/AllowMultiple.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.apache.camel.model.rest;
-
-public enum AllowMultiple {
-
-    csv,
-
-    ssv,
-
-    tsv,
-
-    pipes,
-
-    multi
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/main/java/org/apache/camel/model/rest/CollectionFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/CollectionFormat.java b/camel-core/src/main/java/org/apache/camel/model/rest/CollectionFormat.java
new file mode 100644
index 0000000..213e10a
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/CollectionFormat.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.model.rest;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.camel.spi.Metadata;
+
+@Metadata(label = "rest")
+@XmlType
+@XmlEnum
+public enum CollectionFormat {
+
+    csv, ssv, tsv, pipes, multi
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
b/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
index 6ba4e1b..122cc03 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestOperationParamDefinition.java
@@ -33,9 +33,7 @@ import org.apache.camel.util.ObjectHelper;
 /**
  * To specify the rest operation parameters using Swagger.
  * <p/>
- * This maps to the Swagger Parameter Object.
- * see com.wordnik.swagger.model.Parameter
- * and https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md#524-parameter-object.
+ * This maps to the Swagger Parameter Message Object.
  */
 @Metadata(label = "rest")
 @XmlRootElement(name = "param")
@@ -66,7 +64,7 @@ public class RestOperationParamDefinition {
 
     @XmlAttribute
     @Metadata(defaultValue = "csv")
-    private AllowMultiple allowMultiple;
+    private CollectionFormat collectionFormat;
 
     @XmlAttribute
     @Metadata(defaultValue = "string")
@@ -146,15 +144,15 @@ public class RestOperationParamDefinition {
         this.required = required;
     }
 
-    public AllowMultiple getAllowMultiple() {
-        return allowMultiple;
+    public CollectionFormat getCollectionFormat() {
+        return collectionFormat;
     }
 
     /**
-     * Sets the Swagger Parameter allowMultiple type.
+     * Sets the Swagger Parameter collection format.
      */
-    public void setAllowMultiple(AllowMultiple allowMultiple) {
-        this.allowMultiple = allowMultiple;
+    public void setCollectionFormat(CollectionFormat collectionFormat) {
+        this.collectionFormat = collectionFormat;
     }
 
     public String getArrayType() {
@@ -241,10 +239,10 @@ public class RestOperationParamDefinition {
     }
 
     /**
-     * Whether the parameter can be used multiple times
+     * Sets the collection format.
      */
-    public RestOperationParamDefinition allowMultiple(AllowMultiple allowMultiple) {
-        setAllowMultiple(allowMultiple);
+    public RestOperationParamDefinition collectionFormat(CollectionFormat collectionFormat)
{
+        setCollectionFormat(collectionFormat);
         return this;
     }
 
@@ -257,7 +255,7 @@ public class RestOperationParamDefinition {
     }
 
     /**
-     * The data type of the parameter such as <tt>string</tt>, <tt>long</tt>,
<tt>int</tt>, <tt>boolean</tt>
+     * The data type of the parameter such as <tt>string</tt>, <tt>integer</tt>,
<tt>boolean</tt>
      */
     public RestOperationParamDefinition dataType(String type) {
         setDataType(type);

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/main/java/org/apache/camel/model/rest/RestParamType.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestParamType.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestParamType.java
index 61da45b..c71abb2 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestParamType.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestParamType.java
@@ -29,6 +29,6 @@ import org.apache.camel.spi.Metadata;
 @XmlEnum(String.class)
 public enum RestParamType {
 
-    body, form, header, path, query
+    body, formData, header, path, query
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
----------------------------------------------------------------------
diff --git a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
index 5e77f9a..ef0d1ac 100644
--- a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
+++ b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
@@ -14,6 +14,7 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ------------------------------------------------------------------------
+CollectionFormat
 DeleteVerbDefinition
 GetVerbDefinition
 HeadVerbDefinition

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
index 2ff18bc..2a13baf 100644
--- a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
@@ -17,7 +17,7 @@
 package org.apache.camel.component.rest;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.AllowMultiple;
+import org.apache.camel.model.rest.CollectionFormat;
 import org.apache.camel.model.rest.RestParamType;
 
 public class FromRestExplicitComponentTest extends FromRestGetTest {
@@ -39,7 +39,7 @@ public class FromRestExplicitComponentTest extends FromRestGetTest {
                         .defaultValue("1").name("header_count").required(true).access("acc1")
                         .endParam().
                         param().type(RestParamType.query).description("header param description2").dataType("string").allowableValues("a",
"b", "c", "d")
-                        .defaultValue("b").allowMultiple(AllowMultiple.multi).name("header_letter").required(false).access("acc2")
+                        .defaultValue("b").collectionFormat(CollectionFormat.multi).name("header_letter").required(false).access("acc2")
                         .endParam()
                         .responseMessage().code(300).message("test msg").responseModel(Integer.class).endResponseMessage()
                         .responseMessage().code("error").message("does not work").endResponseMessage()

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
index a54c09a..35081a2 100644
--- a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.model.ToDefinition;
-import org.apache.camel.model.rest.AllowMultiple;
+import org.apache.camel.model.rest.CollectionFormat;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestParamType;
 
@@ -70,8 +70,8 @@ public class FromRestGetTest extends ContextTestSupport {
         assertEquals("1", rest.getVerbs().get(0).getParams().get(0).getDefaultValue());
         assertEquals("b", rest.getVerbs().get(0).getParams().get(1).getDefaultValue());
 
-        assertEquals(Boolean.FALSE, rest.getVerbs().get(0).getParams().get(0).getAllowMultiple());
-        assertEquals(Boolean.TRUE, rest.getVerbs().get(0).getParams().get(1).getAllowMultiple());
+        assertEquals(null, rest.getVerbs().get(0).getParams().get(0).getCollectionFormat());
+        assertEquals(CollectionFormat.multi, rest.getVerbs().get(0).getParams().get(1).getCollectionFormat());
 
         assertEquals("header_count", rest.getVerbs().get(0).getParams().get(0).getName());
         assertEquals("header_letter", rest.getVerbs().get(0).getParams().get(1).getName());
@@ -114,7 +114,7 @@ public class FromRestGetTest extends ContextTestSupport {
                         .defaultValue("1").name("header_count").required(true).access("acc1")
                         .endParam().
                         param().type(RestParamType.query).description("header param description2").dataType("string").allowableValues("a",
"b", "c", "d")
-                        .defaultValue("b").allowMultiple(AllowMultiple.multi).name("header_letter").required(false).access("acc2")
+                        .defaultValue("b").collectionFormat(CollectionFormat.multi).name("header_letter").required(false).access("acc2")
                         .endParam()
                         .responseMessage().code(300).message("test msg").responseModel(Integer.class).endResponseMessage()
                         .responseMessage().code("error").message("does not work").endResponseMessage()

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
index 7814a4d..68941b0 100644
--- a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
@@ -17,7 +17,7 @@
 package org.apache.camel.component.rest;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.AllowMultiple;
+import org.apache.camel.model.rest.CollectionFormat;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestParamType;
 
@@ -57,7 +57,7 @@ public class FromRestIdAndDescriptionTest extends FromRestGetTest {
                         .defaultValue("1").name("header_count").required(true).access("acc1")
                         .endParam().
                         param().type(RestParamType.query).description("header param description2").dataType("string").allowableValues("a",
"b", "c", "d")
-                        .defaultValue("b").allowMultiple(AllowMultiple.multi).name("header_letter").required(false).access("acc2")
+                        .defaultValue("b").collectionFormat(CollectionFormat.multi).name("header_letter").required(false).access("acc2")
                         .endParam()
                         .responseMessage().code(300).message("test msg").responseModel(Integer.class).endResponseMessage()
                         .responseMessage().code("error").message("does not work").endResponseMessage()

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
b/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
index 75f174f..6d3ec6c 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
@@ -26,7 +26,7 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.rest.DummyRestConsumerFactory;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.SimpleRegistry;
-import org.apache.camel.model.rest.AllowMultiple;
+import org.apache.camel.model.rest.CollectionFormat;
 import org.apache.camel.model.rest.RestParamType;
 
 public class ManagedFromRestGetTest extends ManagementTestSupport {
@@ -63,9 +63,9 @@ public class ManagedFromRestGetTest extends ManagementTestSupport {
         assertTrue(xml.contains("</rests>"));
 
         assertTrue(xml.contains("<param name=\"header_letter\" type=\"query\" description=\"header
param description2\""
-                + " defaultValue=\"b\" required=\"false\" allowMultiple=\"true\" dataType=\"string\"
access=\"acc2\">"));
+                + " defaultValue=\"b\" required=\"false\" collectionFormat=\"multi\" dataType=\"string\"
access=\"acc2\">"));
         assertTrue(xml.contains("<param name=\"header_count\" type=\"header\" description=\"header
param description1\" "
-                + "defaultValue=\"1\" required=\"true\" allowMultiple=\"false\" dataType=\"integer\"
access=\"acc1\">"));
+                + "defaultValue=\"1\" required=\"true\" dataType=\"integer\" access=\"acc1\">"));
         assertTrue(xml.contains("<value>1</value>"));
         assertTrue(xml.contains("<value>a</value>"));
 
@@ -95,7 +95,7 @@ public class ManagedFromRestGetTest extends ManagementTestSupport {
                             .defaultValue("1").name("header_count").required(true).access("acc1")
                         .endParam().
                         param().type(RestParamType.query).description("header param description2").dataType("string").allowableValues(Arrays.asList("a",
"b", "c", "d"))
-                            .defaultValue("b").allowMultiple(AllowMultiple.multi).name("header_letter").required(false).access("acc2")
+                            .defaultValue("b").collectionFormat(CollectionFormat.multi).name("header_letter").required(false).access("acc2")
                         .endParam()
                         .responseMessage().code(300).message("test msg").responseModel(Integer.class).endResponseMessage()
                         .to("direct:bye")

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
index d6677d0..062e2bb 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
@@ -41,7 +41,7 @@
     </rest>
     <rest path="/say/bye">
       <get consumes="application/json">
-          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" allowMultiple="false" required="true" access="acc1">
+          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" required="true" access="acc1">
               <allowableValues>
                   <value>1</value>
                   <value>2</value>
@@ -49,7 +49,7 @@
                   <value>4</value>
               </allowableValues>
           </param>
-          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" allowMultiple="true" required="false" access="acc2">
+          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" collectionFormat="multi" required="false" access="acc2">
               <allowableValues>
                   <value>a</value>
                   <value>b</value>

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
index ee15037..66833de 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
@@ -34,7 +34,7 @@
     </rest>
     <rest path="/say/bye">
       <get consumes="application/json">
-          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" allowMultiple="false" required="true" access="acc1">
+          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" required="true" access="acc1">
               <allowableValues>
                   <value>1</value>
                   <value>2</value>
@@ -42,7 +42,7 @@
                   <value>4</value>
               </allowableValues>
           </param>
-          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" allowMultiple="true" required="false" access="acc2">
+          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" collectionFormat="multi" required="false" access="acc2">
               <allowableValues>
                   <value>a</value>
                   <value>b</value>

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestIdAndDescriptionTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestIdAndDescriptionTest.xml
b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestIdAndDescriptionTest.xml
index fc60d49..5e838fd 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestIdAndDescriptionTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestIdAndDescriptionTest.xml
@@ -38,7 +38,7 @@
       <description lang="en">Bye Service</description>
       <get consumes="application/json">
         <description>Says bye to you</description>
-          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" allowMultiple="false" required="true" access="acc1">
+          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" required="true" access="acc1">
               <allowableValues>
                   <value>1</value>
                   <value>2</value>
@@ -46,7 +46,7 @@
                   <value>4</value>
               </allowableValues>
           </param>
-          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" allowMultiple="true" required="false" access="acc2">
+          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" collectionFormat="multi" required="false" access="acc2">
               <allowableValues>
                   <value>a</value>
                   <value>b</value>

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/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 3236b64..29b2e72 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
@@ -42,7 +42,15 @@ import io.swagger.models.parameters.Parameter;
 import io.swagger.models.parameters.PathParameter;
 import io.swagger.models.parameters.QueryParameter;
 import io.swagger.models.parameters.SerializableParameter;
-import io.swagger.models.properties.*;
+import io.swagger.models.properties.ArrayProperty;
+import io.swagger.models.properties.BooleanProperty;
+import io.swagger.models.properties.DoubleProperty;
+import io.swagger.models.properties.FloatProperty;
+import io.swagger.models.properties.IntegerProperty;
+import io.swagger.models.properties.LongProperty;
+import io.swagger.models.properties.Property;
+import io.swagger.models.properties.RefProperty;
+import io.swagger.models.properties.StringProperty;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestOperationParamDefinition;
 import org.apache.camel.model.rest.RestOperationResponseMsgDefinition;
@@ -54,6 +62,8 @@ import org.apache.camel.util.ObjectHelper;
 
 /**
  * A Camel REST-DSL swagger reader that parse the rest-dsl into a swagger model representation.
+ * <p/>
+ * This reader supports the <a href="http://swagger.io/specification/">Swagger Specification
2.0</a>
  */
 public class RestSwaggerReader {
 
@@ -193,7 +203,7 @@ public class RestSwaggerReader {
                 Parameter parameter = null;
                 if (param.getType().equals(RestParamType.body)) {
                     parameter = new BodyParameter();
-                } else if (param.getType().equals(RestParamType.form)) {
+                } else if (param.getType().equals(RestParamType.formData)) {
                     parameter = new FormParameter();
                 } else if (param.getType().equals(RestParamType.header)) {
                     parameter = new HeaderParameter();
@@ -220,7 +230,7 @@ public class RestSwaggerReader {
                                     if (param.getArrayType().equalsIgnoreCase("string"))
{
                                         serializableParameter.setItems(new StringProperty());
                                     }
-                                    if (param.getArrayType().equalsIgnoreCase("integer"))
{
+                                    if (param.getArrayType().equalsIgnoreCase("int") || param.getArrayType().equalsIgnoreCase("integer"))
{
                                         serializableParameter.setItems(new IntegerProperty());
                                     }
                                     if (param.getArrayType().equalsIgnoreCase("long")) {
@@ -238,8 +248,8 @@ public class RestSwaggerReader {
                                 }
                             }
                         }
-                        if (param.getAllowMultiple() != null) {
-                            serializableParameter.setCollectionFormat(param.getAllowMultiple().name());
+                        if (param.getCollectionFormat() != null) {
+                            serializableParameter.setCollectionFormat(param.getCollectionFormat().name());
                         }
                         if (param.getAllowableValues() != null && !param.getAllowableValues().isEmpty())
{
                             serializableParameter.setEnum(param.getAllowableValues());

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
----------------------------------------------------------------------
diff --git a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
index aae45c9..79835be 100644
--- a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
+++ b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala
@@ -202,7 +202,7 @@ class RestSwaggerReader {
         Some( param.getDescription ),
         Some( param.getDefaultValue),
         if (param.getRequired != null) param.getRequired.booleanValue() else false,
-        if (param.getAllowMultiple != null) param.getAllowMultiple.booleanValue() else false,
+        false,
         param.getDataType,
         allowValues,
         param.getType.toString,

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
index 1310546..d13020f 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.test.blueprint.component.rest;
 import java.util.Arrays;
 
 import org.apache.camel.model.ToDefinition;
+import org.apache.camel.model.rest.CollectionFormat;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestParamType;
 import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
@@ -66,8 +67,8 @@ public class FromRestGetTest extends CamelBlueprintTestSupport {
         assertEquals("1", rest.getVerbs().get(0).getParams().get(0).getDefaultValue());
         assertEquals("b", rest.getVerbs().get(0).getParams().get(1).getDefaultValue());
 
-        assertEquals(Boolean.FALSE, rest.getVerbs().get(0).getParams().get(0).getAllowMultiple());
-        assertEquals(Boolean.TRUE, rest.getVerbs().get(0).getParams().get(1).getAllowMultiple());
+        assertEquals(null, rest.getVerbs().get(0).getParams().get(0).getCollectionFormat());
+        assertEquals(CollectionFormat.multi, rest.getVerbs().get(0).getParams().get(1).getCollectionFormat());
 
         assertEquals("header_count", rest.getVerbs().get(0).getParams().get(0).getName());
         assertEquals("header_letter", rest.getVerbs().get(0).getParams().get(1).getName());

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
index 2fa28f5..511e029 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
@@ -39,7 +39,7 @@
     </rest>
     <rest path="/say/bye">
       <get consumes="application/json">
-        <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" allowMultiple="false" required="true" access="acc1">
+        <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" required="true" access="acc1">
           <allowableValues>
               <value>1</value>
               <value>2</value>
@@ -47,7 +47,7 @@
               <value>4</value>
           </allowableValues>
         </param>
-        <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" allowMultiple="true" required="false" access="acc2">
+        <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" collectionFormat="multi" required="false" access="acc2">
           <allowableValues>
               <value>a</value>
               <value>b</value>

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
index 8e1a89b..1816f71 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
@@ -32,7 +32,7 @@
     </rest>
     <rest path="/say/bye">
       <get consumes="application/json">
-         <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" allowMultiple="false" required="true" access="acc1">
+         <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" required="true" access="acc1">
             <allowableValues>
                <value>1</value>
                <value>2</value>
@@ -40,7 +40,7 @@
                <value>4</value>
             </allowableValues>
          </param>
-         <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" allowMultiple="true" required="false" access="acc2">
+         <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" collectionFormat="multi" required="false" access="acc2">
             <allowableValues>
                <value>a</value>
                <value>b</value>

http://git-wip-us.apache.org/repos/asf/camel/blob/dbae5f1b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestIdAndDescriptionTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestIdAndDescriptionTest.xml
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestIdAndDescriptionTest.xml
index f9aa473..5247dfd 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestIdAndDescriptionTest.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestIdAndDescriptionTest.xml
@@ -36,7 +36,7 @@
       <description lang="en">Bye Service</description>
       <get consumes="application/json">
         <description>Says bye to you</description>
-          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" allowMultiple="false" required="true" access="acc1">
+          <param name="header_count" type="header" description="header param description1"
dataType="integer" defaultValue="1" required="true" access="acc1">
               <allowableValues>
                   <value>1</value>
                   <value>2</value>
@@ -44,7 +44,7 @@
                   <value>4</value>
               </allowableValues>
           </param>
-          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" allowMultiple="true" required="false" access="acc2">
+          <param name="header_letter" type="query" description="header param description2"
dataType="string" defaultValue="b" collectionFormat="multi" required="false" access="acc2">
               <allowableValues>
                   <value>a</value>
                   <value>b</value>


Mime
View raw message