From 9fdcb3681b0c1cbb62e264ffcb2f6af932c4ce85 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 19 Apr 2018 12:08:00 +0800 Subject: [PATCH] Update ObjC petstore and test cases (#139) * restore objc samples from codegen 2x * update objc petstore test * update objc with oas3 petstore --- .../client/petstore/objc/default/README.md | 2 +- .../default/SwaggerClient/Api/SWGPetApi.h | 4 ++-- .../default/SwaggerClient/Api/SWGPetApi.m | 4 ++-- .../default/SwaggerClient/Api/SWGStoreApi.h | 2 +- .../default/SwaggerClient/Api/SWGStoreApi.m | 2 +- .../default/SwaggerClient/Api/SWGUserApi.h | 4 ++-- .../default/SwaggerClient/Api/SWGUserApi.m | 4 ++-- .../SwaggerClientTests/Tests/PetApiTest.m | 10 +++++----- .../petstore/objc/default/docs/SWGPetApi.md | 18 ++++++++--------- .../petstore/objc/default/docs/SWGStoreApi.md | 6 +++--- .../petstore/objc/default/docs/SWGUserApi.md | 20 +++++++++---------- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/samples/client/petstore/objc/default/README.md b/samples/client/petstore/objc/default/README.md index 5be7ae7a20a..1f174419b14 100644 --- a/samples/client/petstore/objc/default/README.md +++ b/samples/client/petstore/objc/default/README.md @@ -69,7 +69,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -SWGPet *pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) +SWGPet* *pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h index 22552170850..f8612386172 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h @@ -31,7 +31,7 @@ extern NSInteger kSWGPetApiMissingParamErrorCode; /// code:405 message:"Invalid input" /// /// @return void --(NSURLSessionTask*) addPetWithPet: (SWGPet) pet +-(NSURLSessionTask*) addPetWithPet: (SWGPet*) pet completionHandler: (void (^)(NSError* error)) handler; @@ -99,7 +99,7 @@ extern NSInteger kSWGPetApiMissingParamErrorCode; /// code:405 message:"Validation exception" /// /// @return void --(NSURLSessionTask*) updatePetWithPet: (SWGPet) pet +-(NSURLSessionTask*) updatePetWithPet: (SWGPet*) pet completionHandler: (void (^)(NSError* error)) handler; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m index 5562c1051d6..9ef63771959 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m @@ -56,7 +56,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513; /// /// @returns void /// --(NSURLSessionTask*) addPetWithPet: (SWGPet) pet +-(NSURLSessionTask*) addPetWithPet: (SWGPet*) pet completionHandler: (void (^)(NSError* error)) handler { NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; @@ -367,7 +367,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513; /// /// @returns void /// --(NSURLSessionTask*) updatePetWithPet: (SWGPet) pet +-(NSURLSessionTask*) updatePetWithPet: (SWGPet*) pet completionHandler: (void (^)(NSError* error)) handler { NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h index 61f4f6cd387..a84648abf28 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h @@ -70,7 +70,7 @@ extern NSInteger kSWGStoreApiMissingParamErrorCode; /// code:400 message:"Invalid Order" /// /// @return SWGOrder* --(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder) order +-(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder*) order completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m index 5e8c26fc5e0..eaf254a6ab3 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m @@ -244,7 +244,7 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513; /// /// @returns SWGOrder* /// --(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder) order +-(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder*) order completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler { NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"]; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h index 67853af1ecf..07f65e7d5c9 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h @@ -31,7 +31,7 @@ extern NSInteger kSWGUserApiMissingParamErrorCode; /// code:0 message:"successful operation" /// /// @return void --(NSURLSessionTask*) createUserWithUser: (SWGUser) user +-(NSURLSessionTask*) createUserWithUser: (SWGUser*) user completionHandler: (void (^)(NSError* error)) handler; @@ -123,7 +123,7 @@ extern NSInteger kSWGUserApiMissingParamErrorCode; /// /// @return void -(NSURLSessionTask*) updateUserWithUsername: (NSString*) username - user: (SWGUser) user + user: (SWGUser*) user completionHandler: (void (^)(NSError* error)) handler; diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m index 67adcd9cd87..2ddc6310351 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m @@ -56,7 +56,7 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513; /// /// @returns void /// --(NSURLSessionTask*) createUserWithUser: (SWGUser) user +-(NSURLSessionTask*) createUserWithUser: (SWGUser*) user completionHandler: (void (^)(NSError* error)) handler { NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"]; @@ -475,7 +475,7 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513; /// @returns void /// -(NSURLSessionTask*) updateUserWithUsername: (NSString*) username - user: (SWGUser) user + user: (SWGUser*) user completionHandler: (void (^)(NSError* error)) handler { // verify the required parameter 'username' is set if (username == nil) { diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetApiTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetApiTest.m index f472c4d6ab5..52c3213c37f 100644 --- a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetApiTest.m +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetApiTest.m @@ -34,7 +34,7 @@ XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetById"]; SWGPet* pet = [self createPet]; - [api addPetWithBody:pet completionHandler:^(NSError *error) { + [api addPetWithPet:pet completionHandler:^(NSError *error) { if(error){ XCTFail(@"got error %@", error); } @@ -74,7 +74,7 @@ XCTestExpectation *expectation = [self expectationWithDescription:@"testUpdatePet"]; SWGPet* pet = [self createPet]; - [api addPetWithBody:pet completionHandler:^(NSError *error) { + [api addPetWithPet:pet completionHandler:^(NSError *error) { if(error) { XCTFail(@"got error %@", error); } @@ -93,7 +93,7 @@ [pet setName:@"programmer"]; [pet setStatus:@"confused"]; - [api updatePetWithBody:pet + [api updatePetWithPet:pet completionHandler:^(NSError *error) { if(error) { XCTFail(@"got error %@", error); @@ -166,7 +166,7 @@ which causes an exception when deserializing the data NSLog(@"%@", pet._id); pet.tags = (id) @[tag]; - [api addPetWithBody:pet completionHandler:^(NSError *error) { + [api addPetWithPet:pet completionHandler:^(NSError *error) { if(error) { XCTFail(@"got error %@", error); } @@ -199,7 +199,7 @@ which causes an exception when deserializing the data SWGPet* pet = [self createPet]; - [api addPetWithBody:pet completionHandler:^(NSError *error) { + [api addPetWithPet:pet completionHandler:^(NSError *error) { if(error){ XCTFail(@"got error %@", error); } diff --git a/samples/client/petstore/objc/default/docs/SWGPetApi.md b/samples/client/petstore/objc/default/docs/SWGPetApi.md index 4299cfc54ab..480201bcbc6 100644 --- a/samples/client/petstore/objc/default/docs/SWGPetApi.md +++ b/samples/client/petstore/objc/default/docs/SWGPetApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **addPet** ```objc --(NSURLSessionTask*) addPetWithPet: (SWGPet) pet +-(NSURLSessionTask*) addPetWithPet: (SWGPet*) pet completionHandler: (void (^)(NSError* error)) handler; ``` @@ -30,7 +30,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -SWGPet pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) +SWGPet* pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; @@ -47,7 +47,7 @@ SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet** | [**SWGPet**](SWGPet.md)| Pet object that needs to be added to the store | [optional] + **pet** | [**SWGPet***](SWGPet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -81,7 +81,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -NSNumber* petId = @789; // Pet id to delete +NSNumber* petId = @56; // Pet id to delete NSString* apiKey = @"apiKey_example"; // (optional) SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; @@ -251,7 +251,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -NSNumber* petId = @789; // ID of pet that needs to be fetched +NSNumber* petId = @56; // ID of pet that needs to be fetched SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; @@ -290,7 +290,7 @@ Name | Type | Description | Notes # **updatePet** ```objc --(NSURLSessionTask*) updatePetWithPet: (SWGPet) pet +-(NSURLSessionTask*) updatePetWithPet: (SWGPet*) pet completionHandler: (void (^)(NSError* error)) handler; ``` @@ -304,7 +304,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -SWGPet pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) +SWGPet* pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; @@ -321,7 +321,7 @@ SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet** | [**SWGPet**](SWGPet.md)| Pet object that needs to be added to the store | [optional] + **pet** | [**SWGPet***](SWGPet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -414,7 +414,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; -NSNumber* petId = @789; // ID of pet to update +NSNumber* petId = @56; // ID of pet to update NSString* additionalMetadata = @"additionalMetadata_example"; // Additional data to pass to server (optional) NSURL* file = [NSURL fileURLWithPath:@"/path/to/file"]; // file to upload (optional) diff --git a/samples/client/petstore/objc/default/docs/SWGStoreApi.md b/samples/client/petstore/objc/default/docs/SWGStoreApi.md index c461724b876..0aec03add1d 100644 --- a/samples/client/petstore/objc/default/docs/SWGStoreApi.md +++ b/samples/client/petstore/objc/default/docs/SWGStoreApi.md @@ -162,7 +162,7 @@ No authorization required # **placeOrder** ```objc --(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder) order +-(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder*) order completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler; ``` @@ -171,7 +171,7 @@ Place an order for a pet ### Example ```objc -SWGOrder order = [[SWGOrder alloc] init]; // order placed for purchasing the pet (optional) +SWGOrder* order = [[SWGOrder alloc] init]; // order placed for purchasing the pet (optional) SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init]; @@ -191,7 +191,7 @@ SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init]; Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order** | [**SWGOrder**](SWGOrder.md)| order placed for purchasing the pet | [optional] + **order** | [**SWGOrder***](SWGOrder.md)| order placed for purchasing the pet | [optional] ### Return type diff --git a/samples/client/petstore/objc/default/docs/SWGUserApi.md b/samples/client/petstore/objc/default/docs/SWGUserApi.md index e72f9f1ab90..ceb8c64ec9d 100644 --- a/samples/client/petstore/objc/default/docs/SWGUserApi.md +++ b/samples/client/petstore/objc/default/docs/SWGUserApi.md @@ -16,7 +16,7 @@ Method | HTTP request | Description # **createUser** ```objc --(NSURLSessionTask*) createUserWithUser: (SWGUser) user +-(NSURLSessionTask*) createUserWithUser: (SWGUser*) user completionHandler: (void (^)(NSError* error)) handler; ``` @@ -27,7 +27,7 @@ This can only be done by the logged in user. ### Example ```objc -SWGUser user = [[SWGUser alloc] init]; // Created user object (optional) +SWGUser* user = [[SWGUser alloc] init]; // Created user object (optional) SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; @@ -44,7 +44,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**SWGUser**](SWGUser.md)| Created user object | [optional] + **user** | [**SWGUser***](SWGUser.md)| Created user object | [optional] ### Return type @@ -72,7 +72,7 @@ Creates list of users with given input array ### Example ```objc -NSArray* user = @[[[SWGUser alloc] init]]; // List of user object (optional) +NSArray* user = @[[[NSArray alloc] init]]; // List of user object (optional) SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; @@ -89,7 +89,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**NSArray<SWGUser>***](SWGUser.md)| List of user object | [optional] + **user** | [**NSArray<SWGUser>***](NSArray.md)| List of user object | [optional] ### Return type @@ -117,7 +117,7 @@ Creates list of users with given input array ### Example ```objc -NSArray* user = @[[[SWGUser alloc] init]]; // List of user object (optional) +NSArray* user = @[[[NSArray alloc] init]]; // List of user object (optional) SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; @@ -134,7 +134,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**NSArray<SWGUser>***](SWGUser.md)| List of user object | [optional] + **user** | [**NSArray<SWGUser>***](NSArray.md)| List of user object | [optional] ### Return type @@ -342,7 +342,7 @@ No authorization required # **updateUser** ```objc -(NSURLSessionTask*) updateUserWithUsername: (NSString*) username - user: (SWGUser) user + user: (SWGUser*) user completionHandler: (void (^)(NSError* error)) handler; ``` @@ -354,7 +354,7 @@ This can only be done by the logged in user. ```objc NSString* username = @"username_example"; // name that need to be deleted -SWGUser user = [[SWGUser alloc] init]; // Updated user object (optional) +SWGUser* user = [[SWGUser alloc] init]; // Updated user object (optional) SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; @@ -373,7 +373,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **NSString***| name that need to be deleted | - **user** | [**SWGUser**](SWGUser.md)| Updated user object | [optional] + **user** | [**SWGUser***](SWGUser.md)| Updated user object | [optional] ### Return type