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,16 +519,20 @@ public class DefaultCodegen {
|
|||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
property.isNotContainer = true;
|
setNonArrayMapProperty(property, type);
|
||||||
if(languageSpecificPrimitives().contains(type))
|
|
||||||
property.isPrimitiveType = true;
|
|
||||||
else
|
|
||||||
property.complexType = property.baseType;
|
|
||||||
}
|
}
|
||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation){
|
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||||
|
property.isNotContainer = true;
|
||||||
|
if(languageSpecificPrimitives().contains(type))
|
||||||
|
property.isPrimitiveType = true;
|
||||||
|
else
|
||||||
|
property.complexType = property.baseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation){
|
||||||
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
||||||
Set<String> imports = new HashSet<String>();
|
Set<String> imports = new HashSet<String>();
|
||||||
|
|
||||||
|
@ -168,7 +168,18 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
public String toModelImport(String name) {
|
||||||
if("".equals(modelPackage()))
|
if("".equals(modelPackage()))
|
||||||
return name;
|
return name;
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
{{/isContainer}}{{#isNotContainer}}
|
{{/isContainer}}{{#isNotContainer}}
|
||||||
if({{name}}_dict != nil)
|
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}}
|
{{/isNotContainer}}
|
||||||
{{/complexType}}
|
{{/complexType}}
|
||||||
{{/vars}}{{newline}}
|
{{/vars}}{{newline}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user