[ruby] fix oneOf handling (#5706)

* [ruby] fix oneOf handling

* use previous ruby configs due to issue #4690

* check for oneOf model in base_object

* validate the attributes in partial_oneof_module
This commit is contained in:
Julien Feltesse
2020-11-23 23:43:34 +09:00
committed by GitHub
parent 6f6822a1b7
commit 522faf835a
221 changed files with 2719 additions and 1732 deletions

View File

@@ -274,8 +274,9 @@ module DynamicServers
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
end
else
# models, e.g. Pet
DynamicServers.const_get(return_type).build_from_hash(data)
# models (e.g. Pet) or oneOf
klass = DynamicServers.const_get(return_type)
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
end
end