added required parameters check for objc

This commit is contained in:
geekerzp 2015-05-19 17:12:46 +08:00
parent e068ad4494
commit a0abea4b72
4 changed files with 72 additions and 0 deletions

View File

@ -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

View File

@ -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<SWGPet>* 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<SWGPet>* 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

View File

@ -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

View File

@ -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