fix the model's valid? of Ruby client to prevent runtime error (#3670) (#3671)

This commit is contained in:
Akira Tanimura 2019-08-19 14:31:34 +09:00 committed by William Cheng
parent 589e5c6312
commit 1a6d3671d9

View File

@ -246,14 +246,14 @@
{{#anyOf}}
{{#-first}}
_any_of_found = false
openapi_any_of.each do |_class|
self.class.openapi_any_of.each do |_class|
_any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash)
if _any_of.valid?
_any_of_found = true
end
end
if !_any_of_found?
if !_any_of_found
return false
end
@ -262,10 +262,10 @@
{{#oneOf}}
{{#-first}}
_one_of_found = false
openapi_one_of.each do |_class|
self.class.openapi_one_of.each do |_class|
_one_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash)
if _one_of.valid?
if _one_of_found?
if _one_of_found
return false
else
_one_of_found = true
@ -273,7 +273,7 @@
end
end
if !_one_of_found?
if !_one_of_found
return false
end