From f8c794389addb94d3956093ab43141ea4cf1a4fe Mon Sep 17 00:00:00 2001 From: Akshay PANDEY Date: Sun, 7 Jun 2020 13:51:35 +0530 Subject: [PATCH] #10125 fix DefaultCodegen parsing to handle 'uniqueItems' flag --- .../src/main/java/io/swagger/codegen/CodegenProperty.java | 1 + .../src/main/java/io/swagger/codegen/DefaultCodegen.java | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java index 19255c8b9bd..57352356654 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java @@ -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; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 74665c0f09d..39d8028a7de 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -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;