This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new cd01fdf  Tests.
cd01fdf is described below

commit cd01fdf0c71e57ed8c0de9d154fd94a2fc5492c8
Author: JamesBognar <[email protected]>
AuthorDate: Tue Aug 28 10:57:24 2018 -0400

    Tests.
---
 .../juneau/http/annotation/AnnotationUtils.java    |  4 +-
 .../org/apache/juneau/http/annotation/Path.java    | 83 ++++++++++++++++++++++
 .../juneau/httppart/HttpPartSchemaBuilder.java     |  3 +
 .../rest/client/remote/FormDataAnnotationTest.java | 60 ++++++++++++++++
 .../rest/client/remote/HeaderAnnotationTest.java   | 61 ++++++++++++++++
 .../rest/client/remote/PathAnnotationTest.java     | 61 ++++++++++++++++
 .../rest/client/remote/QueryAnnotationTest.java    | 60 ++++++++++++++++
 .../org/apache/juneau/rest/SwaggerGenerator.java   |  3 +
 8 files changed, 333 insertions(+), 2 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/AnnotationUtils.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/AnnotationUtils.java
index a917cc1..9c03960 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/AnnotationUtils.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/AnnotationUtils.java
@@ -226,8 +226,8 @@ public class AnnotationUtils {
                return
                        allEmpty(a.description(), a._enum(), a.example(), 
a.api())
                        && allEmpty(a.name(), a.value(), a.type(), a.format(), 
a.pattern(), a.maximum(), a.minimum(), a.multipleOf())
-                       && allFalse(a.exclusiveMaximum(), a.exclusiveMinimum())
-                       && allMinusOne(a.maxLength(), a.minLength())
+                       && allFalse(a.exclusiveMaximum(), a.exclusiveMinimum(), 
a.uniqueItems())
+                       && allMinusOne(a.maxLength(), a.minLength(), 
a.maxItems(), a.minItems())
                        && empty(a.items());
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Path.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Path.java
index 14a126f..25be34d 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Path.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/annotation/Path.java
@@ -16,6 +16,7 @@ import static java.lang.annotation.ElementType.*;
 import static java.lang.annotation.RetentionPolicy.*;
 
 import java.lang.annotation.*;
+import java.util.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
@@ -623,6 +624,88 @@ public @interface Path {
        String pattern() default "";
 
        /**
+        * <mk>maxItems</mk> field of the {@doc SwaggerParameterObject}.
+        *
+        * <p>
+        * An array or collection is valid if its size is less than, or equal 
to, the value of this keyword.
+        *
+        * <p>
+        * If validation fails during serialization or parsing, the part 
serializer/parser will throw a {@link SchemaValidationException}.
+        * <br>On the client-side, this gets converted to a 
<code>RestCallException</code> which is thrown before the connection is made.
+        * <br>On the server-side, this gets converted to a 
<code>BadRequest</code> (400).
+        *
+        * <p>
+        * Only allowed for the following types: <js>"array"</js>.
+        *
+        * <h5 class='section'>Used for:</h5>
+        * <ul class='spaced-list'>
+        *      <li>
+        *              Server-side schema-based parsing validation.
+        *      <li>
+        *              Server-side generated Swagger documentation.
+        *      <li>
+        *              Client-side schema-based serializing validation.
+        * </ul>
+        */
+       long maxItems() default -1;
+
+       /**
+        * <mk>minItems</mk> field of the {@doc SwaggerParameterObject}.
+        *
+        * <p>
+        * An array or collection is valid if its size is greater than, or 
equal to, the value of this keyword.
+        *
+        * <p>
+        * If validation fails during serialization or parsing, the part 
serializer/parser will throw a {@link SchemaValidationException}.
+        * <br>On the client-side, this gets converted to a 
<code>RestCallException</code> which is thrown before the connection is made.
+        * <br>On the server-side, this gets converted to a 
<code>BadRequest</code> (400).
+        *
+        * <p>
+        * Only allowed for the following types: <js>"array"</js>.
+        *
+        * <h5 class='section'>Used for:</h5>
+        * <ul class='spaced-list'>
+        *      <li>
+        *              Server-side schema-based parsing validation.
+        *      <li>
+        *              Server-side generated Swagger documentation.
+        *      <li>
+        *              Client-side schema-based serializing validation.
+        * </ul>
+        */
+       long minItems() default -1;
+
+       /**
+        * <mk>uniqueItems</mk> field of the {@doc SwaggerParameterObject}.
+        *
+        * <p>
+        * If <jk>true</jk> the input validates successfully if all of its 
elements are unique.
+        *
+        * <p>
+        * If validation fails during serialization or parsing, the part 
serializer/parser will throw a {@link SchemaValidationException}.
+        * <br>On the client-side, this gets converted to a 
<code>RestCallException</code> which is thrown before the connection is made.
+        * <br>On the server-side, this gets converted to a 
<code>BadRequest</code> (400).
+        *
+        * <p>
+        * If the parameter type is a subclass of {@link Set}, this validation 
is skipped (since a set can only contain unique items anyway).
+        * <br>Otherwise, the collection or array is checked for duplicate 
items.
+        *
+        * <p>
+        * Only allowed for the following types: <js>"array"</js>.
+        *
+        * <h5 class='section'>Used for:</h5>
+        * <ul class='spaced-list'>
+        *      <li>
+        *              Server-side schema-based parsing validation.
+        *      <li>
+        *              Server-side generated Swagger documentation.
+        *      <li>
+        *              Client-side schema-based serializing validation.
+        * </ul>
+        */
+       boolean uniqueItems() default false;
+
+       /**
         * <mk>enum</mk> field of the {@doc SwaggerParameterObject}.
         *
         * <p>
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java
index ffc3b9e..eaed0df 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchemaBuilder.java
@@ -252,6 +252,9 @@ public class HttpPartSchemaBuilder {
                maxLength(a.maxLength());
                minLength(a.minLength());
                pattern(a.pattern());
+               maxItems(a.maxItems());
+               minItems(a.minItems());
+               uniqueItems(a.uniqueItems());
                _enum(HttpPartSchema.toSet(a._enum()));
                multipleOf(HttpPartSchema.toNumber(a.multipleOf()));
                parser(a.parser());
diff --git 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
index d2b5fc3..78be420 100644
--- 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
+++ 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
@@ -701,4 +701,64 @@ public class FormDataAnnotationTest {
                try { dr.postC16c((byte)10); } catch (Exception e) { 
assertContains(e, "Maximum value exceeded"); }
                assertEquals("{}", dr.postC16c(null));
        }
+
+       
//=================================================================================================================
+       // @FormData(maxItems,minItems,uniqueItems)
+       
//=================================================================================================================
+
+       @RestResource
+       public static class E {
+               @RestMethod
+               public String post(@FormData("*") ObjectMap m) {
+                       return m.toString();
+               }
+       }
+       private static MockRest e = MockRest.create(E.class);
+
+       @RemoteResource
+       public static interface ER {
+               @RemoteMethod(path="/") String 
postE01(@FormData(name="x",collectionFormat="pipes",minItems=1,maxItems=2) 
String...b);
+               @RemoteMethod(path="/") String 
postE02(@FormData(name="x",items=@Items(collectionFormat="pipes",minItems=1,maxItems=2))
 String[]...b);
+               @RemoteMethod(path="/") String 
postE03(@FormData(name="x",collectionFormat="pipes",uniqueItems=false) 
String...b);
+               @RemoteMethod(path="/") String 
postE04(@FormData(name="x",items=@Items(collectionFormat="pipes",uniqueItems=false))
 String[]...b);
+               @RemoteMethod(path="/") String 
postE05(@FormData(name="x",collectionFormat="pipes",uniqueItems=true) 
String...b);
+               @RemoteMethod(path="/") String 
postE06(@FormData(name="x",items=@Items(collectionFormat="pipes",uniqueItems=true))
 String[]...b);
+       }
+
+       private static ER er = 
RestClient.create().mockHttpConnection(e).build().getRemoteResource(ER.class);
+
+       @Test
+       public void e01_minMax() throws Exception {
+               assertEquals("{x:'1'}", er.postE01("1"));
+               assertEquals("{x:'1|2'}", er.postE01("1","2"));
+               try { er.postE01(); } catch (Exception e) { assertContains(e, 
"Minimum number of items not met"); }
+               try { er.postE01("1","2","3"); } catch (Exception e) { 
assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.postE01((String)null));
+       }
+       @Test
+       public void e02_minMax_items() throws Exception {
+               assertEquals("{x:'1'}", er.postE02(new String[]{"1"}));
+               assertEquals("{x:'1|2'}", er.postE02(new String[]{"1","2"}));
+               try { er.postE02(new String[]{}); } catch (Exception e) { 
assertContains(e, "Minimum number of items not met"); }
+               try { er.postE02(new String[]{"1","2","3"}); } catch (Exception 
e) { assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.postE02(new String[]{null}));
+       }
+       @Test
+       public void e03_uniqueItems_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.postE03("1","1"));
+       }
+       @Test
+       public void e04_uniqueItems_items_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.postE04(new String[]{"1","1"}));
+       }
+       @Test
+       public void e05_uniqueItems_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.postE05("1","2"));
+               try { assertEquals("{x:'1|1'}", er.postE05("1","1")); } catch 
(Exception e) { assertContains(e, "Duplicate items not allowed"); }
+       }
+       @Test
+       public void e06_uniqueItems_items_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.postE06(new String[]{"1","2"}));
+               try { assertEquals("{x:'1|1'}", er.postE06(new 
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items 
not allowed"); }
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
index 8037a0c..72a8afd 100644
--- 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
+++ 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
@@ -643,4 +643,65 @@ public class HeaderAnnotationTest {
                try { dr.getC16c((byte)10); } catch (Exception e) { 
assertContains(e, "Maximum value exceeded"); }
                assertEquals("{}", dr.getC16c(null));
        }
+
+       
//=================================================================================================================
+       // @Header(maxItems,minItems,uniqueItems)
+       
//=================================================================================================================
+
+       @RestResource
+       public static class E {
+               @RestMethod
+               public String get(@Header("*") ObjectMap m) {
+                       
m.removeAll("Accept-Encoding","Connection","Host","User-Agent");
+                       return m.toString();
+               }
+       }
+       private static MockRest e = MockRest.create(E.class);
+
+       @RemoteResource
+       public static interface ER {
+               @RemoteMethod(path="/") String 
getE01(@Header(name="x",collectionFormat="pipes",minItems=1,maxItems=2) 
String...b);
+               @RemoteMethod(path="/") String 
getE02(@Header(name="x",items=@Items(collectionFormat="pipes",minItems=1,maxItems=2))
 String[]...b);
+               @RemoteMethod(path="/") String 
getE03(@Header(name="x",collectionFormat="pipes",uniqueItems=false) String...b);
+               @RemoteMethod(path="/") String 
getE04(@Header(name="x",items=@Items(collectionFormat="pipes",uniqueItems=false))
 String[]...b);
+               @RemoteMethod(path="/") String 
getE05(@Header(name="x",collectionFormat="pipes",uniqueItems=true) String...b);
+               @RemoteMethod(path="/") String 
getE06(@Header(name="x",items=@Items(collectionFormat="pipes",uniqueItems=true))
 String[]...b);
+       }
+
+       private static ER er = 
RestClient.create().mockHttpConnection(e).build().getRemoteResource(ER.class);
+
+       @Test
+       public void e01_minMax() throws Exception {
+               assertEquals("{x:'1'}", er.getE01("1"));
+               assertEquals("{x:'1|2'}", er.getE01("1","2"));
+               try { er.getE01(); } catch (Exception e) { assertContains(e, 
"Minimum number of items not met"); }
+               try { er.getE01("1","2","3"); } catch (Exception e) { 
assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.getE01((String)null));
+       }
+       @Test
+       public void e02_minMax_items() throws Exception {
+               assertEquals("{x:'1'}", er.getE02(new String[]{"1"}));
+               assertEquals("{x:'1|2'}", er.getE02(new String[]{"1","2"}));
+               try { er.getE02(new String[]{}); } catch (Exception e) { 
assertContains(e, "Minimum number of items not met"); }
+               try { er.getE02(new String[]{"1","2","3"}); } catch (Exception 
e) { assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.getE02(new String[]{null}));
+       }
+       @Test
+       public void e03_uniqueItems_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.getE03("1","1"));
+       }
+       @Test
+       public void e04_uniqueItems_items_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.getE04(new String[]{"1","1"}));
+       }
+       @Test
+       public void e05_uniqueItems_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.getE05("1","2"));
+               try { assertEquals("{x:'1|1'}", er.getE05("1","1")); } catch 
(Exception e) { assertContains(e, "Duplicate items not allowed"); }
+       }
+       @Test
+       public void e06_uniqueItems_items_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.getE06(new String[]{"1","2"}));
+               try { assertEquals("{x:'1|1'}", er.getE06(new 
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items 
not allowed"); }
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
index eed34f9..bcb56be 100644
--- 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
+++ 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
@@ -577,4 +577,65 @@ public class PathAnnotationTest {
                try { dr.getC16c((byte)10); } catch (Exception e) { 
assertContains(e, "Maximum value exceeded"); }
                assertEquals("{x:'null'}", dr.getC16c(null));
        }
+
+       
//=================================================================================================================
+       // @Path(maxItems,minItems,uniqueItems)
+       
//=================================================================================================================
+
+       @RestResource
+       public static class E {
+               @RestMethod(path="/{x}")
+               public String get(@Path("*") ObjectMap m) {
+                       m.removeAll("/*","/**");
+                       return m.toString();
+               }
+       }
+       private static MockRest e = MockRest.create(E.class);
+
+       @RemoteResource
+       public static interface ER {
+               @RemoteMethod(path="/{x}") String 
getE01(@Path(name="x",collectionFormat="pipes",minItems=1,maxItems=2) 
String...b);
+               @RemoteMethod(path="/{x}") String 
getE02(@Path(name="x",items=@Items(collectionFormat="pipes",minItems=1,maxItems=2))
 String[]...b);
+               @RemoteMethod(path="/{x}") String 
getE03(@Path(name="x",collectionFormat="pipes",uniqueItems=false) String...b);
+               @RemoteMethod(path="/{x}") String 
getE04(@Path(name="x",items=@Items(collectionFormat="pipes",uniqueItems=false)) 
String[]...b);
+               @RemoteMethod(path="/{x}") String 
getE05(@Path(name="x",collectionFormat="pipes",uniqueItems=true) String...b);
+               @RemoteMethod(path="/{x}") String 
getE06(@Path(name="x",items=@Items(collectionFormat="pipes",uniqueItems=true)) 
String[]...b);
+       }
+
+       private static ER er = 
RestClient.create().mockHttpConnection(e).build().getRemoteResource(ER.class);
+
+       @Test
+       public void e01_minMax() throws Exception {
+               assertEquals("{x:'1'}", er.getE01("1"));
+               assertEquals("{x:'1|2'}", er.getE01("1","2"));
+               try { er.getE01(); } catch (Exception e) { assertContains(e, 
"Minimum number of items not met"); }
+               try { er.getE01("1","2","3"); } catch (Exception e) { 
assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.getE01((String)null));
+       }
+       @Test
+       public void e02_minMax_items() throws Exception {
+               assertEquals("{x:'1'}", er.getE02(new String[]{"1"}));
+               assertEquals("{x:'1|2'}", er.getE02(new String[]{"1","2"}));
+               try { er.getE02(new String[]{}); } catch (Exception e) { 
assertContains(e, "Minimum number of items not met"); }
+               try { er.getE02(new String[]{"1","2","3"}); } catch (Exception 
e) { assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.getE02(new String[]{null}));
+       }
+       @Test
+       public void e03_uniqueItems_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.getE03("1","1"));
+       }
+       @Test
+       public void e04_uniqueItems_items_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.getE04(new String[]{"1","1"}));
+       }
+       @Test
+       public void e05_uniqueItems_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.getE05("1","2"));
+               try { assertEquals("{x:'1|1'}", er.getE05("1","1")); } catch 
(Exception e) { assertContains(e, "Duplicate items not allowed"); }
+       }
+       @Test
+       public void e06_uniqueItems_items_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.getE06(new String[]{"1","2"}));
+               try { assertEquals("{x:'1|1'}", er.getE06(new 
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items 
not allowed"); }
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
index 0c929c9..14ed20a 100644
--- 
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
+++ 
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
@@ -701,4 +701,64 @@ public class QueryAnnotationTest {
                try { dr.getC16c((byte)10); } catch (Exception e) { 
assertContains(e, "Maximum value exceeded"); }
                assertEquals("{}", dr.getC16c(null));
        }
+
+       
//=================================================================================================================
+       // @Query(maxItems,minItems,uniqueItems)
+       
//=================================================================================================================
+
+       @RestResource
+       public static class E {
+               @RestMethod
+               public String get(@Query("*") ObjectMap m) {
+                       return m.toString();
+               }
+       }
+       private static MockRest e = MockRest.create(E.class);
+
+       @RemoteResource
+       public static interface ER {
+               @RemoteMethod(path="/") String 
getE01(@Query(name="x",collectionFormat="pipes",minItems=1,maxItems=2) 
String...b);
+               @RemoteMethod(path="/") String 
getE02(@Query(name="x",items=@Items(collectionFormat="pipes",minItems=1,maxItems=2))
 String[]...b);
+               @RemoteMethod(path="/") String 
getE03(@Query(name="x",collectionFormat="pipes",uniqueItems=false) String...b);
+               @RemoteMethod(path="/") String 
getE04(@Query(name="x",items=@Items(collectionFormat="pipes",uniqueItems=false))
 String[]...b);
+               @RemoteMethod(path="/") String 
getE05(@Query(name="x",collectionFormat="pipes",uniqueItems=true) String...b);
+               @RemoteMethod(path="/") String 
getE06(@Query(name="x",items=@Items(collectionFormat="pipes",uniqueItems=true)) 
String[]...b);
+       }
+
+       private static ER er = 
RestClient.create().mockHttpConnection(e).build().getRemoteResource(ER.class);
+
+       @Test
+       public void e01_minMax() throws Exception {
+               assertEquals("{x:'1'}", er.getE01("1"));
+               assertEquals("{x:'1|2'}", er.getE01("1","2"));
+               try { er.getE01(); } catch (Exception e) { assertContains(e, 
"Minimum number of items not met"); }
+               try { er.getE01("1","2","3"); } catch (Exception e) { 
assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.getE01((String)null));
+       }
+       @Test
+       public void e02_minMax_items() throws Exception {
+               assertEquals("{x:'1'}", er.getE02(new String[]{"1"}));
+               assertEquals("{x:'1|2'}", er.getE02(new String[]{"1","2"}));
+               try { er.getE02(new String[]{}); } catch (Exception e) { 
assertContains(e, "Minimum number of items not met"); }
+               try { er.getE02(new String[]{"1","2","3"}); } catch (Exception 
e) { assertContains(e, "Maximum number of items exceeded"); }
+               assertEquals("{x:'null'}", er.getE02(new String[]{null}));
+       }
+       @Test
+       public void e03_uniqueItems_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.getE03("1","1"));
+       }
+       @Test
+       public void e04_uniqueItems_items_false() throws Exception {
+               assertEquals("{x:'1|1'}", er.getE04(new String[]{"1","1"}));
+       }
+       @Test
+       public void e05_uniqueItems_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.getE05("1","2"));
+               try { assertEquals("{x:'1|1'}", er.getE05("1","1")); } catch 
(Exception e) { assertContains(e, "Duplicate items not allowed"); }
+       }
+       @Test
+       public void e06_uniqueItems_items_true() throws Exception {
+               assertEquals("{x:'1|2'}", er.getE06(new String[]{"1","2"}));
+               try { assertEquals("{x:'1|1'}", er.getE06(new 
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items 
not allowed"); }
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
index e70f4e4..5c750cc 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/SwaggerGenerator.java
@@ -942,12 +942,15 @@ final class SwaggerGenerator {
                        .appendSkipEmpty("format", a.format())
                        .appendSkipEmpty("items", 
merge(om.getObjectMap("items"), a.items()))
                        .appendSkipEmpty("maximum", a.maximum())
+                       .appendSkipMinusOne("maxItems", a.maxItems())
                        .appendSkipMinusOne("maxLength", a.maxLength())
                        .appendSkipEmpty("minimum", a.minimum())
+                       .appendSkipMinusOne("minItems", a.minItems())
                        .appendSkipMinusOne("minLength", a.minLength())
                        .appendSkipEmpty("multipleOf", a.multipleOf())
                        .appendSkipEmpty("pattern", a.pattern())
                        .appendSkipEmpty("type", a.type())
+                       .appendSkipFalse("uniqueItems", a.uniqueItems())
                ;
        }
 

Reply via email to