Ruby Client: nullable build_from_hash for array type

This commit is contained in:
Tomohiro Suwa
2020-09-12 23:08:19 +09:00
parent 684b77166b
commit 8217ecaeb7

View File

@@ -14,7 +14,9 @@
super(attributes)
{{/parent}}
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)
@@ -22,8 +24,6 @@
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