diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache index 569eade5db5..7ad0186daad 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache @@ -413,7 +413,7 @@ static void (^reachabilityChangeBlock)(int); } // map - NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/"; + NSString *dictPat = @"NSDictionary\\* /\\* (.+?), (.+) \\*/"; regexp = [NSRegularExpression regularExpressionWithPattern:dictPat options:NSRegularExpressionCaseInsensitive error:nil]; diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m index f51a012a811..6a2f7753db5 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m @@ -413,7 +413,7 @@ static void (^reachabilityChangeBlock)(int); } // map - NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/"; + NSString *dictPat = @"NSDictionary\\* /\\* (.+?), (.+) \\*/"; regexp = [NSRegularExpression regularExpressionWithPattern:dictPat options:NSRegularExpressionCaseInsensitive error:nil]; diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m index 2650dde31d0..a86ff7d01e4 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m @@ -116,4 +116,19 @@ XCTAssertEqualObjects([result[@"pet"] _id], @119); } +- (void)testDeserializeNestedMap { + NSDictionary *data = + @{ + @"foo": @{ + @"bar": @1 + } + }; + + NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, NSDictionary* /* NSString, NSNumber */ */"]; + + XCTAssertTrue([result isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"foo"] isKindOfClass:[NSDictionary class]]); + XCTAssertTrue([result[@"foo"][@"bar"] isKindOfClass:[NSNumber class]]); +} + @end