Skip to content

Commit d43fd55

Browse files
committed
#756: fixed empty enumerations.
1 parent af8ed71 commit d43fd55

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,18 @@ public void processModelEnums(Map<String, Object> objs) {
358358
}
359359
cm.allowableValues.put("enumVars", enumVars);
360360
}
361+
updateCodegenModelEnumVars(cm);
362+
}
363+
}
361364

362-
// update codegen property enum with proper naming convention
363-
// and handling of numbers, special characters
364-
for (CodegenProperty var : cm.vars) {
365-
updateCodegenPropertyEnum(var);
366-
}
365+
/**
366+
* update codegen property enum with proper naming convention
367+
* and handling of numbers, special characters
368+
* @param codegenModel
369+
*/
370+
protected void updateCodegenModelEnumVars(CodegenModel codegenModel) {
371+
for (CodegenProperty var : codegenModel.vars) {
372+
updateCodegenPropertyEnum(var);
367373
}
368374
}
369375

src/main/java/io/swagger/codegen/v3/generators/swift/Swift5Codegen.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,14 @@ public Swift5Codegen() {
196196
typeMapping.put("float", "Float");
197197
typeMapping.put("number", "Double");
198198
typeMapping.put("double", "Double");
199-
typeMapping.put("object", "JSONValue");
199+
typeMapping.put("object", "Any");
200+
typeMapping.put("Object", "Any");
200201
typeMapping.put("file", "URL");
201202
typeMapping.put("binary", "Data");
202203
typeMapping.put("ByteArray", "Data");
203204
typeMapping.put("UUID", "UUID");
205+
typeMapping.put("URI", "String");
206+
typeMapping.put("BigDecimal", "Decimal");
204207

205208
importMapping = new HashMap<>();
206209

@@ -599,6 +602,13 @@ public CodegenModel fromModel(String name, Schema model, Map<String, Schema> all
599602
return codegenModel;
600603
}
601604

605+
protected void updateCodegenModelEnumVars(CodegenModel codegenModel) {
606+
super.updateCodegenModelEnumVars(codegenModel);
607+
for (CodegenProperty var : codegenModel.allVars) {
608+
updateCodegenPropertyEnum(var);
609+
}
610+
}
611+
602612
@Override
603613
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Schema> definitions, OpenAPI openAPI) {
604614
CodegenOperation codegenOperation = super.fromOperation(path, httpMethod, operation, definitions, openAPI);

0 commit comments

Comments
 (0)