From a1cd01916eb6dcfe5610860c0b21d8c5899a134b Mon Sep 17 00:00:00 2001 From: Roman Truba Date: Mon, 7 Nov 2016 18:47:09 +0300 Subject: [PATCH] [ObjC] Fix deprecated JSONModel API usage (#4133) * Fixed deprecated usage -[JSONKeyMapper initWithDictionary:] * Petstore regenerated * Change minimal required version of JSONModel --- .../swagger-codegen/src/main/resources/objc/model-body.mustache | 2 +- .../swagger-codegen/src/main/resources/objc/podspec.mustache | 2 +- .../petstore/objc/default/SwaggerClient/Model/SWGCategory.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGPet.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGTag.m | 2 +- .../client/petstore/objc/default/SwaggerClient/Model/SWGUser.m | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache index 5ca9303e5a..8307a28d54 100644 --- a/modules/swagger-codegen/src/main/resources/objc/model-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/model-body.mustache @@ -43,7 +43,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ {{#vars}}@"{{name}}": @"{{baseName}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }]; } /** diff --git a/modules/swagger-codegen/src/main/resources/objc/podspec.mustache b/modules/swagger-codegen/src/main/resources/objc/podspec.mustache index bd0bd9f328..ecacd4aa0a 100644 --- a/modules/swagger-codegen/src/main/resources/objc/podspec.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/podspec.mustache @@ -31,7 +31,7 @@ Pod::Spec.new do |s| {{#useCoreData}} s.resources = '{{podName}}/**/*.{xcdatamodeld,xcdatamodel}'{{/useCoreData}} s.dependency 'AFNetworking', '~> 3' - s.dependency 'JSONModel', '~> 1.2' + s.dependency 'JSONModel', '~> 1.4' s.dependency 'ISO8601', '~> 0.5' end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m index 00745d1f49..21e354b30e 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m index e0b44e0695..7f93b0212c 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m index a1c63520dc..8c958695c8 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m index e71829873d..3a62bcbb9a 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }]; } /** diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m index c8195660df..fd50c02e2c 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m @@ -17,7 +17,7 @@ * This method is used by `JSONModel`. */ + (JSONKeyMapper *)keyMapper { - return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }]; + return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }]; } /**