forked from loafle/openapi-generator-original
Merge pull request #459 from geoand/objc-dictionary-fix-dev2_0
Fixed bug that prevented Objective-C code from compiling when using a Sw...
This commit is contained in:
commit
8262d30202
@ -16,7 +16,7 @@ Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additi
|
|||||||
## Compatability
|
## Compatability
|
||||||
The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the swagger specification:
|
The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the swagger specification:
|
||||||
|
|
||||||
Swagger Codegen Version | Release Date | Swagger Spec compatability | Notes
|
Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes
|
||||||
----------------------- | ------------ | -------------------------- | -----
|
----------------------- | ------------ | -------------------------- | -----
|
||||||
2.1.3-M1-SNAPSHOT | 2015-02-23 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.0-M1](https://github.com/swagger-api/swagger-codegen)
|
2.1.3-M1-SNAPSHOT | 2015-02-23 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.0-M1](https://github.com/swagger-api/swagger-codegen)
|
||||||
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
|
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
|
||||||
|
@ -554,14 +554,18 @@ public class DefaultCodegen {
|
|||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
property.isNotContainer = true;
|
setNonArrayMapProperty(property, type);
|
||||||
|
}
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||||
|
property.isNotContainer = true;
|
||||||
if(languageSpecificPrimitives().contains(type))
|
if(languageSpecificPrimitives().contains(type))
|
||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
else
|
else
|
||||||
property.complexType = property.baseType;
|
property.complexType = property.baseType;
|
||||||
}
|
}
|
||||||
return property;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Response findMethodResponse(Map<String, Response> responses) {
|
private Response findMethodResponse(Map<String, Response> responses) {
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -165,12 +165,12 @@ public class ApiInvoker {
|
|||||||
|
|
||||||
Builder builder = client.resource(host + path + querystring).accept("application/json");
|
Builder builder = client.resource(host + path + querystring).accept("application/json");
|
||||||
for(String key : headerParams.keySet()) {
|
for(String key : headerParams.keySet()) {
|
||||||
builder.header(key, headerParams.get(key));
|
builder = builder.header(key, headerParams.get(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String key : defaultHeaderMap.keySet()) {
|
for(String key : defaultHeaderMap.keySet()) {
|
||||||
if(!headerParams.containsKey(key)) {
|
if(!headerParams.containsKey(key)) {
|
||||||
builder.header(key, defaultHeaderMap.get(key));
|
builder = builder.header(key, defaultHeaderMap.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClientResponse response = null;
|
ClientResponse response = null;
|
||||||
|
@ -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}}
|
||||||
|
@ -226,7 +226,7 @@ class ApiClient:
|
|||||||
subValues.append(self.deserialize(subValue, subClass))
|
subValues.append(self.deserialize(subValue, subClass))
|
||||||
setattr(instance, attr, subValues)
|
setattr(instance, attr, subValues)
|
||||||
else:
|
else:
|
||||||
setattr(instance, attr, self.deserialize(value, objClass))
|
setattr(instance, attr, self.deserialize(value, attrType))
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user