mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
Merge branch 'Rogercf-support-to-array-of-enums' into develop_2.0
This commit is contained in:
commit
9531e1ae59
@ -34,6 +34,7 @@ public class CodegenProperty {
|
||||
public boolean isEnum;
|
||||
public List<String> _enum;
|
||||
public Map<String, Object> allowableValues;
|
||||
public CodegenProperty items;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
@ -136,6 +137,4 @@ public class CodegenProperty {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -676,7 +676,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 {
|
||||
@ -686,6 +686,12 @@ public class DefaultCodegen {
|
||||
} else {
|
||||
property.isPrimitiveType = true;
|
||||
}
|
||||
property.items = cp;
|
||||
if (property.items.isEnum) {
|
||||
property.datatypeWithEnum = property.datatypeWithEnum.replace(property.items.baseType,
|
||||
property.items.datatypeWithEnum);
|
||||
property.defaultValue = property.defaultValue.replace(property.items.baseType, property.items.datatypeWithEnum);
|
||||
}
|
||||
}
|
||||
} else if (p instanceof MapProperty) {
|
||||
property.isContainer = true;
|
||||
|
@ -18,11 +18,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
{{>generatedAnnotation}}
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#vars}}{{#isEnum}}
|
||||
public enum {{datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}}
|
||||
};{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
public enum {{datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}}
|
||||
};
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/isEnum}}{{^isEnum}}
|
||||
private {{{datatype}}} {{name}} = {{{defaultValue}}};{{/isEnum}}{{/vars}}
|
||||
{{/items}}{{/items.isEnum}}
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
/**{{#description}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user