forked from loafle/openapi-generator-original
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:
parent
aff766b785
commit
a30b66beb1
@ -667,22 +667,29 @@ public class DefaultCodegen {
|
|||||||
|
|
||||||
property.baseType = getSwaggerType(p);
|
property.baseType = getSwaggerType(p);
|
||||||
|
|
||||||
if (p instanceof ArrayProperty) {
|
if (p instanceof ArrayProperty) {
|
||||||
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 {
|
||||||
property.baseType = getSwaggerType(p);
|
property.baseType = getSwaggerType(p);
|
||||||
if (!languageSpecificPrimitives.contains(cp.baseType)) {
|
if (!languageSpecificPrimitives.contains(cp.baseType)) {
|
||||||
property.complexType = cp.baseType;
|
property.complexType = cp.baseType;
|
||||||
} else {
|
} else {
|
||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
}
|
}
|
||||||
}
|
property.items = cp;
|
||||||
} else if (p instanceof MapProperty) {
|
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.isContainer = true;
|
||||||
property.containerType = "map";
|
property.containerType = "map";
|
||||||
MapProperty ap = (MapProperty) p;
|
MapProperty ap = (MapProperty) p;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user