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 ee8be40e2ab..45c6fc6d305 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache @@ -351,6 +351,7 @@ static bool loggingEnabled = true; *querys = [NSDictionary dictionaryWithDictionary:querysWithAuth]; } +#pragma mark - Deserialize methods - (id) deserialize:(id) data class:(NSString *) class { NSRegularExpression *regexp = nil; @@ -358,6 +359,11 @@ static bool loggingEnabled = true; NSMutableArray *resultArray = nil; NSMutableDictionary *resultDict = nil; + // remove "*" from class, if ends with "*" + if ([class hasSuffix:@"*"]) { + class = [class substringToIndex:[class length] - 1]; + } + // list of models NSString *arrayOfModelsPat = @"NSArray<(.+)>"; regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat @@ -371,7 +377,7 @@ static bool loggingEnabled = true; if (match) { NSString *innerType = [class substringWithRange:[match rangeAtIndex:1]]; - resultArray = [NSMutableArray arrayWithCapacity:[data length]]; + resultArray = [NSMutableArray arrayWithCapacity:[data count]]; [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [resultArray addObject:[self deserialize:obj class:innerType]]; } @@ -390,7 +396,7 @@ static bool loggingEnabled = true; range:NSMakeRange(0, [class length])]; if (match) { - resultArray = [NSMutableArray arrayWithCapacity:[data length]]; + resultArray = [NSMutableArray arrayWithCapacity:[data count]]; [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]]; }]; @@ -399,7 +405,7 @@ static bool loggingEnabled = true; } // map - NSString *dictPat = @"NSDictionary /\\* (.+), (.+) \\*/"; + NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/"; regexp = [NSRegularExpression regularExpressionWithPattern:dictPat options:NSRegularExpressionCaseInsensitive error:nil]; @@ -435,7 +441,16 @@ static bool loggingEnabled = true; return [NSNumber numberWithBool:[data boolValue]]; } else if ([class isEqualToString:@"NSNumber"]) { - return [data numberFromString:data]; + // NSNumber from NSNumber + if ([data isKindOfClass:[NSNumber class]]) { + return data; + } + // NSNumber from NSString + else { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle = NSNumberFormatterDecimalStyle; + return [formatter numberFromString:data]; + } } } 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 ba61a8b2c7c..1f3c6ca299e 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache @@ -74,12 +74,12 @@ static NSString * basePath = @"{{basePath}}"; {{#operation}} -/*! - * {{{summary}}} - * {{{notes}}} -{{#allParams}} * \param {{paramName}} {{{description}}} -{{/allParams}} * \returns {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} - */ +// +// {{{summary}}} +// {{{notes}}} +// {{#allParams}} @param {{paramName}} {{{description}}} +// {{/allParams}} @returns {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} +// -(NSNumber*) {{nickname}}WithCompletionBlock{{^allParams}}: {{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}} {{/allParams}} {{#returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{{returnType}}} output, NSError* error))completionBlock{{/returnBaseType}} diff --git a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache index 65f4c39e0b3..cc9ad03616e 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache @@ -17,16 +17,15 @@ +(void) setBasePath:(NSString*)basePath; +(NSString*) getBasePath; {{#operation}} -/** - - {{{summary}}} - {{#notes}}{{{notes}}}{{/notes}} - - {{#allParams}}@param {{paramName}} {{description}} - {{/allParams}} - - return type: {{{returnType}}} - */ +// +// +// {{{summary}}} +// {{#notes}}{{{notes}}}{{/notes}} +// +// {{#allParams}}@param {{paramName}} {{description}} +// {{/allParams}} +// +// @return {{{returnType}}} -(NSNumber*) {{nickname}}WithCompletionBlock {{^allParams}}:{{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}:({{{dataType}}}) {{paramName}} {{#hasMore}} {{/hasMore}}{{/allParams}} {{#returnBaseType}}{{#hasParams}} diff --git a/modules/swagger-codegen/src/main/resources/objc/apiBodyResponseWithContainer.mustache b/modules/swagger-codegen/src/main/resources/objc/apiBodyResponseWithContainer.mustache deleted file mode 100644 index 7d178353d52..00000000000 --- a/modules/swagger-codegen/src/main/resources/objc/apiBodyResponseWithContainer.mustache +++ /dev/null @@ -1,45 +0,0 @@ - // {{returnContainer}} container response type - return [self.apiClient dictionary: requestUrl - method: @"{{httpMethod}}" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - authSettings: authSettings - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - {{#returnBaseType}}completionBlock(nil, error);{{/returnBaseType}}{{^returnBaseType}}completionBlock(error);{{/returnBaseType}} - return; - } - {{#isMapContainer}} - NSDictionary *result = nil; - if (data) { - result = [[NSDictionary alloc]initWithDictionary: data]; - } - completionBlock(data, nil); - {{/isMapContainer}}{{#isListContainer}} - {{#returnBaseType}}if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - {{#returnTypeIsPrimitive}} - {{returnBaseType}}* d = [[{{{returnBaseType}}} alloc]initWithString: dict]; - {{/returnTypeIsPrimitive}} - {{^returnTypeIsPrimitive}} - {{{returnBaseType}}}* d = [[{{{returnBaseType}}} alloc] initWithDictionary:dict error:nil]; - {{/returnTypeIsPrimitive}} - [objs addObject:d]; - } - completionBlock(({{{returnType}}})objs, nil); - } - {{/returnBaseType}} - {{/isListContainer}} - }]; - - - - - - - - diff --git a/modules/swagger-codegen/src/main/resources/objc/apiNonPrimitiveResponse.mustache b/modules/swagger-codegen/src/main/resources/objc/apiNonPrimitiveResponse.mustache deleted file mode 100644 index da8ea063bfb..00000000000 --- a/modules/swagger-codegen/src/main/resources/objc/apiNonPrimitiveResponse.mustache +++ /dev/null @@ -1,24 +0,0 @@ - {{^returnTypeIsPrimitive}} - // comples response type - return [self.apiClient dictionary: requestUrl - method: @"{{httpMethod}}" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - authSettings: authSettings - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSDictionary *data, NSError *error) { - if (error) { - {{#returnBaseType}}completionBlock(nil, error);{{/returnBaseType}} - {{^returnBaseType}}completionBlock(error);{{/returnBaseType}} - return; - } - {{#returnType}}{{returnType}} result = nil; - if (data) { - result = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{returnBaseType}}} {{/instantiationType}} alloc] {{#returnContainer}}{{#isMapContainer}}initWithDictionary{{/isMapContainer}}{{#isListContainer}} initWithDictionary{{/isListContainer}}{{/returnContainer}}{{^returnContainer}} initWithDictionary{{/returnContainer}}:data error:nil]; - } - {{#returnType}}completionBlock(result , nil);{{/returnType}} - {{/returnType}} - }]; - {{/returnTypeIsPrimitive}} diff --git a/modules/swagger-codegen/src/main/resources/objc/apiPrimitiveResponse.mustache b/modules/swagger-codegen/src/main/resources/objc/apiPrimitiveResponse.mustache deleted file mode 100644 index d44d356526d..00000000000 --- a/modules/swagger-codegen/src/main/resources/objc/apiPrimitiveResponse.mustache +++ /dev/null @@ -1,36 +0,0 @@ - // primitive response type - {{#returnBaseType}}return [self.apiClient stringWithCompletionBlock: requestUrl - method: @"{{httpMethod}}" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - authSettings: authSettings - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(nil, error); - return; - } - {{returnBaseType}} *result = data ? [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{returnBaseType}}} {{/instantiationType}} alloc]initWithString: data] : nil; - completionBlock(result, nil); - }]; - {{/returnBaseType}} - {{^returnBaseType}} - // no return base type - return [self.apiClient stringWithCompletionBlock: requestUrl - method: @"{{httpMethod}}" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error); - return; - } - completionBlock(nil); - }]; - {{/returnBaseType}} - diff --git a/modules/swagger-codegen/src/main/resources/objc/voidResponse.mustache b/modules/swagger-codegen/src/main/resources/objc/voidResponse.mustache deleted file mode 100644 index 7bbbc14c066..00000000000 --- a/modules/swagger-codegen/src/main/resources/objc/voidResponse.mustache +++ /dev/null @@ -1,15 +0,0 @@ - return [self.apiClient stringWithCompletionBlock: requestUrl - method: @"{{httpMethod}}" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - authSettings: authSettings - requestContentType: requestContentType - responseContentType: responseContentType - completionBlock: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error); - return; - } - completionBlock(nil); - }]; diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/StoreApiTest.m b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/StoreApiTest.m new file mode 100644 index 00000000000..5440935be1b --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/StoreApiTest.m @@ -0,0 +1,47 @@ +#import +#import +#import "SWGStoreApi.h" + +@interface StoreApiTest : XCTestCase + +@property (nonatomic) SWGStoreApi *api; + +@end + +@implementation StoreApiTest + +- (void)setUp { + [super setUp]; + self.api = [[SWGStoreApi alloc] init]; +} + +- (void)tearDown { + [super tearDown]; +} + +- (void)testGetInventory { + XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetByStatus"]; + + [self.api getInventoryWithCompletionBlock:^(NSDictionary *output, NSError *error) { + + if (error) { + XCTFail(@"got error %@", error); + } + + if (!output) { + XCTFail(@"failed to fetch inventory"); + } + + NSSet *expectKeys = [NSSet setWithArray:@[@"confused", @"string", @"pending", @"available", @"sold"]]; + NSSet *keys = [NSSet setWithArray:[output allKeys]]; + + XCTAssertEqualObjects(expectKeys, keys); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:10.0 handler:nil]; +} + + +@end diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj index ae903f27499..ffb61953051 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ BA525648922D4C0E9F44D4F1 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 73DA4F1067C343C3962F1542 /* libPods.a */; }; CF0560EB1B1855CF00C0D4EC /* SWGConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */; }; CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF31D0981B105E4B00509935 /* SWGApiClientTest.m */; }; + CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.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 */; }; EA66999A1811D2FA00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; }; @@ -60,6 +61,7 @@ CF0560E91B1855CF00C0D4EC /* SWGConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGConfiguration.h; sourceTree = ""; }; 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 = ""; }; + CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoreApiTest.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 = ""; }; 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 = ""; }; @@ -212,6 +214,7 @@ isa = PBXGroup; children = ( EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */, + CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */, CF31D0981B105E4B00509935 /* SWGApiClientTest.m */, EA6699C71811D2FB00A70D03 /* PetApiTest.m */, EA6699C21811D2FB00A70D03 /* Supporting Files */, @@ -426,6 +429,7 @@ EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */, CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */, EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */, + CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */, CF31D0991B105E4B00509935 /* SWGApiClientTest.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 fd15f391f49..56d0a8f621f 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m +++ b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m @@ -8,6 +8,7 @@ #import "ViewController.h" #import "SWGPetApi.h" +#import "SWGStoreApi.h" #import "SWGConfiguration.h" @interface ViewController () @@ -54,14 +55,6 @@ // } ]; */ - SWGConfiguration *config = [SWGConfiguration sharedConfig]; - config.username = @"foo"; - config.password = @"bar"; - SWGPetApi *api = [[SWGPetApi alloc] init]; - [api addPetWithCompletionBlock:nil - completionHandler:^(NSError *error) { - - }]; } - (void)didReceiveMemoryWarning diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SWGApiClientTest.m b/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SWGApiClientTest.m index 61925b16960..1bd0c0eb1c3 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SWGApiClientTest.m +++ b/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SWGApiClientTest.m @@ -98,4 +98,66 @@ XCTAssertEqualObjects(basicAuthCredentials, [config getBasicAuthToken]); } +- (void)testDeserialize { + id data; + id result; + + // list of models + data = + @[ + @{ + @"id": @119, + @"category": @{ + @"id": @0, + @"name": @"string" + }, + @"name": @"doggie", + @"photoUrls": @[ + @"string" + ], + @"tags": @[ + @{ + @"id": @0, + @"name": @"string" + } + ], + @"status": @"available" + + }]; + result = [self.apiClient deserialize:data class:@"NSArray*"]; + + XCTAssertTrue([result isKindOfClass:[NSArray class]]); + XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]); + XCTAssertEqualObjects([[result firstObject] _id], @119); + + // map of models + data = + @{ + @"pet": @{ + @"id": @119, + @"category": @{ + @"id": @0, + @"name": @"string" + }, + @"name": @"doggie", + @"photoUrls": @[ + @"string" + ], + @"tags": @[ + @{ + @"id": @0, + @"name": @"string" + } + ], + @"status": @"available" + + } + }; + result = [self.apiClient deserialize:data class:@"NSDictionary* /* NSString, SWGPet */"]; + + XCTAssertTrue([result isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"pet"] isKindOfClass:[SWGPet class]]); + XCTAssertEqualObjects([result[@"pet"] _id], @119); +} + @end diff --git a/samples/client/petstore/objc/client/SWGApiClient.m b/samples/client/petstore/objc/client/SWGApiClient.m index ee8be40e2ab..45c6fc6d305 100644 --- a/samples/client/petstore/objc/client/SWGApiClient.m +++ b/samples/client/petstore/objc/client/SWGApiClient.m @@ -351,6 +351,7 @@ static bool loggingEnabled = true; *querys = [NSDictionary dictionaryWithDictionary:querysWithAuth]; } +#pragma mark - Deserialize methods - (id) deserialize:(id) data class:(NSString *) class { NSRegularExpression *regexp = nil; @@ -358,6 +359,11 @@ static bool loggingEnabled = true; NSMutableArray *resultArray = nil; NSMutableDictionary *resultDict = nil; + // remove "*" from class, if ends with "*" + if ([class hasSuffix:@"*"]) { + class = [class substringToIndex:[class length] - 1]; + } + // list of models NSString *arrayOfModelsPat = @"NSArray<(.+)>"; regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat @@ -371,7 +377,7 @@ static bool loggingEnabled = true; if (match) { NSString *innerType = [class substringWithRange:[match rangeAtIndex:1]]; - resultArray = [NSMutableArray arrayWithCapacity:[data length]]; + resultArray = [NSMutableArray arrayWithCapacity:[data count]]; [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [resultArray addObject:[self deserialize:obj class:innerType]]; } @@ -390,7 +396,7 @@ static bool loggingEnabled = true; range:NSMakeRange(0, [class length])]; if (match) { - resultArray = [NSMutableArray arrayWithCapacity:[data length]]; + resultArray = [NSMutableArray arrayWithCapacity:[data count]]; [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]]; }]; @@ -399,7 +405,7 @@ static bool loggingEnabled = true; } // map - NSString *dictPat = @"NSDictionary /\\* (.+), (.+) \\*/"; + NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/"; regexp = [NSRegularExpression regularExpressionWithPattern:dictPat options:NSRegularExpressionCaseInsensitive error:nil]; @@ -435,7 +441,16 @@ static bool loggingEnabled = true; return [NSNumber numberWithBool:[data boolValue]]; } else if ([class isEqualToString:@"NSNumber"]) { - return [data numberFromString:data]; + // NSNumber from NSNumber + if ([data isKindOfClass:[NSNumber class]]) { + return data; + } + // NSNumber from NSString + else { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle = NSNumberFormatterDecimalStyle; + return [formatter numberFromString:data]; + } } } diff --git a/samples/client/petstore/objc/client/SWGPetApi.h b/samples/client/petstore/objc/client/SWGPetApi.h index aa255cd144e..ce17f2c30ab 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.h +++ b/samples/client/petstore/objc/client/SWGPetApi.h @@ -15,98 +15,92 @@ +(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; +(void) setBasePath:(NSString*)basePath; +(NSString*) getBasePath; -/** - - Update an existing pet - - - @param body Pet object that needs to be added to the store - - - return type: - */ +// +// +// Update an existing pet +// +// +// @param body Pet object that needs to be added to the store +// +// +// @return -(NSNumber*) updatePetWithCompletionBlock :(SWGPet*) body completionHandler: (void (^)(NSError* error))completionBlock; -/** - - Add a new pet to the store - - - @param body Pet object that needs to be added to the store - - - return type: - */ +// +// +// Add a new pet to the store +// +// +// @param body Pet object that needs to be added to the store +// +// +// @return -(NSNumber*) addPetWithCompletionBlock :(SWGPet*) body completionHandler: (void (^)(NSError* error))completionBlock; -/** - - Finds Pets by status - Multiple status values can be provided with comma seperated strings - - @param status Status values that need to be considered for filter - - - return type: NSArray* - */ +// +// +// Finds Pets by status +// Multiple status values can be provided with comma seperated strings +// +// @param status Status values that need to be considered for filter +// +// +// @return NSArray* -(NSNumber*) findPetsByStatusWithCompletionBlock :(NSArray*) status completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; -/** - - Finds Pets by tags - Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - - @param tags Tags to filter by - - - return type: NSArray* - */ +// +// +// Finds Pets by tags +// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +// +// @param tags Tags to filter by +// +// +// @return NSArray* -(NSNumber*) findPetsByTagsWithCompletionBlock :(NSArray*) tags completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock; -/** - - Find pet by ID - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - @param petId ID of pet that needs to be fetched - - - return type: SWGPet* - */ +// +// +// Find pet by ID +// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +// +// @param petId ID of pet that needs to be fetched +// +// +// @return SWGPet* -(NSNumber*) getPetByIdWithCompletionBlock :(NSNumber*) petId completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock; -/** - - Updates a pet in the store with form data - - - @param petId ID of pet that needs to be updated - @param name Updated name of the pet - @param status Updated status of the pet - - - return type: - */ +// +// +// Updates a pet in the store with form data +// +// +// @param petId ID of pet that needs to be updated +// @param name Updated name of the pet +// @param status Updated status of the pet +// +// +// @return -(NSNumber*) updatePetWithFormWithCompletionBlock :(NSString*) petId name:(NSString*) name status:(NSString*) status @@ -115,17 +109,16 @@ completionHandler: (void (^)(NSError* error))completionBlock; -/** - - Deletes a pet - - - @param apiKey - @param petId Pet id to delete - - - return type: - */ +// +// +// Deletes a pet +// +// +// @param apiKey +// @param petId Pet id to delete +// +// +// @return -(NSNumber*) deletePetWithCompletionBlock :(NSString*) apiKey petId:(NSNumber*) petId @@ -133,18 +126,17 @@ completionHandler: (void (^)(NSError* error))completionBlock; -/** - - uploads an image - - - @param petId ID of pet to update - @param additionalMetadata Additional data to pass to server - @param file file to upload - - - return type: - */ +// +// +// uploads an image +// +// +// @param petId ID of pet to update +// @param additionalMetadata Additional data to pass to server +// @param file file to upload +// +// +// @return -(NSNumber*) uploadFileWithCompletionBlock :(NSNumber*) petId additionalMetadata:(NSString*) additionalMetadata file:(SWGFile*) file diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/client/SWGPetApi.m index 8a03932001c..d23a2ce9979 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.m +++ b/samples/client/petstore/objc/client/SWGPetApi.m @@ -72,12 +72,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; } -/*! - * Update an existing pet - * - * \param body Pet object that needs to be added to the store - * \returns void - */ +// +// Update an existing pet +// +// @param body Pet object that needs to be added to the store +// @returns void +// -(NSNumber*) updatePetWithCompletionBlock: (SWGPet*) body @@ -168,12 +168,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Add a new pet to the store - * - * \param body Pet object that needs to be added to the store - * \returns void - */ +// +// Add a new pet to the store +// +// @param body Pet object that needs to be added to the store +// @returns void +// -(NSNumber*) addPetWithCompletionBlock: (SWGPet*) body @@ -264,12 +264,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Finds Pets by status - * Multiple status values can be provided with comma seperated strings - * \param status Status values that need to be considered for filter - * \returns NSArray* - */ +// +// Finds Pets by status +// Multiple status values can be provided with comma seperated strings +// @param status Status values that need to be considered for filter +// @returns NSArray* +// -(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock @@ -343,12 +343,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Finds Pets by tags - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * \param tags Tags to filter by - * \returns NSArray* - */ +// +// Finds Pets by tags +// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +// @param tags Tags to filter by +// @returns NSArray* +// -(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock @@ -422,12 +422,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * \param petId ID of pet that needs to be fetched - * \returns SWGPet* - */ +// +// Find pet by ID +// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +// @param petId ID of pet that needs to be fetched +// @returns SWGPet* +// -(NSNumber*) getPetByIdWithCompletionBlock: (NSNumber*) petId completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock @@ -499,14 +499,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Updates a pet in the store with form data - * - * \param petId ID of pet that needs to be updated - * \param name Updated name of the pet - * \param status Updated status of the pet - * \returns void - */ +// +// Updates a pet in the store with form data +// +// @param petId ID of pet that needs to be updated +// @param name Updated name of the pet +// @param status Updated status of the pet +// @returns void +// -(NSNumber*) updatePetWithFormWithCompletionBlock: (NSString*) petId name: (NSString*) name status: (NSString*) status @@ -596,13 +596,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Deletes a pet - * - * \param apiKey - * \param petId Pet id to delete - * \returns void - */ +// +// Deletes a pet +// +// @param apiKey +// @param petId Pet id to delete +// @returns void +// -(NSNumber*) deletePetWithCompletionBlock: (NSString*) apiKey petId: (NSNumber*) petId @@ -677,14 +677,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * uploads an image - * - * \param petId ID of pet to update - * \param additionalMetadata Additional data to pass to server - * \param file file to upload - * \returns void - */ +// +// uploads an image +// +// @param petId ID of pet to update +// @param additionalMetadata Additional data to pass to server +// @param file file to upload +// @returns void +// -(NSNumber*) uploadFileWithCompletionBlock: (NSNumber*) petId additionalMetadata: (NSString*) additionalMetadata file: (SWGFile*) file diff --git a/samples/client/petstore/objc/client/SWGStoreApi.h b/samples/client/petstore/objc/client/SWGStoreApi.h index b7d64469532..a59d861bbb8 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.h +++ b/samples/client/petstore/objc/client/SWGStoreApi.h @@ -14,62 +14,58 @@ +(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; +(void) setBasePath:(NSString*)basePath; +(NSString*) getBasePath; -/** - - Returns pet inventories by status - Returns a map of status codes to quantities - - - - return type: NSDictionary* /* NSString, NSNumber */ - */ +// +// +// Returns pet inventories by status +// Returns a map of status codes to quantities +// +// +// +// @return NSDictionary* /* NSString, NSNumber */ -(NSNumber*) getInventoryWithCompletionBlock : (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock; -/** - - Place an order for a pet - - - @param body order placed for purchasing the pet - - - return type: SWGOrder* - */ +// +// +// Place an order for a pet +// +// +// @param body order placed for purchasing the pet +// +// +// @return SWGOrder* -(NSNumber*) placeOrderWithCompletionBlock :(SWGOrder*) body completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock; -/** - - Find purchase order by ID - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - - @param orderId ID of pet that needs to be fetched - - - return type: SWGOrder* - */ +// +// +// Find purchase order by ID +// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +// +// @param orderId ID of pet that needs to be fetched +// +// +// @return SWGOrder* -(NSNumber*) getOrderByIdWithCompletionBlock :(NSString*) orderId completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock; -/** - - Delete purchase order by ID - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - - @param orderId ID of the order that needs to be deleted - - - return type: - */ +// +// +// Delete purchase order by ID +// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +// +// @param orderId ID of the order that needs to be deleted +// +// +// @return -(NSNumber*) deleteOrderWithCompletionBlock :(NSString*) orderId diff --git a/samples/client/petstore/objc/client/SWGStoreApi.m b/samples/client/petstore/objc/client/SWGStoreApi.m index 0af0ebaad78..ce3a63c9483 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.m +++ b/samples/client/petstore/objc/client/SWGStoreApi.m @@ -71,17 +71,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; } -/*! - * Returns pet inventories by status - * Returns a map of status codes to quantities - * \returns NSDictionary* /* NSString, NSNumber */ - */ +// +// Returns pet inventories by status +// Returns a map of status codes to quantities +// @returns NSDictionary* /* NSString, NSNumber */ +// -(NSNumber*) getInventoryWithCompletionBlock: (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock { - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/inventory", basePath]; // remove format in URL if needed @@ -142,12 +141,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Place an order for a pet - * - * \param body order placed for purchasing the pet - * \returns SWGOrder* - */ +// +// Place an order for a pet +// +// @param body order placed for purchasing the pet +// @returns SWGOrder* +// -(NSNumber*) placeOrderWithCompletionBlock: (SWGOrder*) body completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock @@ -238,12 +237,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * \param orderId ID of pet that needs to be fetched - * \returns SWGOrder* - */ +// +// Find purchase order by ID +// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +// @param orderId ID of pet that needs to be fetched +// @returns SWGOrder* +// -(NSNumber*) getOrderByIdWithCompletionBlock: (NSString*) orderId completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock @@ -315,12 +314,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * \param orderId ID of the order that needs to be deleted - * \returns void - */ +// +// Delete purchase order by ID +// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +// @param orderId ID of the order that needs to be deleted +// @returns void +// -(NSNumber*) deleteOrderWithCompletionBlock: (NSString*) orderId diff --git a/samples/client/petstore/objc/client/SWGUserApi.h b/samples/client/petstore/objc/client/SWGUserApi.h index e6e73ddfba6..c26046a17c6 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.h +++ b/samples/client/petstore/objc/client/SWGUserApi.h @@ -14,65 +14,61 @@ +(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; +(void) setBasePath:(NSString*)basePath; +(NSString*) getBasePath; -/** - - Create user - This can only be done by the logged in user. - - @param body Created user object - - - return type: - */ +// +// +// Create user +// This can only be done by the logged in user. +// +// @param body Created user object +// +// +// @return -(NSNumber*) createUserWithCompletionBlock :(SWGUser*) body completionHandler: (void (^)(NSError* error))completionBlock; -/** - - Creates list of users with given input array - - - @param body List of user object - - - return type: - */ +// +// +// Creates list of users with given input array +// +// +// @param body List of user object +// +// +// @return -(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body completionHandler: (void (^)(NSError* error))completionBlock; -/** - - Creates list of users with given input array - - - @param body List of user object - - - return type: - */ +// +// +// Creates list of users with given input array +// +// +// @param body List of user object +// +// +// @return -(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray*) body completionHandler: (void (^)(NSError* error))completionBlock; -/** - - Logs user into the system - - - @param username The user name for login - @param password The password for login in clear text - - - return type: NSString* - */ +// +// +// Logs user into the system +// +// +// @param username The user name for login +// @param password The password for login in clear text +// +// +// @return NSString* -(NSNumber*) loginUserWithCompletionBlock :(NSString*) username password:(NSString*) password @@ -80,47 +76,44 @@ -/** - - Logs out current logged in user session - - - - - return type: - */ +// +// +// Logs out current logged in user session +// +// +// +// +// @return -(NSNumber*) logoutUserWithCompletionBlock : (void (^)(NSError* error))completionBlock; -/** - - Get user by user name - - - @param username The name that needs to be fetched. Use user1 for testing. - - - return type: SWGUser* - */ +// +// +// Get user by user name +// +// +// @param username The name that needs to be fetched. Use user1 for testing. +// +// +// @return SWGUser* -(NSNumber*) getUserByNameWithCompletionBlock :(NSString*) username completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock; -/** - - Updated user - This can only be done by the logged in user. - - @param username name that need to be deleted - @param body Updated user object - - - return type: - */ +// +// +// Updated user +// This can only be done by the logged in user. +// +// @param username name that need to be deleted +// @param body Updated user object +// +// +// @return -(NSNumber*) updateUserWithCompletionBlock :(NSString*) username body:(SWGUser*) body @@ -128,16 +121,15 @@ completionHandler: (void (^)(NSError* error))completionBlock; -/** - - Delete user - This can only be done by the logged in user. - - @param username The name that needs to be deleted - - - return type: - */ +// +// +// Delete user +// This can only be done by the logged in user. +// +// @param username The name that needs to be deleted +// +// +// @return -(NSNumber*) deleteUserWithCompletionBlock :(NSString*) username diff --git a/samples/client/petstore/objc/client/SWGUserApi.m b/samples/client/petstore/objc/client/SWGUserApi.m index 401df17e396..3ef45ea1e77 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.m +++ b/samples/client/petstore/objc/client/SWGUserApi.m @@ -71,12 +71,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; } -/*! - * Create user - * This can only be done by the logged in user. - * \param body Created user object - * \returns void - */ +// +// Create user +// This can only be done by the logged in user. +// @param body Created user object +// @returns void +// -(NSNumber*) createUserWithCompletionBlock: (SWGUser*) body @@ -167,12 +167,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Creates list of users with given input array - * - * \param body List of user object - * \returns void - */ +// +// Creates list of users with given input array +// +// @param body List of user object +// @returns void +// -(NSNumber*) createUsersWithArrayInputWithCompletionBlock: (NSArray*) body @@ -263,12 +263,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Creates list of users with given input array - * - * \param body List of user object - * \returns void - */ +// +// Creates list of users with given input array +// +// @param body List of user object +// @returns void +// -(NSNumber*) createUsersWithListInputWithCompletionBlock: (NSArray*) body @@ -359,13 +359,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Logs user into the system - * - * \param username The user name for login - * \param password The password for login in clear text - * \returns NSString* - */ +// +// Logs user into the system +// +// @param username The user name for login +// @param password The password for login in clear text +// @returns NSString* +// -(NSNumber*) loginUserWithCompletionBlock: (NSString*) username password: (NSString*) password @@ -442,11 +442,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Logs out current logged in user session - * - * \returns void - */ +// +// Logs out current logged in user session +// +// @returns void +// -(NSNumber*) logoutUserWithCompletionBlock: (void (^)(NSError* error))completionBlock { @@ -513,12 +513,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Get user by user name - * - * \param username The name that needs to be fetched. Use user1 for testing. - * \returns SWGUser* - */ +// +// Get user by user name +// +// @param username The name that needs to be fetched. Use user1 for testing. +// @returns SWGUser* +// -(NSNumber*) getUserByNameWithCompletionBlock: (NSString*) username completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock @@ -590,13 +590,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Updated user - * This can only be done by the logged in user. - * \param username name that need to be deleted - * \param body Updated user object - * \returns void - */ +// +// Updated user +// This can only be done by the logged in user. +// @param username name that need to be deleted +// @param body Updated user object +// @returns void +// -(NSNumber*) updateUserWithCompletionBlock: (NSString*) username body: (SWGUser*) body @@ -692,12 +692,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; ]; } -/*! - * Delete user - * This can only be done by the logged in user. - * \param username The name that needs to be deleted - * \returns void - */ +// +// Delete user +// This can only be done by the logged in user. +// @param username The name that needs to be deleted +// @returns void +// -(NSNumber*) deleteUserWithCompletionBlock: (NSString*) username