Skip to content

Commit 5362e54

Browse files
committed
#10125 fix DefaultCodegen parsing to handle 'uniqueItems' flag
1 parent bdec255 commit 5362e54

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class CodegenProperty implements Cloneable {
5656
public String enumName;
5757
public Integer maxItems;
5858
public Integer minItems;
59+
public boolean uniqueItems;
5960

6061
// XML
6162
public boolean isXmlAttribute = false;

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,7 @@ private CodegenProperty fromProperty(String name, Property p, Integer itemsDepth
19321932
ArrayProperty ap = (ArrayProperty) p;
19331933
property.maxItems = ap.getMaxItems();
19341934
property.minItems = ap.getMinItems();
1935+
property.uniqueItems = ap.getUniqueItems() == null ? false : ap.getUniqueItems();
19351936
String itemName = (String) p.getVendorExtensions().get("x-item-name");
19361937
if (itemName == null) {
19371938
itemName = property.name;

modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidationCore.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ isInteger set
1717
isLong set
1818
}}{{#isLong}}{{#minimum}} @Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{!
1919
Not Integer, not Long => we have a decimal value!
20-
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}}
20+
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}}{{!

0 commit comments

Comments
 (0)