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

View File

@ -13,12 +13,11 @@
{{^returnBaseType}}completionBlock(error);{{/returnBaseType}} {{^returnBaseType}}completionBlock(error);{{/returnBaseType}}
return; return;
} }
{{#returnBaseType}} {{#returnType}}{{returnType}} result = nil;
{{returnBaseType}} *result = nil;
if (data) { 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}} {{#returnType}}completionBlock(result , nil);{{/returnType}}
{{/returnBaseType}} {{/returnType}}
}]; }];
{{/returnTypeIsPrimitive}} {{/returnTypeIsPrimitive}}