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 53e6895fe33..e4c85166b8b 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache @@ -69,6 +69,11 @@ static NSString * basePath = @"{{basePath}}"; {{#returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{{returnType}}} output, NSError* error))completionBlock{{/returnBaseType}} {{^returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)(NSError* error))completionBlock{{/returnBaseType}} { + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + NSAssert({{paramName}} != nil, @"Missing the required parameter `{{paramName}}` when calling {{nickname}}"); + {{/required}}{{/allParams}} + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@{{path}}", basePath]; // remove format in URL if needed diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/client/SWGPetApi.m index 62bc34acbee..d73018edf97 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.m +++ b/samples/client/petstore/objc/client/SWGPetApi.m @@ -67,6 +67,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath]; // remove format in URL if needed @@ -158,6 +160,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath]; // remove format in URL if needed @@ -249,6 +253,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByStatus", basePath]; // remove format in URL if needed @@ -336,6 +342,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByTags", basePath]; // remove format in URL if needed @@ -423,6 +431,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock { + + // verify the required parameter 'petId' is set + NSAssert(petId != nil, @"Missing the required parameter `petId` when calling getPetById"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; // remove format in URL if needed @@ -510,6 +523,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + // verify the required parameter 'petId' is set + NSAssert(petId != nil, @"Missing the required parameter `petId` when calling updatePetWithForm"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; // remove format in URL if needed @@ -597,6 +615,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + // verify the required parameter 'petId' is set + NSAssert(petId != nil, @"Missing the required parameter `petId` when calling deletePet"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; // remove format in URL if needed @@ -672,6 +695,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + // verify the required parameter 'petId' is set + NSAssert(petId != nil, @"Missing the required parameter `petId` when calling uploadFile"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}/uploadImage", basePath]; // remove format in URL if needed diff --git a/samples/client/petstore/objc/client/SWGStoreApi.m b/samples/client/petstore/objc/client/SWGStoreApi.m index c50cf67c5dc..752fc64d601 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.m +++ b/samples/client/petstore/objc/client/SWGStoreApi.m @@ -64,6 +64,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; (void (^)(NSDictionary* output, NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/inventory", basePath]; // remove format in URL if needed @@ -138,6 +140,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order", basePath]; // remove format in URL if needed @@ -243,6 +247,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock { + + // verify the required parameter 'orderId' is set + NSAssert(orderId != nil, @"Missing the required parameter `orderId` when calling getOrderById"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; // remove format in URL if needed @@ -326,6 +335,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + // verify the required parameter 'orderId' is set + NSAssert(orderId != nil, @"Missing the required parameter `orderId` when calling deleteOrder"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; // remove format in URL if needed diff --git a/samples/client/petstore/objc/client/SWGUserApi.m b/samples/client/petstore/objc/client/SWGUserApi.m index 1316cebd07c..faa086c5d35 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.m +++ b/samples/client/petstore/objc/client/SWGUserApi.m @@ -66,6 +66,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath]; // remove format in URL if needed @@ -157,6 +159,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath]; // remove format in URL if needed @@ -248,6 +252,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath]; // remove format in URL if needed @@ -341,6 +347,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSString* output, NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/login", basePath]; // remove format in URL if needed @@ -427,6 +435,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; (void (^)(NSError* error))completionBlock { + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/logout", basePath]; // remove format in URL if needed @@ -495,6 +505,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock { + + // verify the required parameter 'username' is set + NSAssert(username != nil, @"Missing the required parameter `username` when calling getUserByName"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; // remove format in URL if needed @@ -580,6 +595,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + // verify the required parameter 'username' is set + NSAssert(username != nil, @"Missing the required parameter `username` when calling updateUser"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; // remove format in URL if needed @@ -672,6 +692,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; completionHandler: (void (^)(NSError* error))completionBlock { + + // verify the required parameter 'username' is set + NSAssert(username != nil, @"Missing the required parameter `username` when calling deleteUser"); + + NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; // remove format in URL if needed