From 1a6d3671d98958c0867a8b8e08a3527ff62b8655 Mon Sep 17 00:00:00 2001 From: Akira Tanimura Date: Mon, 19 Aug 2019 14:31:34 +0900 Subject: [PATCH] fix the model's `valid?` of Ruby client to prevent runtime error (#3670) (#3671) --- .../ruby-client/partial_model_generic.mustache | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache b/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache index 65351bad6e5..f0d7c40a5bc 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache @@ -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