From 5fce12321e408b97d6f43b05a0edd3967a1ef4c0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 7 Oct 2020 19:03:39 -0700 Subject: [PATCH] Adds ensure-up-to-date changes' --- .../ruby-client/lib/petstore/models/array_alias.rb | 6 +++--- .../ruby-client/lib/petstore/models/map_alias.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb index 77ca2e8d358..7047e27f1ac 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb @@ -97,7 +97,9 @@ module Petstore return nil unless attributes.is_a?(Hash) super(attributes) self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) @@ -105,8 +107,6 @@ module Petstore end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{key}=", nil) end end diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb index 22ae17aeb88..d8dc8589f7a 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb @@ -93,7 +93,9 @@ module Petstore def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) @@ -101,8 +103,6 @@ module Petstore end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{key}=", nil) end end