fix npe for swift due to array of enum

This commit is contained in:
wing328
2016-07-01 16:58:18 +08:00
parent 021f554a6b
commit 8c754d234d
19 changed files with 1355 additions and 89 deletions

View File

@@ -325,9 +325,17 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public CodegenProperty fromProperty(String name, Property p) {
CodegenProperty codegenProperty = super.fromProperty(name, p);
// TODO skip array/map of enum for the time being,
// we need to add logic here to handle array/map of enum for any
// dimensions
if (Boolean.TRUE.equals(codegenProperty.isContainer)) {
return codegenProperty;
}
if (codegenProperty.isEnum) {
List<Map<String, String>> swiftEnums = new ArrayList<Map<String, String>>();
List<String> values = (List<String>) codegenProperty.allowableValues.get("values");
for (String value : values) {
Map<String, String> map = new HashMap<String, String>();
map.put("enum", toSwiftyEnumName(value));