diff --git a/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache b/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache index 00a75b25396..d1882aa2641 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/partial_model_generic.mustache @@ -56,11 +56,16 @@ {{#vars}} if attributes.has_key?(:'{{{baseName}}}') - {{#isContainer}} + {{#isListContainer}} if (value = attributes[:'{{{baseName}}}']).is_a?(Array) self.{{{name}}} = value end - {{/isContainer}} + {{/isListContainer}} + {{#isMapContainer}} + if (value = attributes[:'{{{baseName}}}']).is_a?(Hash) + self.{{{name}}} = value + end + {{/isMapContainer}} {{^isContainer}} self.{{{name}}} = attributes[:'{{{baseName}}}'] {{/isContainer}} diff --git a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb index e5d7fb8f24b..e3d8890b6e2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb @@ -45,13 +45,13 @@ module Petstore attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'map_property') - if (value = attributes[:'map_property']).is_a?(Array) + if (value = attributes[:'map_property']).is_a?(Hash) self.map_property = value end end if attributes.has_key?(:'map_of_map_property') - if (value = attributes[:'map_of_map_property']).is_a?(Array) + if (value = attributes[:'map_of_map_property']).is_a?(Hash) self.map_of_map_property = value end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb index 9510ce2a93c..7b8f9527797 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb @@ -66,13 +66,13 @@ module Petstore attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'map_map_of_string') - if (value = attributes[:'map_map_of_string']).is_a?(Array) + if (value = attributes[:'map_map_of_string']).is_a?(Hash) self.map_map_of_string = value end end if attributes.has_key?(:'map_of_enum_string') - if (value = attributes[:'map_of_enum_string']).is_a?(Array) + if (value = attributes[:'map_of_enum_string']).is_a?(Hash) self.map_of_enum_string = value end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index f16ce716f33..75c9795f479 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -57,7 +57,7 @@ module Petstore end if attributes.has_key?(:'map') - if (value = attributes[:'map']).is_a?(Array) + if (value = attributes[:'map']).is_a?(Hash) self.map = value end end