From 0a652a3d1344b3534fdc1d871773a025d782f30e Mon Sep 17 00:00:00 2001 From: geekerzp Date: Thu, 25 Jun 2015 11:45:38 +0800 Subject: [PATCH] Fix issue#896 https://github.com/swagger-api/swagger-codegen/issues/896 --- .../codegen/languages/ObjcClientCodegen.java | 7 +- .../resources/objc/SWGApiClient-body.mustache | 18 +- .../objc/SWGApiClient-header.mustache | 3 +- .../SWGJSONRequestSerializer-body.mustache | 35 ++++ .../SWGJSONRequestSerializer-header.mustache | 5 + .../src/main/resources/objc/api-body.mustache | 48 +++-- .../UserInterfaceState.xcuserstate | Bin 16336 -> 22901 bytes .../SwaggerClient.xcodeproj/project.pbxproj | 18 ++ .../SwaggerClient/ViewController.m | 55 ++---- .../petstore/objc/client/SWGApiClient.h | 3 +- .../petstore/objc/client/SWGApiClient.m | 18 +- .../objc/client/SWGJSONRequestSerializer.h | 5 + .../objc/client/SWGJSONRequestSerializer.m | 35 ++++ .../client/petstore/objc/client/SWGOrder.h | 2 +- .../client/petstore/objc/client/SWGPetApi.m | 146 +++++++--------- .../client/petstore/objc/client/SWGStoreApi.m | 58 +++---- .../client/petstore/objc/client/SWGUserApi.m | 164 +++++++----------- 17 files changed, 311 insertions(+), 309 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-body.mustache create mode 100644 modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-header.mustache create mode 100644 samples/client/petstore/objc/client/SWGJSONRequestSerializer.h create mode 100644 samples/client/petstore/objc/client/SWGJSONRequestSerializer.m diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 03905cbdfaf..5bfc5e59339 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -70,14 +70,15 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { "double", "protocol", "interface", "implementation", "NSObject", "NSInteger", "NSNumber", "CGFloat", "property", "nonatomic", "retain", "strong", - "weak", "unsafe_unretained", "readwrite", "readonly" + "weak", "unsafe_unretained", "readwrite", "readonly", + "description" )); typeMapping = new HashMap(); typeMapping.put("enum", "NSString"); typeMapping.put("Date", "NSDate"); typeMapping.put("DateTime", "NSDate"); - typeMapping.put("boolean", "BOOL"); + typeMapping.put("boolean", "NSNumber"); typeMapping.put("string", "NSString"); typeMapping.put("integer", "NSNumber"); typeMapping.put("int", "NSNumber"); @@ -147,6 +148,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("SWGApiClient-body.mustache", sourceFolder, "SWGApiClient.m")); supportingFiles.add(new SupportingFile("SWGJSONResponseSerializer-header.mustache", sourceFolder, "SWGJSONResponseSerializer.h")); supportingFiles.add(new SupportingFile("SWGJSONResponseSerializer-body.mustache", sourceFolder, "SWGJSONResponseSerializer.m")); + supportingFiles.add(new SupportingFile("SWGJSONRequestSerializer-body.mustache", sourceFolder, "SWGJSONRequestSerializer.m")); + supportingFiles.add(new SupportingFile("SWGJSONRequestSerializer-header.mustache", sourceFolder, "SWGJSONRequestSerializer.h")); supportingFiles.add(new SupportingFile("SWGFile.h", sourceFolder, "SWGFile.h")); supportingFiles.add(new SupportingFile("SWGFile.m", sourceFolder, "SWGFile.m")); supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.m", sourceFolder, "JSONValueTransformer+ISO8601.m")); diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache index 1b479d039e6..d7e6fac8385 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache @@ -486,7 +486,7 @@ static bool loggingEnabled = true; completionBlock: (void (^)(id, NSError *))completionBlock { // setting request serializer if ([requestContentType isEqualToString:@"application/json"]) { - self.requestSerializer = [AFJSONRequestSerializer serializer]; + self.requestSerializer = [SWGJSONRequestSerializer serializer]; } else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) { self.requestSerializer = [AFHTTPRequestSerializer serializer]; @@ -569,9 +569,11 @@ static bool loggingEnabled = true; parameters: body error: nil]; } + BOOL hasHeaderParams = false; - if(headerParams != nil && [headerParams count] > 0) + if(headerParams != nil && [headerParams count] > 0) { hasHeaderParams = true; + } if(offlineState) { NSLog(@"%@ cache forced", path); [request setCachePolicy:NSURLRequestReturnCacheDataDontLoad]; @@ -585,17 +587,7 @@ static bool loggingEnabled = true; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; } - - if(body != nil) { - if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){ - [self.requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"]; - } - else if ([body isKindOfClass:[SWGFile class]]){} - else { - NSAssert(false, @"unsupported post type!"); - } - } - if(headerParams != nil){ + if(hasHeaderParams){ for(NSString * key in [headerParams keyEnumerator]){ [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; } diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-header.mustache index 691c92cc625..d4bc3e3b81d 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-header.mustache @@ -1,7 +1,8 @@ #import #import #import "AFHTTPRequestOperationManager.h" -#import "SWGJSONResponseSerializer.h" +#import "SWGJSONResponseSerializer.h" +#import "SWGJSONRequestSerializer.h" {{#models}}{{#model}}#import "{{classname}}.h" {{/model}}{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-body.mustache new file mode 100644 index 00000000000..631a20a5a6e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-body.mustache @@ -0,0 +1,35 @@ +#import "SWGJSONRequestSerializer.h" + +@implementation SWGJSONRequestSerializer + +/// +/// When customize a request serializer, +/// the serializer must conform the protocol `AFURLRequestSerialization` +/// and implements the protocol method `requestBySerializingRequest:withParameters:error:` +/// +/// @param request The original request. +/// @param parameters The parameters to be encoded. +/// @param error The error that occurred while attempting to encode the request parameters. +/// +/// @return A serialized request. +/// +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + // If the body data which will be serialized isn't NSArray or NSDictionary + // then put the data in the http request body directly. + if ([parameters isKindOfClass:[NSArray class]] || [parameters isKindOfClass:[NSDictionary class]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } else { + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + if (parameters) { + [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; + } + + return mutableRequest; + } +} + +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-header.mustache new file mode 100644 index 00000000000..49dd7fca3e2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/SWGJSONRequestSerializer-header.mustache @@ -0,0 +1,5 @@ +#import +#import + +@interface SWGJSONRequestSerializer : AFJSONRequestSerializer +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache index 29dca1f4a7a..5bebfa063c2 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache @@ -89,7 +89,9 @@ static NSString * basePath = @"{{basePath}}"; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set - NSAssert({{paramName}} != nil, @"Missing the required parameter `{{paramName}}` when calling {{nickname}}"); + if ({{paramName}} == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `{{paramName}}` when calling `{{nickname}}`"]; + } {{/required}}{{/allParams}} NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@{{path}}", basePath]; @@ -135,14 +137,14 @@ static NSString * basePath = @"{{basePath}}"; // Authentication setting NSArray *authSettings = @[{{#authMethods}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}}]; - - id bodyDictionary = nil; - {{#bodyParam}} - id __body = {{paramName}}; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + {{#bodyParam}} + bodyParam = {{paramName}}; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -150,20 +152,10 @@ static NSString * basePath = @"{{basePath}}"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } {{/bodyParam}} {{^bodyParam}} @@ -175,18 +167,18 @@ static NSString * basePath = @"{{basePath}}"; formParams[@"{{paramName}}"] = {{paramName}}; {{/notFile}}{{#isFile}} requestContentType = @"multipart/form-data"; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; + if(bodyParam == nil) { + bodyParam = [[NSMutableArray alloc] init]; } if({{paramName}} != nil) { - [bodyDictionary addObject:{{paramName}}]; + [bodyParam addObject:{{paramName}}]; {{paramName}}.paramName = @"{{baseName}}"; } {{/isFile}} - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; + if(bodyParam == nil) { + bodyParam = [[NSMutableArray alloc] init]; } - [bodyDictionary addObject:formParams]; + [bodyParam addObject:formParams]; {{/formParams}} {{/bodyParam}} @@ -200,7 +192,7 @@ static NSString * basePath = @"{{basePath}}"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"{{httpMethod}}" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType diff --git a/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate b/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate index d8a48b72bc2eb6cb0a734c22a88f15e99e0edb35..fe0defcf775e1b7d2fc2e827c6672586a76ac126 100644 GIT binary patch literal 22901 zcmd6P2Ygf2_xQbUb*4?aXlc{54J{OCo21Qb(xih9Mj2(Vnl>p7og^txDtey-5kYW( zpeVEq0TD$-P~12`K?Fn;7ve%(xVQe#%WK*Oi(fzA-`DT=Pk|=y-Fxm?_ndRjJ@?kM zHo81smFiW55rt^PAQo}l$K1K8gXTNk9#>2A)IlvZbDgzb&$K~ycWu239#0(PZE1}{ zc*(~5WK<9eLcu5+#h_R;7!5(0Xeb(nhNCQ$jdG9*cQ_xg24NXTg z&`dN7%|;I7M01fFd5{;iq4}sC@#rdaEn14!qIKwYbO&0G?nHN?UFbe^KiZ8RKo6pa z(4%NSdKx{04xmHm2znVEMJLf4=tJ}o`WT%C7~jyNJ>h@P#M%KGPn=(@ts(`Xm zHmZ;sK~+#AsZrEuYBDv2nnl%84$4W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a+jb9soA^wN>Yw>p-$RTuy91@4zp>^mTMu*uEY zIo3Ps9h)3my^bA@mmRM--gUh1IOaI+IO#a+_`>m(zo^%Tb$dSyPUh7Z#v(09&(;^o^^iV{K|R3`GfN(=T+x*=S}CI&ie_%1XV(0 zf+-<7Auhq0kd%;|&?=!#LV7~agnnZQ098Ecvay&IYwL@y>)SiK+0-?Y+m;AV;dHj{y`~Lv3TX5+B diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj index ac15f78e357..1424f7b9cfe 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj @@ -11,10 +11,13 @@ CF0560EB1B1855CF00C0D4EC /* SWGConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */; }; CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF31D0981B105E4B00509935 /* SWGApiClientTest.m */; }; CF5B6E2D1B2BD70800862A1C /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF5B6E2C1B2BD70800862A1C /* UserApiTest.m */; }; + CF8F85811B3A4796000DE569 /* SWGMythingApi.m in Sources */ = {isa = PBXBuildFile; fileRef = CF8F85801B3A4796000DE569 /* SWGMythingApi.m */; }; + CF8F85841B3A4913000DE569 /* SWGMyresult.m in Sources */ = {isa = PBXBuildFile; fileRef = CF8F85831B3A4913000DE569 /* SWGMyresult.m */; }; CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */; }; CFCEFE511B2C1330006313BE /* SWGJSONResponseSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = CFCEFE501B2C1330006313BE /* SWGJSONResponseSerializer.m */; }; CFD1B6701B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */; }; CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */; }; + CFE1E0391B3AA4EE0030FE7C /* SWGJSONRequestSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = CFE1E0381B3AA4EE0030FE7C /* SWGJSONRequestSerializer.m */; }; EA66999A1811D2FA00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; }; EA66999C1811D2FA00A70D03 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA66999B1811D2FA00A70D03 /* CoreGraphics.framework */; }; EA66999E1811D2FA00A70D03 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA66999D1811D2FA00A70D03 /* UIKit.framework */; }; @@ -64,11 +67,17 @@ CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGConfiguration.m; sourceTree = ""; }; CF31D0981B105E4B00509935 /* SWGApiClientTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClientTest.m; sourceTree = ""; }; CF5B6E2C1B2BD70800862A1C /* UserApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserApiTest.m; sourceTree = ""; }; + CF8F857F1B3A4796000DE569 /* SWGMythingApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGMythingApi.h; sourceTree = ""; }; + CF8F85801B3A4796000DE569 /* SWGMythingApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGMythingApi.m; sourceTree = ""; }; + CF8F85821B3A4913000DE569 /* SWGMyresult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGMyresult.h; sourceTree = ""; }; + CF8F85831B3A4913000DE569 /* SWGMyresult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGMyresult.m; sourceTree = ""; }; CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoreApiTest.m; sourceTree = ""; }; CFCEFE4F1B2C1330006313BE /* SWGJSONResponseSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGJSONResponseSerializer.h; sourceTree = ""; }; CFCEFE501B2C1330006313BE /* SWGJSONResponseSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGJSONResponseSerializer.m; sourceTree = ""; }; CFD1B66E1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JSONValueTransformer+ISO8601.h"; sourceTree = ""; }; CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSONValueTransformer+ISO8601.m"; sourceTree = ""; }; + CFE1E0371B3AA4EE0030FE7C /* SWGJSONRequestSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGJSONRequestSerializer.h; sourceTree = ""; }; + CFE1E0381B3AA4EE0030FE7C /* SWGJSONRequestSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGJSONRequestSerializer.m; sourceTree = ""; }; E2B6DA00BE52336E23783686 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "../Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; EA6699961811D2FA00A70D03 /* SwaggerClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwaggerClient.app; sourceTree = BUILT_PRODUCTS_DIR; }; EA6699991811D2FA00A70D03 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -253,11 +262,17 @@ EAEA85D21811D3AE00F06E69 /* SWGFile.h */, EAEA85D31811D3AE00F06E69 /* SWGFile.m */, EAEA85D41811D3AE00F06E69 /* SWGObject.h */, + CF8F85821B3A4913000DE569 /* SWGMyresult.h */, + CF8F85831B3A4913000DE569 /* SWGMyresult.m */, + CF8F857F1B3A4796000DE569 /* SWGMythingApi.h */, + CF8F85801B3A4796000DE569 /* SWGMythingApi.m */, EAEA85D51811D3AE00F06E69 /* SWGObject.m */, EAEA85D61811D3AE00F06E69 /* SWGOrder.h */, EAEA85D71811D3AE00F06E69 /* SWGOrder.m */, EAB26B0E1AC8E692002F5C7A /* SWGPet.h */, CFCEFE4F1B2C1330006313BE /* SWGJSONResponseSerializer.h */, + CFE1E0371B3AA4EE0030FE7C /* SWGJSONRequestSerializer.h */, + CFE1E0381B3AA4EE0030FE7C /* SWGJSONRequestSerializer.m */, CFCEFE501B2C1330006313BE /* SWGJSONResponseSerializer.m */, EAEA85D91811D3AE00F06E69 /* SWGPet.m */, EAEA85DA1811D3AE00F06E69 /* SWGPetApi.h */, @@ -420,13 +435,16 @@ EAEA85EB1811D3AE00F06E69 /* SWGPetApi.m in Sources */, EA6699A61811D2FA00A70D03 /* main.m in Sources */, CFD1B6701B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */, + CF8F85841B3A4913000DE569 /* SWGMyresult.m in Sources */, EAEA85EA1811D3AE00F06E69 /* SWGPet.m in Sources */, EAEA85E41811D3AE00F06E69 /* SWGApiClient.m in Sources */, EAEA85EC1811D3AE00F06E69 /* SWGStoreApi.m in Sources */, EAEA85E91811D3AE00F06E69 /* SWGOrder.m in Sources */, + CF8F85811B3A4796000DE569 /* SWGMythingApi.m in Sources */, EAEA85E81811D3AE00F06E69 /* SWGObject.m in Sources */, EA8B8AA41AC6683700638FBB /* SWGQueryParamCollection.m in Sources */, CFCEFE511B2C1330006313BE /* SWGJSONResponseSerializer.m in Sources */, + CFE1E0391B3AA4EE0030FE7C /* SWGJSONRequestSerializer.m in Sources */, EAEA85E71811D3AE00F06E69 /* SWGFile.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m index 388cacbb157..df696b0562b 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m +++ b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m @@ -7,10 +7,14 @@ // #import "ViewController.h" +#import "SWGPet.h" +#import "SWGCategory.h" +#import "SWGTag.h" #import "SWGPetApi.h" #import "SWGStoreApi.h" #import "SWGUserApi.h" #import "SWGConfiguration.h" +#import "SWGMythingApi.h" @interface ViewController () @@ -21,49 +25,20 @@ - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -/* - SWGPetApi * api = [[SWGPetApi alloc] init]; - [api getPetByIdWithCompletionBlock:@10 completionHandler:^(SWGPet *output, NSError *error) { - NSLog(@"%@", [output asDictionary]); - [output set_id:@101]; - [api addPetWithCompletionBlock:output completionHandler:^(NSError *error) { - NSLog(@"Done!"); - }]; - -// load data into file - }]; - NSString *filePath = [[NSBundle mainBundle] pathForResource:@"test-1" ofType:@"png"]; - NSData *myData = [NSData dataWithContentsOfFile:filePath]; + /* + NSDictionary *cateHash = @{ @"id": @123, @"name": @"test name" }; + NSDictionary *tagHash = @{ @"id": @123, @"name": @"test name" }; + NSDictionary *petHash = @{ @"id": @123, @"test": @(YES), @"name": @"test name", @"category": cateHash, @"tags": @[tagHash], @"photoUrls": @[@"test url"] }; + SWGPet *pet = [[SWGPet alloc] initWithDictionary:petHash + error:nil]; - SWGFile *file = [[SWGFile alloc] initWithNameData:@"test-2.png" mimeType:@"image/png" data:myData]; - [api uploadFileWithCompletionBlock:@1 - additionalMetadata:@"some metadata" - file:file - completionHandler:^(NSError *error) { - if(error) { - NSLog(@"%@", error); - } - } -// completionHandler:^(SWGApiResponse *output, NSError *error) { -// if(error) { -// NSLog(@"%@", error); -// } -// else { -// NSLog(@"%@", [output asDictionary]); -// } -// } - ]; - */ SWGPetApi *api = [[SWGPetApi alloc] init]; - [api deletePetWithCompletionBlock:@"hello" - petId:@1434529787992 - completionHandler:^(NSError *error) { - if (error) { - NSLog(@"%@", error); - } - }]; + [api addPetWithCompletionBlock:pet completionHandler:^(NSError *error) { + NSLog(@"%@", error); + }]; + */ + } - (void)didReceiveMemoryWarning diff --git a/samples/client/petstore/objc/client/SWGApiClient.h b/samples/client/petstore/objc/client/SWGApiClient.h index 6ede775cb02..34722ed3ad9 100644 --- a/samples/client/petstore/objc/client/SWGApiClient.h +++ b/samples/client/petstore/objc/client/SWGApiClient.h @@ -1,7 +1,8 @@ #import #import #import "AFHTTPRequestOperationManager.h" -#import "SWGJSONResponseSerializer.h" +#import "SWGJSONResponseSerializer.h" +#import "SWGJSONRequestSerializer.h" #import "SWGUser.h" #import "SWGCategory.h" diff --git a/samples/client/petstore/objc/client/SWGApiClient.m b/samples/client/petstore/objc/client/SWGApiClient.m index 1b479d039e6..d7e6fac8385 100644 --- a/samples/client/petstore/objc/client/SWGApiClient.m +++ b/samples/client/petstore/objc/client/SWGApiClient.m @@ -486,7 +486,7 @@ static bool loggingEnabled = true; completionBlock: (void (^)(id, NSError *))completionBlock { // setting request serializer if ([requestContentType isEqualToString:@"application/json"]) { - self.requestSerializer = [AFJSONRequestSerializer serializer]; + self.requestSerializer = [SWGJSONRequestSerializer serializer]; } else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) { self.requestSerializer = [AFHTTPRequestSerializer serializer]; @@ -569,9 +569,11 @@ static bool loggingEnabled = true; parameters: body error: nil]; } + BOOL hasHeaderParams = false; - if(headerParams != nil && [headerParams count] > 0) + if(headerParams != nil && [headerParams count] > 0) { hasHeaderParams = true; + } if(offlineState) { NSLog(@"%@ cache forced", path); [request setCachePolicy:NSURLRequestReturnCacheDataDontLoad]; @@ -585,17 +587,7 @@ static bool loggingEnabled = true; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; } - - if(body != nil) { - if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){ - [self.requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"]; - } - else if ([body isKindOfClass:[SWGFile class]]){} - else { - NSAssert(false, @"unsupported post type!"); - } - } - if(headerParams != nil){ + if(hasHeaderParams){ for(NSString * key in [headerParams keyEnumerator]){ [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; } diff --git a/samples/client/petstore/objc/client/SWGJSONRequestSerializer.h b/samples/client/petstore/objc/client/SWGJSONRequestSerializer.h new file mode 100644 index 00000000000..49dd7fca3e2 --- /dev/null +++ b/samples/client/petstore/objc/client/SWGJSONRequestSerializer.h @@ -0,0 +1,5 @@ +#import +#import + +@interface SWGJSONRequestSerializer : AFJSONRequestSerializer +@end diff --git a/samples/client/petstore/objc/client/SWGJSONRequestSerializer.m b/samples/client/petstore/objc/client/SWGJSONRequestSerializer.m new file mode 100644 index 00000000000..631a20a5a6e --- /dev/null +++ b/samples/client/petstore/objc/client/SWGJSONRequestSerializer.m @@ -0,0 +1,35 @@ +#import "SWGJSONRequestSerializer.h" + +@implementation SWGJSONRequestSerializer + +/// +/// When customize a request serializer, +/// the serializer must conform the protocol `AFURLRequestSerialization` +/// and implements the protocol method `requestBySerializingRequest:withParameters:error:` +/// +/// @param request The original request. +/// @param parameters The parameters to be encoded. +/// @param error The error that occurred while attempting to encode the request parameters. +/// +/// @return A serialized request. +/// +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + // If the body data which will be serialized isn't NSArray or NSDictionary + // then put the data in the http request body directly. + if ([parameters isKindOfClass:[NSArray class]] || [parameters isKindOfClass:[NSDictionary class]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } else { + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + if (parameters) { + [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; + } + + return mutableRequest; + } +} + +@end diff --git a/samples/client/petstore/objc/client/SWGOrder.h b/samples/client/petstore/objc/client/SWGOrder.h index c4f4f6e81ad..2e71906cd53 100644 --- a/samples/client/petstore/objc/client/SWGOrder.h +++ b/samples/client/petstore/objc/client/SWGOrder.h @@ -19,6 +19,6 @@ */ @property(nonatomic) NSString* status; -@property(nonatomic) BOOL complete; +@property(nonatomic) NSNumber* complete; @end diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/client/SWGPetApi.m index e4306f1b235..01d127bc283 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.m +++ b/samples/client/petstore/objc/client/SWGPetApi.m @@ -121,14 +121,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -136,20 +136,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } @@ -158,7 +148,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"PUT" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -218,14 +208,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -233,20 +223,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } @@ -255,7 +235,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -321,8 +301,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -335,7 +315,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -401,8 +381,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -415,7 +395,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -441,7 +421,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling getPetById"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `getPetById`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; @@ -479,8 +461,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"api_key", @"petstore_auth"]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -493,7 +475,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -525,7 +507,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling updatePetWithForm"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `updatePetWithForm`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; @@ -563,8 +547,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -574,18 +558,18 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; formParams[@"name"] = name; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; + if(bodyParam == nil) { + bodyParam = [[NSMutableArray alloc] init]; } - [bodyDictionary addObject:formParams]; + [bodyParam addObject:formParams]; formParams[@"status"] = status; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; + if(bodyParam == nil) { + bodyParam = [[NSMutableArray alloc] init]; } - [bodyDictionary addObject:formParams]; + [bodyParam addObject:formParams]; @@ -593,7 +577,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -622,7 +606,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling deletePet"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `deletePet`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; @@ -662,8 +648,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -676,7 +662,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -708,7 +694,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling uploadFile"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `uploadFile`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}/uploadImage", basePath]; @@ -746,8 +734,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -757,25 +745,25 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; formParams[@"additionalMetadata"] = additionalMetadata; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; + if(bodyParam == nil) { + bodyParam = [[NSMutableArray alloc] init]; } - [bodyDictionary addObject:formParams]; + [bodyParam addObject:formParams]; requestContentType = @"multipart/form-data"; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; + if(bodyParam == nil) { + bodyParam = [[NSMutableArray alloc] init]; } if(file != nil) { - [bodyDictionary addObject:file]; + [bodyParam addObject:file]; file.paramName = @"file"; } - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; + if(bodyParam == nil) { + bodyParam = [[NSMutableArray alloc] init]; } - [bodyDictionary addObject:formParams]; + [bodyParam addObject:formParams]; @@ -783,7 +771,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType diff --git a/samples/client/petstore/objc/client/SWGStoreApi.m b/samples/client/petstore/objc/client/SWGStoreApi.m index 98582602027..71b5af87744 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.m +++ b/samples/client/petstore/objc/client/SWGStoreApi.m @@ -117,8 +117,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"api_key"]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -131,7 +131,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -191,14 +191,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -206,20 +206,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } @@ -228,7 +218,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -254,7 +244,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'orderId' is set - NSAssert(orderId != nil, @"Missing the required parameter `orderId` when calling getOrderById"); + if (orderId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `orderId` when calling `getOrderById`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; @@ -292,8 +284,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -306,7 +298,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -332,7 +324,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'orderId' is set - NSAssert(orderId != nil, @"Missing the required parameter `orderId` when calling deleteOrder"); + if (orderId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `orderId` when calling `deleteOrder`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; @@ -370,8 +364,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -384,7 +378,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType diff --git a/samples/client/petstore/objc/client/SWGUserApi.m b/samples/client/petstore/objc/client/SWGUserApi.m index 2e8ce66b74e..06b6d2ce666 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.m +++ b/samples/client/petstore/objc/client/SWGUserApi.m @@ -120,14 +120,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -135,20 +135,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } @@ -157,7 +147,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -217,14 +207,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -232,20 +222,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } @@ -254,7 +234,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -314,14 +294,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -329,20 +309,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } @@ -351,7 +321,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -422,8 +392,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -436,7 +406,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -493,8 +463,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -507,7 +477,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -533,7 +503,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'username' is set - NSAssert(username != nil, @"Missing the required parameter `username` when calling getUserByName"); + if (username == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `getUserByName`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; @@ -571,8 +543,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -585,7 +557,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -614,7 +586,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'username' is set - NSAssert(username != nil, @"Missing the required parameter `username` when calling updateUser"); + if (username == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `updateUser`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; @@ -652,14 +626,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -667,20 +641,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; - } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } @@ -689,7 +653,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"PUT" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType @@ -715,7 +679,9 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // verify the required parameter 'username' is set - NSAssert(username != nil, @"Missing the required parameter `username` when calling deleteUser"); + if (username == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `deleteUser`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; @@ -753,8 +719,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; + + id bodyParam = nil; @@ -767,7 +733,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams - body: bodyDictionary + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType