Update DefaultCodegen.java

Setting the "items" field when the type is array and updating some values if the array is an array of enums
This commit is contained in:
Rogercf 2015-08-03 19:20:51 -03:00
parent aff766b785
commit a30b66beb1

View File

@ -671,7 +671,7 @@ public class DefaultCodegen {
property.isContainer = true; property.isContainer = true;
property.containerType = "array"; property.containerType = "array";
ArrayProperty ap = (ArrayProperty) p; ArrayProperty ap = (ArrayProperty) p;
CodegenProperty cp = fromProperty("inner", ap.getItems()); CodegenProperty cp = fromProperty(property.name, ap.getItems());
if (cp == null) { if (cp == null) {
LOGGER.warn("skipping invalid property " + Json.pretty(p)); LOGGER.warn("skipping invalid property " + Json.pretty(p));
} else { } else {
@ -681,7 +681,14 @@ public class DefaultCodegen {
} else { } else {
property.isPrimitiveType = true; property.isPrimitiveType = true;
} }
property.items = cp;
if (property.items.isEnum) {
property.datatypeWithEnum = property.datatypeWithEnum.replace("String",
property.items.datatypeWithEnum);
property.defaultValue = property.defaultValue.replace("String", property.items.datatypeWithEnum);
} }
}
} else if (p instanceof MapProperty) { } else if (p instanceof MapProperty) {
property.isContainer = true; property.isContainer = true;
property.containerType = "map"; property.containerType = "map";