updated templates to fix petstore build error

This commit is contained in:
Tony Tam 2015-03-24 19:56:28 -07:00
parent e82ecf695d
commit 2ce0049ce4
2 changed files with 32 additions and 11 deletions

View File

@ -110,18 +110,25 @@ static NSString * basePath = @"{{basePath}}";
}
{{/bodyParam}}
{{^bodyParam}}
bodyDictionary = [[NSMutableArray alloc] init];
NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init];
{{#formParams}}{{#notFile}}
{{#formParams}}
{{#notFile}}
formParams[@"{{paramName}}"] = {{paramName}};
{{/notFile}}{{#isFile}}
requestContentType = @"multipart/form-data";
if(bodyDictionary == nil) {
bodyDictionary = [[NSMutableArray alloc] init];
}
[bodyDictionary addObject:{{paramName}}];
{{paramName}}.paramName = @"{{baseName}}";
{{/isFile}}{{/formParams}}
{{/isFile}}
if(bodyDictionary == nil) {
bodyDictionary = [[NSMutableArray alloc] init];
}
[bodyDictionary addObject:formParams];
{{/formParams}}
{{/bodyParam}}
{{#requiredParamCount}}
@ -134,11 +141,26 @@ static NSString * basePath = @"{{basePath}}";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
{{#returnContainer}}{{>apiBodyResponseWithContainer}}{{/returnContainer}}
{{#returnContainer}}
// response is in a container
{{>apiBodyResponseWithContainer}}{{/returnContainer}}
{{#returnSimpleType}}
{{#returnTypeIsPrimitive}}{{>apiPrimitiveResponse}}{{/returnTypeIsPrimitive}}
{{#returnBaseType}}{{>apiNonPrimitiveResponse}}{{/returnBaseType}}
// non container response
{{#returnTypeIsPrimitive}}
// primitive response
{{>apiPrimitiveResponse}}{{/returnTypeIsPrimitive}}
{{#returnBaseType}}
// complex response
{{>apiNonPrimitiveResponse}}{{/returnBaseType}}
{{/returnSimpleType}}
{{^returnSimpleType}}{{^returnContainer}}
// it's void
{{>voidResponse}}
{{/returnContainer}}{{/returnSimpleType}}
}
{{/operation}}

View File

@ -13,12 +13,11 @@
{{^returnBaseType}}completionBlock(error);{{/returnBaseType}}
return;
}
{{#returnBaseType}}
{{returnBaseType}} *result = nil;
{{#returnType}}{{returnType}} result = nil;
if (data) {
result = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{returnBaseType}}} {{/instantiationType}} alloc]initWithValues: data];
result = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{returnBaseType}}} {{/instantiationType}} alloc] {{#returnContainer}}{{#isMapContainer}}initWithDictionary{{/isMapContainer}}{{#isListContainer}}initWithValues{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}initWithValues {{/returnContainer}}: data];
}
{{#returnBaseType}}completionBlock(result , nil);{{/returnBaseType}}
{{/returnBaseType}}
{{#returnType}}completionBlock(result , nil);{{/returnType}}
{{/returnType}}
}];
{{/returnTypeIsPrimitive}}