Update ObjC petstore and test cases (#139)

* restore objc samples from codegen 2x

* update objc petstore test

* update objc with oas3 petstore
This commit is contained in:
William Cheng 2018-04-19 12:08:00 +08:00 committed by GitHub
parent 231547f6c7
commit 9fdcb3681b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 38 additions and 38 deletions

View File

@ -69,7 +69,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; [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]; SWGPetApi *apiInstance = [[SWGPetApi alloc] init];

View File

@ -31,7 +31,7 @@ extern NSInteger kSWGPetApiMissingParamErrorCode;
/// code:405 message:"Invalid input" /// code:405 message:"Invalid input"
/// ///
/// @return void /// @return void
-(NSURLSessionTask*) addPetWithPet: (SWGPet) pet -(NSURLSessionTask*) addPetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
@ -99,7 +99,7 @@ extern NSInteger kSWGPetApiMissingParamErrorCode;
/// code:405 message:"Validation exception" /// code:405 message:"Validation exception"
/// ///
/// @return void /// @return void
-(NSURLSessionTask*) updatePetWithPet: (SWGPet) pet -(NSURLSessionTask*) updatePetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;

View File

@ -56,7 +56,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
/// ///
/// @returns void /// @returns void
/// ///
-(NSURLSessionTask*) addPetWithPet: (SWGPet) pet -(NSURLSessionTask*) addPetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler { completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@ -367,7 +367,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
/// ///
/// @returns void /// @returns void
/// ///
-(NSURLSessionTask*) updatePetWithPet: (SWGPet) pet -(NSURLSessionTask*) updatePetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler { completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];

View File

@ -70,7 +70,7 @@ extern NSInteger kSWGStoreApiMissingParamErrorCode;
/// code:400 message:"Invalid Order" /// code:400 message:"Invalid Order"
/// ///
/// @return SWGOrder* /// @return SWGOrder*
-(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder) order -(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder*) order
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler; completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;

View File

@ -244,7 +244,7 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
/// ///
/// @returns SWGOrder* /// @returns SWGOrder*
/// ///
-(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder) order -(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder*) order
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler { completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"]; NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"];

View File

@ -31,7 +31,7 @@ extern NSInteger kSWGUserApiMissingParamErrorCode;
/// code:0 message:"successful operation" /// code:0 message:"successful operation"
/// ///
/// @return void /// @return void
-(NSURLSessionTask*) createUserWithUser: (SWGUser) user -(NSURLSessionTask*) createUserWithUser: (SWGUser*) user
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
@ -123,7 +123,7 @@ extern NSInteger kSWGUserApiMissingParamErrorCode;
/// ///
/// @return void /// @return void
-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username -(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
user: (SWGUser) user user: (SWGUser*) user
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;

View File

@ -56,7 +56,7 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
/// ///
/// @returns void /// @returns void
/// ///
-(NSURLSessionTask*) createUserWithUser: (SWGUser) user -(NSURLSessionTask*) createUserWithUser: (SWGUser*) user
completionHandler: (void (^)(NSError* error)) handler { completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"]; NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"];
@ -475,7 +475,7 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
/// @returns void /// @returns void
/// ///
-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username -(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
user: (SWGUser) user user: (SWGUser*) user
completionHandler: (void (^)(NSError* error)) handler { completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == nil) { if (username == nil) {

View File

@ -34,7 +34,7 @@
XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetById"]; XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetById"];
SWGPet* pet = [self createPet]; SWGPet* pet = [self createPet];
[api addPetWithBody:pet completionHandler:^(NSError *error) { [api addPetWithPet:pet completionHandler:^(NSError *error) {
if(error){ if(error){
XCTFail(@"got error %@", error); XCTFail(@"got error %@", error);
} }
@ -74,7 +74,7 @@
XCTestExpectation *expectation = [self expectationWithDescription:@"testUpdatePet"]; XCTestExpectation *expectation = [self expectationWithDescription:@"testUpdatePet"];
SWGPet* pet = [self createPet]; SWGPet* pet = [self createPet];
[api addPetWithBody:pet completionHandler:^(NSError *error) { [api addPetWithPet:pet completionHandler:^(NSError *error) {
if(error) { if(error) {
XCTFail(@"got error %@", error); XCTFail(@"got error %@", error);
} }
@ -93,7 +93,7 @@
[pet setName:@"programmer"]; [pet setName:@"programmer"];
[pet setStatus:@"confused"]; [pet setStatus:@"confused"];
[api updatePetWithBody:pet [api updatePetWithPet:pet
completionHandler:^(NSError *error) { completionHandler:^(NSError *error) {
if(error) { if(error) {
XCTFail(@"got error %@", error); XCTFail(@"got error %@", error);
@ -166,7 +166,7 @@ which causes an exception when deserializing the data
NSLog(@"%@", pet._id); NSLog(@"%@", pet._id);
pet.tags = (id) @[tag]; pet.tags = (id) @[tag];
[api addPetWithBody:pet completionHandler:^(NSError *error) { [api addPetWithPet:pet completionHandler:^(NSError *error) {
if(error) { if(error) {
XCTFail(@"got error %@", error); XCTFail(@"got error %@", error);
} }
@ -199,7 +199,7 @@ which causes an exception when deserializing the data
SWGPet* pet = [self createPet]; SWGPet* pet = [self createPet];
[api addPetWithBody:pet completionHandler:^(NSError *error) { [api addPetWithPet:pet completionHandler:^(NSError *error) {
if(error){ if(error){
XCTFail(@"got error %@", error); XCTFail(@"got error %@", error);
} }

View File

@ -16,7 +16,7 @@ Method | HTTP request | Description
# **addPet** # **addPet**
```objc ```objc
-(NSURLSessionTask*) addPetWithPet: (SWGPet) pet -(NSURLSessionTask*) addPetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
``` ```
@ -30,7 +30,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; [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]; SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
@ -47,7 +47,7 @@ SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
Name | Type | Description | Notes 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 ### Return type
@ -81,7 +81,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; [apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSNumber* petId = @789; // Pet id to delete NSNumber* petId = @56; // Pet id to delete
NSString* apiKey = @"apiKey_example"; // (optional) NSString* apiKey = @"apiKey_example"; // (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
@ -251,7 +251,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; [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]; SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
@ -290,7 +290,7 @@ Name | Type | Description | Notes
# **updatePet** # **updatePet**
```objc ```objc
-(NSURLSessionTask*) updatePetWithPet: (SWGPet) pet -(NSURLSessionTask*) updatePetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
``` ```
@ -304,7 +304,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; [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]; SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
@ -321,7 +321,7 @@ SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
Name | Type | Description | Notes 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 ### Return type
@ -414,7 +414,7 @@ SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; [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) NSString* additionalMetadata = @"additionalMetadata_example"; // Additional data to pass to server (optional)
NSURL* file = [NSURL fileURLWithPath:@"/path/to/file"]; // file to upload (optional) NSURL* file = [NSURL fileURLWithPath:@"/path/to/file"]; // file to upload (optional)

View File

@ -162,7 +162,7 @@ No authorization required
# **placeOrder** # **placeOrder**
```objc ```objc
-(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder) order -(NSURLSessionTask*) placeOrderWithOrder: (SWGOrder*) order
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler; completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
``` ```
@ -171,7 +171,7 @@ Place an order for a pet
### Example ### Example
```objc ```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]; SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init];
@ -191,7 +191,7 @@ SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init];
Name | Type | Description | Notes 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 ### Return type

View File

@ -16,7 +16,7 @@ Method | HTTP request | Description
# **createUser** # **createUser**
```objc ```objc
-(NSURLSessionTask*) createUserWithUser: (SWGUser) user -(NSURLSessionTask*) createUserWithUser: (SWGUser*) user
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
``` ```
@ -27,7 +27,7 @@ This can only be done by the logged in user.
### Example ### Example
```objc ```objc
SWGUser user = [[SWGUser alloc] init]; // Created user object (optional) SWGUser* user = [[SWGUser alloc] init]; // Created user object (optional)
SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
@ -44,7 +44,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**user** | [**SWGUser**](SWGUser.md)| Created user object | [optional] **user** | [**SWGUser***](SWGUser.md)| Created user object | [optional]
### Return type ### Return type
@ -72,7 +72,7 @@ Creates list of users with given input array
### Example ### Example
```objc ```objc
NSArray<SWGUser>* user = @[[[SWGUser alloc] init]]; // List of user object (optional) NSArray<SWGUser>* user = @[[[NSArray alloc] init]]; // List of user object (optional)
SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
@ -89,7 +89,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**user** | [**NSArray&lt;SWGUser&gt;***](SWGUser.md)| List of user object | [optional] **user** | [**NSArray&lt;SWGUser&gt;***](NSArray.md)| List of user object | [optional]
### Return type ### Return type
@ -117,7 +117,7 @@ Creates list of users with given input array
### Example ### Example
```objc ```objc
NSArray<SWGUser>* user = @[[[SWGUser alloc] init]]; // List of user object (optional) NSArray<SWGUser>* user = @[[[NSArray alloc] init]]; // List of user object (optional)
SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
@ -134,7 +134,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**user** | [**NSArray&lt;SWGUser&gt;***](SWGUser.md)| List of user object | [optional] **user** | [**NSArray&lt;SWGUser&gt;***](NSArray.md)| List of user object | [optional]
### Return type ### Return type
@ -342,7 +342,7 @@ No authorization required
# **updateUser** # **updateUser**
```objc ```objc
-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username -(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
user: (SWGUser) user user: (SWGUser*) user
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
``` ```
@ -354,7 +354,7 @@ This can only be done by the logged in user.
```objc ```objc
NSString* username = @"username_example"; // name that need to be deleted 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]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
@ -373,7 +373,7 @@ SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **NSString***| name that need to be deleted | **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 ### Return type