forked from loafle/openapi-generator-original
Fixed bug that prevented Objective-C code from compiling when using a Swagger 'map' type
This commit is contained in:
parent
ff94196295
commit
d313d4da3f
@ -519,14 +519,18 @@ public class DefaultCodegen {
|
||||
property.isPrimitiveType = true;
|
||||
}
|
||||
else {
|
||||
setNonArrayMapProperty(property, type);
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||
property.isNotContainer = true;
|
||||
if(languageSpecificPrimitives().contains(type))
|
||||
property.isPrimitiveType = true;
|
||||
else
|
||||
property.complexType = property.baseType;
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation){
|
||||
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
||||
|
@ -168,6 +168,17 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||
super.setNonArrayMapProperty(property, type);
|
||||
if("NSDictionary".equals(type)) {
|
||||
property.setter = "initWithDictionary";
|
||||
}
|
||||
else {
|
||||
property.setter = "initWithValues";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelImport(String name) {
|
||||
if("".equals(modelPackage()))
|
||||
|
@ -39,7 +39,7 @@
|
||||
}
|
||||
{{/isContainer}}{{#isNotContainer}}
|
||||
if({{name}}_dict != nil)
|
||||
_{{name}} = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{complexType}}} {{/instantiationType}} alloc]initWithValues:{{name}}_dict];
|
||||
_{{name}} = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{complexType}}} {{/instantiationType}} alloc]{{setter}}:{{name}}_dict];
|
||||
{{/isNotContainer}}
|
||||
{{/complexType}}
|
||||
{{/vars}}{{newline}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user