added enum class support

This commit is contained in:
Tony Tam
2015-12-18 08:12:15 -05:00
parent 2e81bf34ce
commit 5b0b759e4e
5 changed files with 68 additions and 58 deletions

View File

@@ -13,11 +13,12 @@ public class CodegenModel {
public String unescapedDescription;
public String defaultValue;
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
public List<String> allowableValues;
// list of all required parameters
public Set<String> mandatory = new HashSet<String>();
public Set<String> imports = new HashSet<String>();
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums;
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum;
public ExternalDocs externalDocs;
}

View File

@@ -837,6 +837,10 @@ public class DefaultCodegen {
addVars(m, properties, required);
} else {
ModelImpl impl = (ModelImpl) model;
if(impl.getEnum() != null && impl.getEnum().size() > 0) {
m.isEnum = true;
m.allowableValues = impl.getEnum();
}
if (impl.getAdditionalProperties() != null) {
MapProperty mapProperty = new MapProperty(impl.getAdditionalProperties());
addParentContainer(m, name, mapProperty);