diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache index 03b8ca31f92..02dfd6703a9 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache @@ -204,9 +204,7 @@ module {{moduleName}} end else # models, e.g. Pet - {{moduleName}}.const_get(return_type).new.tap do |model| - model.build_from_hash data - end + {{moduleName}}.const_get(return_type).build_from_hash(data) end end diff --git a/modules/openapi-generator/src/main/resources/ruby-client/base_object.mustache b/modules/openapi-generator/src/main/resources/ruby-client/base_object.mustache index faef2ae199e..9ebcde2c6c1 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/base_object.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/base_object.mustache @@ -1,3 +1,10 @@ + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -58,8 +65,7 @@ end end else # model - temp_model = {{moduleName}}.const_get(type).new - temp_model.build_from_hash(value) + {{moduleName}}.const_get(type).build_from_hash(value) end end diff --git a/modules/openapi-generator/src/main/resources/ruby-client/partial_model_enum_class.mustache b/modules/openapi-generator/src/main/resources/ruby-client/partial_model_enum_class.mustache index 36cee9e7948..797bab82ab3 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/partial_model_enum_class.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/partial_model_enum_class.mustache @@ -2,6 +2,13 @@ {{#allowableValues}}{{#enumVars}} {{{name}}} = {{{value}}}.freeze{{/enumVars}}{{/allowableValues}} + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + # Builds the enum from string # @param [String] The enum value in the form of the string # @return [String] The enum value @@ -10,4 +17,4 @@ raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty? value end - end \ No newline at end of file + end 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 f6082b111ab..17755675e7e 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 @@ -239,8 +239,7 @@ {{#-first}} _any_of_found = false openapi_any_of.each do |_class| - _any_of = {{moduleName}}.const_get(_class).new - _any_of.build_from_hash(self.to_hash) + _any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash) if _any_of.valid? _any_of_found = true end @@ -256,8 +255,7 @@ {{#-first}} _one_of_found = false openapi_one_of.each do |_class| - _one_of = {{moduleName}}.const_get(_class).new - _one_of.build_from_hash(self.to_hash) + _one_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash) if _one_of.valid? if _one_of_found? return false diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 2e38bc099f7..85df1d28fd9 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -210,9 +210,7 @@ module Petstore end else # models, e.g. Pet - Petstore.const_get(return_type).new.tap do |model| - model.build_from_hash data - end + Petstore.const_get(return_type).build_from_hash(data) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb index 6b716e0fa3d..878be7f8125 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb @@ -89,6 +89,13 @@ module Petstore [map_property, map_of_map_property].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -146,8 +153,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index b82f4d6de05..31eaba3f8b3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -97,6 +97,13 @@ module Petstore [class_name, color].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -154,8 +161,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb index 7b3e9eeae23..91aff68e5d8 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb @@ -94,6 +94,13 @@ module Petstore [code, type, message].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -151,8 +158,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb index 75605c56bd5..aa8c2d34bed 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb @@ -78,6 +78,13 @@ module Petstore [array_array_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,8 +142,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb index 22f04b5b925..276eba10bbf 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb @@ -78,6 +78,13 @@ module Petstore [array_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,8 +142,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_test.rb b/samples/client/petstore/ruby/lib/petstore/models/array_test.rb index e37a54fdecc..5da3bda45b3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_test.rb @@ -100,6 +100,13 @@ module Petstore [array_of_string, array_array_of_integer, array_array_of_model].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -157,8 +164,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb b/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb index 9be52e89ff0..59085dadb98 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb @@ -122,6 +122,13 @@ module Petstore [small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -179,8 +186,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb index be51cd64741..190bc4e92a2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -86,6 +86,13 @@ module Petstore [declawed].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -144,8 +151,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index a00d2e34927..dd6dd978269 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -92,6 +92,13 @@ module Petstore [id, name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -149,8 +156,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/class_model.rb b/samples/client/petstore/ruby/lib/petstore/models/class_model.rb index 013dfc01e5b..0f70d9ef08d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/class_model.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/class_model.rb @@ -77,6 +77,13 @@ module Petstore [_class].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -134,8 +141,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/client.rb b/samples/client/petstore/ruby/lib/petstore/models/client.rb index e3e84e1d86c..5a248bc0c3e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/client.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/client.rb @@ -76,6 +76,13 @@ module Petstore [client].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb index bd06c902fe4..eea6b2a53aa 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -86,6 +86,13 @@ module Petstore [breed].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -144,8 +151,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb index d870963ab7e..043911c0996 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb @@ -121,6 +121,13 @@ module Petstore [just_symbol, array_enum].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -178,8 +185,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb index a0b472f3c16..12060da1e83 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_class.rb @@ -19,6 +19,13 @@ module Petstore EFG = '-efg'.freeze XYZ = '(xyz)'.freeze + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + # Builds the enum from string # @param [String] The enum value in the form of the string # @return [String] The enum value @@ -28,4 +35,5 @@ module Petstore value end end + end diff --git a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb index b66bdd16472..54d62e17aec 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb @@ -187,6 +187,13 @@ module Petstore [enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -244,8 +251,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/file.rb b/samples/client/petstore/ruby/lib/petstore/models/file.rb index 473eb78e06d..9d7eacc845d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/file.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/file.rb @@ -78,6 +78,13 @@ module Petstore [source_uri].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,8 +142,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb b/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb index 43619c4d00c..dac348cdffa 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb @@ -87,6 +87,13 @@ module Petstore [file, files].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -144,8 +151,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index 0d1bc02ddda..e129fa70680 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -390,6 +390,13 @@ module Petstore [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -447,8 +454,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb b/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb index 272a53c53f2..e4abd4939ba 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb @@ -85,6 +85,13 @@ module Petstore [bar, foo].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -142,8 +149,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/list.rb b/samples/client/petstore/ruby/lib/petstore/models/list.rb index d0399fb4bd4..9f3421caeb5 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/list.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/list.rb @@ -76,6 +76,13 @@ module Petstore [_123_list].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb index 02f17237f70..98e26cb4d72 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb @@ -133,6 +133,13 @@ module Petstore [map_map_of_string, map_of_enum_string, direct_map, indirect_map].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -190,8 +197,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index 35e069618c0..fe3efa3e57d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -96,6 +96,13 @@ module Petstore [uuid, date_time, map].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -153,8 +160,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb index b1321c3ffae..3a5985006c9 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb @@ -86,6 +86,13 @@ module Petstore [name, _class].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -143,8 +150,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb index d573b9ea9af..9efe48d4fc3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -77,6 +77,13 @@ module Petstore [_return].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -134,8 +141,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/name.rb b/samples/client/petstore/ruby/lib/petstore/models/name.rb index 98aab8f78f4..345adf28ff1 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/name.rb @@ -109,6 +109,13 @@ module Petstore [name, snake_case, property, _123_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -166,8 +173,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/number_only.rb b/samples/client/petstore/ruby/lib/petstore/models/number_only.rb index 1e7e626cd17..7a064ce652f 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/number_only.rb @@ -76,6 +76,13 @@ module Petstore [just_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/order.rb b/samples/client/petstore/ruby/lib/petstore/models/order.rb index 11f9f4c3710..e15cb6eaba6 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/order.rb @@ -158,6 +158,13 @@ module Petstore [id, pet_id, quantity, ship_date, status, complete].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -215,8 +222,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb index 230bc670767..bcc41d2e5fd 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb @@ -94,6 +94,13 @@ module Petstore [my_number, my_string, my_boolean].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -151,8 +158,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb index cec4c0ef830..4338180c37b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_enum.rb @@ -19,6 +19,13 @@ module Petstore APPROVED = 'approved'.freeze DELIVERED = 'delivered'.freeze + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + # Builds the enum from string # @param [String] The enum value in the form of the string # @return [String] The enum value @@ -28,4 +35,5 @@ module Petstore value end end + end diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index 183f2d9b7ba..df356088bf2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -170,6 +170,13 @@ module Petstore [id, category, name, photo_urls, tags, status].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -227,8 +234,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb b/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb index a181f9a0a9e..846c6dffc2c 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb @@ -85,6 +85,13 @@ module Petstore [bar, baz].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -142,8 +149,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb index 2ed4335bef2..2309bb09f29 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb @@ -76,6 +76,13 @@ module Petstore [special_property_name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/client/petstore/ruby/lib/petstore/models/tag.rb index e160a1de275..68c8955a56c 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/tag.rb @@ -85,6 +85,13 @@ module Petstore [id, name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -142,8 +149,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/user.rb b/samples/client/petstore/ruby/lib/petstore/models/user.rb index 2c2e0402db5..879aa6299d5 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/user.rb @@ -140,6 +140,13 @@ module Petstore [id, username, first_name, last_name, email, password, phone, user_status].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -197,8 +204,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb index 2e38bc099f7..85df1d28fd9 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb @@ -210,9 +210,7 @@ module Petstore end else # models, e.g. Pet - Petstore.const_get(return_type).new.tap do |model| - model.build_from_hash data - end + Petstore.const_get(return_type).build_from_hash(data) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb index 6b716e0fa3d..878be7f8125 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb @@ -89,6 +89,13 @@ module Petstore [map_property, map_of_map_property].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -146,8 +153,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/animal.rb index b82f4d6de05..31eaba3f8b3 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/animal.rb @@ -97,6 +97,13 @@ module Petstore [class_name, color].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -154,8 +161,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/api_response.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/api_response.rb index 7b3e9eeae23..91aff68e5d8 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/api_response.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/api_response.rb @@ -94,6 +94,13 @@ module Petstore [code, type, message].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -151,8 +158,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb index 75605c56bd5..aa8c2d34bed 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_array_of_number_only.rb @@ -78,6 +78,13 @@ module Petstore [array_array_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,8 +142,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb index 22f04b5b925..276eba10bbf 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_of_number_only.rb @@ -78,6 +78,13 @@ module Petstore [array_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,8 +142,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_test.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_test.rb index e37a54fdecc..5da3bda45b3 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_test.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/array_test.rb @@ -100,6 +100,13 @@ module Petstore [array_of_string, array_array_of_integer, array_array_of_model].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -157,8 +164,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/capitalization.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/capitalization.rb index 9be52e89ff0..59085dadb98 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/capitalization.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/capitalization.rb @@ -122,6 +122,13 @@ module Petstore [small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -179,8 +186,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/cat.rb index be51cd64741..190bc4e92a2 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/cat.rb @@ -86,6 +86,13 @@ module Petstore [declawed].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -144,8 +151,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/category.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/category.rb index a00d2e34927..dd6dd978269 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/category.rb @@ -92,6 +92,13 @@ module Petstore [id, name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -149,8 +156,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/class_model.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/class_model.rb index 013dfc01e5b..0f70d9ef08d 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/class_model.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/class_model.rb @@ -77,6 +77,13 @@ module Petstore [_class].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -134,8 +141,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/client.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/client.rb index e3e84e1d86c..5a248bc0c3e 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/client.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/client.rb @@ -76,6 +76,13 @@ module Petstore [client].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/dog.rb index bd06c902fe4..eea6b2a53aa 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/dog.rb @@ -86,6 +86,13 @@ module Petstore [breed].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -144,8 +151,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_arrays.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_arrays.rb index d870963ab7e..043911c0996 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_arrays.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_arrays.rb @@ -121,6 +121,13 @@ module Petstore [just_symbol, array_enum].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -178,8 +185,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_class.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_class.rb index a0b472f3c16..12060da1e83 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_class.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_class.rb @@ -19,6 +19,13 @@ module Petstore EFG = '-efg'.freeze XYZ = '(xyz)'.freeze + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + # Builds the enum from string # @param [String] The enum value in the form of the string # @return [String] The enum value @@ -28,4 +35,5 @@ module Petstore value end end + end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_test.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_test.rb index b66bdd16472..54d62e17aec 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_test.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/enum_test.rb @@ -187,6 +187,13 @@ module Petstore [enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -244,8 +251,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/file.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/file.rb index 473eb78e06d..9d7eacc845d 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/file.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/file.rb @@ -78,6 +78,13 @@ module Petstore [source_uri].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,8 +142,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb index 43619c4d00c..dac348cdffa 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/file_schema_test_class.rb @@ -87,6 +87,13 @@ module Petstore [file, files].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -144,8 +151,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/foo.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/foo.rb index 1d722410923..6c344358b8f 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/foo.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/foo.rb @@ -78,6 +78,13 @@ module Petstore [bar].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,8 +142,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/format_test.rb index a1bab83fc89..90890cbd079 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -421,6 +421,13 @@ module Petstore [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password, pattern_with_digits, pattern_with_digits_and_delimiter].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -478,8 +485,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb index 272a53c53f2..e4abd4939ba 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/has_only_read_only.rb @@ -85,6 +85,13 @@ module Petstore [bar, foo].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -142,8 +149,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_response_default.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_response_default.rb index 5d4ac11be7e..56bd9d09388 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_response_default.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_response_default.rb @@ -76,6 +76,13 @@ module Petstore [string].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/list.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/list.rb index d0399fb4bd4..9f3421caeb5 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/list.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/list.rb @@ -76,6 +76,13 @@ module Petstore [_123_list].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/map_test.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/map_test.rb index 02f17237f70..98e26cb4d72 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/map_test.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/map_test.rb @@ -133,6 +133,13 @@ module Petstore [map_map_of_string, map_of_enum_string, direct_map, indirect_map].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -190,8 +197,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index 35e069618c0..fe3efa3e57d 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -96,6 +96,13 @@ module Petstore [uuid, date_time, map].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -153,8 +160,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/model200_response.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/model200_response.rb index b1321c3ffae..3a5985006c9 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/model200_response.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/model200_response.rb @@ -86,6 +86,13 @@ module Petstore [name, _class].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -143,8 +150,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/model_return.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/model_return.rb index d573b9ea9af..9efe48d4fc3 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -77,6 +77,13 @@ module Petstore [_return].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -134,8 +141,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/name.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/name.rb index 98aab8f78f4..345adf28ff1 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/name.rb @@ -109,6 +109,13 @@ module Petstore [name, snake_case, property, _123_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -166,8 +173,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/number_only.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/number_only.rb index 1e7e626cd17..7a064ce652f 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/number_only.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/number_only.rb @@ -76,6 +76,13 @@ module Petstore [just_number].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/order.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/order.rb index 11f9f4c3710..e15cb6eaba6 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/order.rb @@ -158,6 +158,13 @@ module Petstore [id, pet_id, quantity, ship_date, status, complete].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -215,8 +222,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_composite.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_composite.rb index 230bc670767..bcc41d2e5fd 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_composite.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_composite.rb @@ -94,6 +94,13 @@ module Petstore [my_number, my_string, my_boolean].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -151,8 +158,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_enum.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_enum.rb index cec4c0ef830..4338180c37b 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_enum.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/outer_enum.rb @@ -19,6 +19,13 @@ module Petstore APPROVED = 'approved'.freeze DELIVERED = 'delivered'.freeze + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + # Builds the enum from string # @param [String] The enum value in the form of the string # @return [String] The enum value @@ -28,4 +35,5 @@ module Petstore value end end + end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/pet.rb index 183f2d9b7ba..df356088bf2 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/pet.rb @@ -170,6 +170,13 @@ module Petstore [id, category, name, photo_urls, tags, status].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -227,8 +234,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/read_only_first.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/read_only_first.rb index a181f9a0a9e..846c6dffc2c 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/read_only_first.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/read_only_first.rb @@ -85,6 +85,13 @@ module Petstore [bar, baz].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -142,8 +149,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/special_model_name.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/special_model_name.rb index 2ed4335bef2..2309bb09f29 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/special_model_name.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/special_model_name.rb @@ -76,6 +76,13 @@ module Petstore [special_property_name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -133,8 +140,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/tag.rb index e160a1de275..68c8955a56c 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/tag.rb @@ -85,6 +85,13 @@ module Petstore [id, name].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -142,8 +149,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/user.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/user.rb index 2c2e0402db5..879aa6299d5 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/user.rb @@ -140,6 +140,13 @@ module Petstore [id, username, first_name, last_name, email, password, phone, user_status].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -197,8 +204,7 @@ module Petstore end end else # model - temp_model = Petstore.const_get(type).new - temp_model.build_from_hash(value) + Petstore.const_get(type).build_from_hash(value) end end