Skip to content

Commit

Permalink
#10125 fix DefaultCodegen parsing to handle 'uniqueItems' flag
Browse files Browse the repository at this point in the history
  • Loading branch information
akshpan committed Feb 1, 2021
1 parent bdec255 commit 2e49967
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class CodegenProperty implements Cloneable {
public String enumName;
public Integer maxItems;
public Integer minItems;
public boolean uniqueItems;

// XML
public boolean isXmlAttribute = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ private CodegenProperty fromProperty(String name, Property p, Integer itemsDepth
ArrayProperty ap = (ArrayProperty) p;
property.maxItems = ap.getMaxItems();
property.minItems = ap.getMinItems();
property.uniqueItems = ap.getUniqueItems() == null ? false : ap.getUniqueItems();
String itemName = (String) p.getVendorExtensions().get("x-item-name");
if (itemName == null) {
itemName = property.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ isInteger set
isLong set
}}{{#isLong}}{{#minimum}} @Min({{minimum}}L){{/minimum}}{{#maximum}} @Max({{maximum}}L){{/maximum}}{{/isLong}}{{!
Not Integer, not Long => we have a decimal value!
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}}
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}}{{!
uniqueItems set
}}{{#uniqueItems}} @UniqueElements {{/uniqueItems}}

0 comments on commit 2e49967

Please sign in to comment.