forked from loafle/openapi-generator-original
Merge pull request #3267 from wing328/swift_npe
[Swift] fix NPE for swift API client due to array of enum
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user