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.containerType = "array";
ArrayProperty ap = (ArrayProperty) p;
CodegenProperty cp = fromProperty("inner", ap.getItems());
CodegenProperty cp = fromProperty(property.name, ap.getItems());
if (cp == null) {
LOGGER.warn("skipping invalid property " + Json.pretty(p));
} else {
@ -681,7 +681,14 @@ public class DefaultCodegen {
} else {
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) {
property.isContainer = true;
property.containerType = "map";