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 40745559b37..75f40c419b1 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 @@ -42,16 +42,21 @@ } end - # Returns all the JSON keys this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}} - def self.acceptable_attributes + # Returns attribute mapping this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}} + def self.acceptable_attribute_map {{^parent}} - attribute_map.values + attribute_map {{/parent}} {{#parent}} - attribute_map.values.concat(superclass.acceptable_attributes) + superclass.acceptable_attribute_map.merge(attribute_map) {{/parent}} end + # Returns all the JSON keys this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}} + def self.acceptable_attributes + acceptable_attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -115,9 +120,10 @@ end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `{{{moduleName}}}::{{{classname}}}`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `{{{moduleName}}}::{{{classname}}}`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -350,6 +356,22 @@ @{{{name}}} = {{{name}}} end + {{/hasValidation}} + {{^hasValidation}} + {{^isNullable}} + {{#required}} + # Custom attribute writer method with validation + # @param [Object] {{{name}}} Value to be assigned + def {{{name}}}=({{{name}}}) + if {{{name}}}.nil? + fail ArgumentError, '{{{name}}} cannot be nil' + end + + @{{{name}}} = {{{name}}} + end + + {{/required}} + {{/isNullable}} {{/hasValidation}} {{/isEnum}} {{/vars}} diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/bird.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/bird.rb index e10bdd158e2..cb33546283b 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/bird.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/bird.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Bird`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Bird`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/category.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/category.rb index a3849456110..c7c5d10153f 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/category.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/category.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Category`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/data_query.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/data_query.rb index 5870d99945c..72bc868d0e2 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/data_query.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/data_query.rb @@ -55,9 +55,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -90,9 +95,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DataQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DataQuery`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/default_value.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/default_value.rb index fa7e8985959..bc2bc60bdf1 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/default_value.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/default_value.rb @@ -68,9 +68,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DefaultValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DefaultValue`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/number_properties_only.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/number_properties_only.rb index b64e212add7..e0deec17c09 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/number_properties_only.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/number_properties_only.rb @@ -30,9 +30,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NumberPropertiesOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NumberPropertiesOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/pet.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/pet.rb index 3982826914c..27ec4ae311d 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/pet.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/pet.rb @@ -62,9 +62,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Pet`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,26 @@ module OpenapiClient true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] photo_urls Value to be assigned + def photo_urls=(photo_urls) + if photo_urls.nil? + fail ArgumentError, 'photo_urls cannot be nil' + end + + @photo_urls = photo_urls + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/query.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/query.rb index 192250cda1f..b469c31b089 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/query.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/query.rb @@ -50,9 +50,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -77,9 +82,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Query`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Query`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/tag.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/tag.rb index e485d7be485..2682e6c5eb0 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/tag.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/tag.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb index a94e5146bbd..0e5cff7f4e2 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb @@ -24,9 +24,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb index d26eb908f4f..c1306d8c6d3 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb @@ -33,9 +33,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -70,9 +75,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb index 6684b4df66c..26720dbec24 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb @@ -24,9 +24,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb index e10bdd158e2..cb33546283b 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Bird`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Bird`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb index a3849456110..c7c5d10153f 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Category`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb index 5870d99945c..72bc868d0e2 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb @@ -55,9 +55,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -90,9 +95,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DataQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DataQuery`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb index fa7e8985959..bc2bc60bdf1 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb @@ -68,9 +68,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DefaultValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DefaultValue`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb index b64e212add7..e0deec17c09 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb @@ -30,9 +30,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NumberPropertiesOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NumberPropertiesOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb index 3982826914c..27ec4ae311d 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb @@ -62,9 +62,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Pet`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,26 @@ module OpenapiClient true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] photo_urls Value to be assigned + def photo_urls=(photo_urls) + if photo_urls.nil? + fail ArgumentError, 'photo_urls cannot be nil' + end + + @photo_urls = photo_urls + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb index 192250cda1f..b469c31b089 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb @@ -50,9 +50,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -77,9 +82,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Query`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Query`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb index e485d7be485..2682e6c5eb0 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb index a94e5146bbd..0e5cff7f4e2 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb @@ -24,9 +24,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb index d26eb908f4f..c1306d8c6d3 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb @@ -33,9 +33,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -70,9 +75,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb index 6684b4df66c..26720dbec24 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb @@ -24,9 +24,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/bird.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/bird.rb index e10bdd158e2..cb33546283b 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/bird.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/bird.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Bird`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Bird`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/category.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/category.rb index a3849456110..c7c5d10153f 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/category.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/category.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Category`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/data_query.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/data_query.rb index 5870d99945c..72bc868d0e2 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/data_query.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/data_query.rb @@ -55,9 +55,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -90,9 +95,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DataQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DataQuery`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/default_value.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/default_value.rb index fa7e8985959..bc2bc60bdf1 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/default_value.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/default_value.rb @@ -68,9 +68,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DefaultValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DefaultValue`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/number_properties_only.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/number_properties_only.rb index b64e212add7..e0deec17c09 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/number_properties_only.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/number_properties_only.rb @@ -30,9 +30,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NumberPropertiesOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NumberPropertiesOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/pet.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/pet.rb index 3982826914c..27ec4ae311d 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/pet.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/pet.rb @@ -62,9 +62,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Pet`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,26 @@ module OpenapiClient true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] photo_urls Value to be assigned + def photo_urls=(photo_urls) + if photo_urls.nil? + fail ArgumentError, 'photo_urls cannot be nil' + end + + @photo_urls = photo_urls + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/query.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/query.rb index 192250cda1f..b469c31b089 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/query.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/query.rb @@ -50,9 +50,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -77,9 +82,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Query`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Query`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/tag.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/tag.rb index e485d7be485..2682e6c5eb0 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/tag.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/tag.rb @@ -27,9 +27,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb index a94e5146bbd..0e5cff7f4e2 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb @@ -24,9 +24,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb index d26eb908f4f..c1306d8c6d3 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb @@ -33,9 +33,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -70,9 +75,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb index 6684b4df66c..26720dbec24 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb @@ -24,9 +24,14 @@ module OpenapiClient } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module OpenapiClient end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/additional_properties_class.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/additional_properties_class.rb index 28ee88d2be4..a75805e7b7a 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/additional_properties_class.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/additional_properties_class.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/all_of_with_single_ref.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/all_of_with_single_ref.rb index 1011fdc128c..e7a57f8863e 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/all_of_with_single_ref.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/all_of_with_single_ref.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb index 86aadf4507d..20419644984 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -99,6 +105,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] class_name Value to be assigned + def class_name=(class_name) + if class_name.nil? + fail ArgumentError, 'class_name cannot be nil' + end + + @class_name = class_name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/api_response.rb index c9d978ae76a..fd960b2bd0b 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/api_response.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_array_of_number_only.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_array_of_number_only.rb index 82f9a60e018..72d3f1c6b51 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_array_of_number_only.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_array_of_number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_number_only.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_number_only.rb index dd159424d16..5b332e5d62d 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_number_only.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/array_of_number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/array_test.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/array_test.rb index 861801b1be4..32e0bc3a649 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/array_test.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/array_test.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/capitalization.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/capitalization.rb index 3774ec8c0f4..b56fa024e81 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/capitalization.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/capitalization.rb @@ -40,9 +40,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -71,9 +76,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/cat.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/cat.rb index 455163f6e31..c9124f15fa9 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/cat.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/category.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/category.rb index 8228f06f60a..45d22ef2884 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/category.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -92,6 +98,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/child_with_nullable.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/child_with_nullable.rb index f116b11d44c..08af26e98ce 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/child_with_nullable.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/child_with_nullable.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -79,9 +84,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ChildWithNullable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ChildWithNullable`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/class_model.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/class_model.rb index 58a6575b6ea..13c3d05a9b0 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/class_model.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/class_model.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/client.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/client.rb index 2fd29edbe7b..000f0b5f1f4 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/client.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/client.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/deprecated_object.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/deprecated_object.rb index 7781e78ba38..c8af0711ed2 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/deprecated_object.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/deprecated_object.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/dog.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/dog.rb index a61886c1368..d1a5a00e4f5 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/dog.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_arrays.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_arrays.rb index a6f8d983f61..244f3b1c949 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_arrays.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_arrays.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_test.rb index b6eff4f1622..ff7d26fedd8 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_test.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/enum_test.rb @@ -67,9 +67,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -101,9 +106,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/fake_big_decimal_map200_response.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/fake_big_decimal_map200_response.rb index b6034f8a167..a8083f6cf50 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/fake_big_decimal_map200_response.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/fake_big_decimal_map200_response.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/file.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/file.rb index f6ec9ceb275..29779af7893 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/file.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/file.rb @@ -26,9 +26,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/file_schema_test_class.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/file_schema_test_class.rb index 64c4432a7ff..5352e56d7af 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/file_schema_test_class.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/file_schema_test_class.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/foo.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/foo.rb index 69c9c42962d..ea5c1a05c52 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/foo.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/foo.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/foo_get_default_response.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/foo_get_default_response.rb index 93b6196c4a9..cfb58beb67a 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/foo_get_default_response.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/foo_get_default_response.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/format_test.rb index 4c4de58c1ab..c1c6baa9d42 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/format_test.rb @@ -71,9 +71,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -112,9 +117,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -410,6 +416,26 @@ module Petstore @string = string end + # Custom attribute writer method with validation + # @param [Object] byte Value to be assigned + def byte=(byte) + if byte.nil? + fail ArgumentError, 'byte cannot be nil' + end + + @byte = byte + end + + # Custom attribute writer method with validation + # @param [Object] date Value to be assigned + def date=(date) + if date.nil? + fail ArgumentError, 'date cannot be nil' + end + + @date = date + end + # Custom attribute writer method with validation # @param [Object] password Value to be assigned def password=(password) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/has_only_read_only.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/has_only_read_only.rb index e57fac28ffd..21ba2346913 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/has_only_read_only.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/has_only_read_only.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/health_check_result.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/health_check_result.rb index 4ee90daa914..b4bdd893539 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/health_check_result.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/health_check_result.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/list.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/list.rb index a1a18415a9e..0dfc210f435 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/list.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/list.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/map_test.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/map_test.rb index ef2274e24b9..4f14ff1c27b 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/map_test.rb @@ -55,9 +55,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -84,9 +89,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index 15615cd4997..472e6ff631a 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/model200_response.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/model200_response.rb index 7998909c9c5..5030eb2f7f2 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/model200_response.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/model200_response.rb @@ -28,9 +28,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/model_return.rb index b9a9d4f6d52..0f7616d87d7 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/model_return.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/name.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/name.rb index 7bb6883cfce..3c6530b930a 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/name.rb @@ -34,9 +34,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -63,9 +68,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -109,6 +115,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/nullable_class.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/nullable_class.rb index 18d8d1ae4d1..0a38efb6d71 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/nullable_class.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/nullable_class.rb @@ -57,9 +57,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/number_only.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/number_only.rb index f475ab544c0..996db0954c8 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/number_only.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/object_with_deprecated_fields.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/object_with_deprecated_fields.rb index 75cb6745e25..e9aa2a53ef7 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/object_with_deprecated_fields.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/object_with_deprecated_fields.rb @@ -33,9 +33,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/order.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/order.rb index b773b3c354f..c8ba917229d 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/order.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_composite.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_composite.rb index 6c0c15af43f..292d20578f4 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_composite.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_composite.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_object_with_enum_property.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_object_with_enum_property.rb index 4d9941d170d..7e15b47da4e 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_object_with_enum_property.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/outer_object_with_enum_property.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -106,6 +112,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] value Value to be assigned + def value=(value) + if value.nil? + fail ArgumentError, 'value cannot be nil' + end + + @value = value + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/parent_with_nullable.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/parent_with_nullable.rb index fb4c87f434f..1c17b96ed2a 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/parent_with_nullable.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/parent_with_nullable.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -82,9 +87,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ParentWithNullable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ParentWithNullable`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/pet.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/pet.rb index 019fe607be9..9ae67fe9819 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/pet.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Custom attribute writer method with validation # @param [Object] photo_urls Value to be assigned def photo_urls=(photo_urls) diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/read_only_first.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/read_only_first.rb index 3154855b276..1be85ab0b0e 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/read_only_first.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/read_only_first.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/special_model_name.rb index 38de4501c8a..371f75d4170 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/special_model_name.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/tag.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/tag.rb index e3979de47b8..10e6d5a91df 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/tag.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/test_inline_freeform_additional_properties_request.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/test_inline_freeform_additional_properties_request.rb index 74d19b6fb37..ad6b08a8d1d 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/test_inline_freeform_additional_properties_request.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/test_inline_freeform_additional_properties_request.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/user.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/user.rb index 75adf8b1fde..b0ae94df6e3 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/user.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -79,9 +84,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/additional_properties_class.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/additional_properties_class.rb index 28ee88d2be4..a75805e7b7a 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/additional_properties_class.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/additional_properties_class.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/all_of_with_single_ref.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/all_of_with_single_ref.rb index 1011fdc128c..e7a57f8863e 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/all_of_with_single_ref.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/all_of_with_single_ref.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb index 86aadf4507d..20419644984 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -99,6 +105,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] class_name Value to be assigned + def class_name=(class_name) + if class_name.nil? + fail ArgumentError, 'class_name cannot be nil' + end + + @class_name = class_name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/api_response.rb index c9d978ae76a..fd960b2bd0b 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/api_response.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_array_of_number_only.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_array_of_number_only.rb index 82f9a60e018..72d3f1c6b51 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_array_of_number_only.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_array_of_number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_number_only.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_number_only.rb index dd159424d16..5b332e5d62d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_number_only.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/array_of_number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/array_test.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/array_test.rb index 861801b1be4..32e0bc3a649 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/array_test.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/array_test.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/capitalization.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/capitalization.rb index 3774ec8c0f4..b56fa024e81 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/capitalization.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/capitalization.rb @@ -40,9 +40,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -71,9 +76,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/cat.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/cat.rb index 455163f6e31..c9124f15fa9 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/cat.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/category.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/category.rb index 8228f06f60a..45d22ef2884 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/category.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -92,6 +98,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/child_with_nullable.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/child_with_nullable.rb index f116b11d44c..08af26e98ce 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/child_with_nullable.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/child_with_nullable.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -79,9 +84,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ChildWithNullable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ChildWithNullable`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/class_model.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/class_model.rb index 58a6575b6ea..13c3d05a9b0 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/class_model.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/class_model.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/client.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/client.rb index 2fd29edbe7b..000f0b5f1f4 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/client.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/client.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/deprecated_object.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/deprecated_object.rb index 7781e78ba38..c8af0711ed2 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/deprecated_object.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/deprecated_object.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/dog.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/dog.rb index a61886c1368..d1a5a00e4f5 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/dog.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_arrays.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_arrays.rb index a6f8d983f61..244f3b1c949 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_arrays.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_arrays.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_test.rb index b6eff4f1622..ff7d26fedd8 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_test.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/enum_test.rb @@ -67,9 +67,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -101,9 +106,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/fake_big_decimal_map200_response.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/fake_big_decimal_map200_response.rb index b6034f8a167..a8083f6cf50 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/fake_big_decimal_map200_response.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/fake_big_decimal_map200_response.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/file.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/file.rb index f6ec9ceb275..29779af7893 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/file.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/file.rb @@ -26,9 +26,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/file_schema_test_class.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/file_schema_test_class.rb index 64c4432a7ff..5352e56d7af 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/file_schema_test_class.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/file_schema_test_class.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/foo.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/foo.rb index 69c9c42962d..ea5c1a05c52 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/foo.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/foo.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/foo_get_default_response.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/foo_get_default_response.rb index 93b6196c4a9..cfb58beb67a 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/foo_get_default_response.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/foo_get_default_response.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/format_test.rb index 4c4de58c1ab..c1c6baa9d42 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/format_test.rb @@ -71,9 +71,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -112,9 +117,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -410,6 +416,26 @@ module Petstore @string = string end + # Custom attribute writer method with validation + # @param [Object] byte Value to be assigned + def byte=(byte) + if byte.nil? + fail ArgumentError, 'byte cannot be nil' + end + + @byte = byte + end + + # Custom attribute writer method with validation + # @param [Object] date Value to be assigned + def date=(date) + if date.nil? + fail ArgumentError, 'date cannot be nil' + end + + @date = date + end + # Custom attribute writer method with validation # @param [Object] password Value to be assigned def password=(password) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/has_only_read_only.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/has_only_read_only.rb index e57fac28ffd..21ba2346913 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/has_only_read_only.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/has_only_read_only.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/health_check_result.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/health_check_result.rb index 4ee90daa914..b4bdd893539 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/health_check_result.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/health_check_result.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/list.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/list.rb index a1a18415a9e..0dfc210f435 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/list.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/list.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/map_test.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/map_test.rb index ef2274e24b9..4f14ff1c27b 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/map_test.rb @@ -55,9 +55,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -84,9 +89,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index 15615cd4997..472e6ff631a 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/model200_response.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/model200_response.rb index 7998909c9c5..5030eb2f7f2 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/model200_response.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/model200_response.rb @@ -28,9 +28,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/model_return.rb index b9a9d4f6d52..0f7616d87d7 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/model_return.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/name.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/name.rb index 7bb6883cfce..3c6530b930a 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/name.rb @@ -34,9 +34,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -63,9 +68,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -109,6 +115,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/nullable_class.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/nullable_class.rb index 18d8d1ae4d1..0a38efb6d71 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/nullable_class.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/nullable_class.rb @@ -57,9 +57,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/number_only.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/number_only.rb index f475ab544c0..996db0954c8 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/number_only.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/object_with_deprecated_fields.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/object_with_deprecated_fields.rb index 75cb6745e25..e9aa2a53ef7 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/object_with_deprecated_fields.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/object_with_deprecated_fields.rb @@ -33,9 +33,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/order.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/order.rb index b773b3c354f..c8ba917229d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/order.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_composite.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_composite.rb index 6c0c15af43f..292d20578f4 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_composite.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_composite.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_object_with_enum_property.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_object_with_enum_property.rb index 4d9941d170d..7e15b47da4e 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_object_with_enum_property.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_object_with_enum_property.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -106,6 +112,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] value Value to be assigned + def value=(value) + if value.nil? + fail ArgumentError, 'value cannot be nil' + end + + @value = value + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/parent_with_nullable.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/parent_with_nullable.rb index fb4c87f434f..1c17b96ed2a 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/parent_with_nullable.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/parent_with_nullable.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -82,9 +87,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ParentWithNullable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ParentWithNullable`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb index 019fe607be9..9ae67fe9819 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Custom attribute writer method with validation # @param [Object] photo_urls Value to be assigned def photo_urls=(photo_urls) diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/read_only_first.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/read_only_first.rb index 3154855b276..1be85ab0b0e 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/read_only_first.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/read_only_first.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/special_model_name.rb index 38de4501c8a..371f75d4170 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/special_model_name.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/tag.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/tag.rb index e3979de47b8..10e6d5a91df 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/tag.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/test_inline_freeform_additional_properties_request.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/test_inline_freeform_additional_properties_request.rb index 74d19b6fb37..ad6b08a8d1d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/test_inline_freeform_additional_properties_request.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/test_inline_freeform_additional_properties_request.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/user.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/user.rb index 75adf8b1fde..b0ae94df6e3 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/user.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -79,9 +84,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-faraday/spec/custom/base_object_spec.rb b/samples/client/petstore/ruby-faraday/spec/custom/base_object_spec.rb index 15e27c6e3b0..a046c5bd4e1 100644 --- a/samples/client/petstore/ruby-faraday/spec/custom/base_object_spec.rb +++ b/samples/client/petstore/ruby-faraday/spec/custom/base_object_spec.rb @@ -94,7 +94,7 @@ end describe 'BaseObject' do describe 'boolean values' do - let(:obj) { Petstore::Cat.new(declawed: false) } + let(:obj) { Petstore::Cat.new(class_name: "CAT", declawed: false) } it 'should have values set' do expect(obj.declawed).not_to be_nil diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/additional_properties_class.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/additional_properties_class.rb index 28ee88d2be4..a75805e7b7a 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/additional_properties_class.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/additional_properties_class.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/all_of_with_single_ref.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/all_of_with_single_ref.rb index 1011fdc128c..e7a57f8863e 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/all_of_with_single_ref.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/all_of_with_single_ref.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/animal.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/animal.rb index 86aadf4507d..20419644984 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/animal.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -99,6 +105,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] class_name Value to be assigned + def class_name=(class_name) + if class_name.nil? + fail ArgumentError, 'class_name cannot be nil' + end + + @class_name = class_name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/api_response.rb index c9d978ae76a..fd960b2bd0b 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/api_response.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_array_of_number_only.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_array_of_number_only.rb index 82f9a60e018..72d3f1c6b51 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_array_of_number_only.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_array_of_number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_number_only.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_number_only.rb index dd159424d16..5b332e5d62d 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_number_only.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/array_of_number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/array_test.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/array_test.rb index 861801b1be4..32e0bc3a649 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/array_test.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/array_test.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/capitalization.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/capitalization.rb index 3774ec8c0f4..b56fa024e81 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/capitalization.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/capitalization.rb @@ -40,9 +40,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -71,9 +76,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/cat.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/cat.rb index 455163f6e31..c9124f15fa9 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/cat.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/category.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/category.rb index 8228f06f60a..45d22ef2884 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/category.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -92,6 +98,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/class_model.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/class_model.rb index 58a6575b6ea..13c3d05a9b0 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/class_model.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/class_model.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/client.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/client.rb index 2fd29edbe7b..000f0b5f1f4 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/client.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/client.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/deprecated_object.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/deprecated_object.rb index 7781e78ba38..c8af0711ed2 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/deprecated_object.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/deprecated_object.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/dog.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/dog.rb index a61886c1368..d1a5a00e4f5 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/dog.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_arrays.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_arrays.rb index a6f8d983f61..244f3b1c949 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_arrays.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_arrays.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_test.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_test.rb index b6eff4f1622..ff7d26fedd8 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_test.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/enum_test.rb @@ -67,9 +67,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -101,9 +106,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/fake_big_decimal_map200_response.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/fake_big_decimal_map200_response.rb index b6034f8a167..a8083f6cf50 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/fake_big_decimal_map200_response.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/fake_big_decimal_map200_response.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/file.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/file.rb index f6ec9ceb275..29779af7893 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/file.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/file.rb @@ -26,9 +26,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/file_schema_test_class.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/file_schema_test_class.rb index 64c4432a7ff..5352e56d7af 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/file_schema_test_class.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/file_schema_test_class.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/foo.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/foo.rb index 69c9c42962d..ea5c1a05c52 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/foo.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/foo.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/foo_get_default_response.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/foo_get_default_response.rb index 93b6196c4a9..cfb58beb67a 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/foo_get_default_response.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/foo_get_default_response.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/format_test.rb index 4c4de58c1ab..c1c6baa9d42 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/format_test.rb @@ -71,9 +71,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -112,9 +117,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -410,6 +416,26 @@ module Petstore @string = string end + # Custom attribute writer method with validation + # @param [Object] byte Value to be assigned + def byte=(byte) + if byte.nil? + fail ArgumentError, 'byte cannot be nil' + end + + @byte = byte + end + + # Custom attribute writer method with validation + # @param [Object] date Value to be assigned + def date=(date) + if date.nil? + fail ArgumentError, 'date cannot be nil' + end + + @date = date + end + # Custom attribute writer method with validation # @param [Object] password Value to be assigned def password=(password) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/has_only_read_only.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/has_only_read_only.rb index e57fac28ffd..21ba2346913 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/has_only_read_only.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/has_only_read_only.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/health_check_result.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/health_check_result.rb index 4ee90daa914..b4bdd893539 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/health_check_result.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/health_check_result.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/list.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/list.rb index a1a18415a9e..0dfc210f435 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/list.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/list.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/map_test.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/map_test.rb index ef2274e24b9..4f14ff1c27b 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/map_test.rb @@ -55,9 +55,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -84,9 +89,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index 15615cd4997..472e6ff631a 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/model200_response.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/model200_response.rb index 7998909c9c5..5030eb2f7f2 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/model200_response.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/model200_response.rb @@ -28,9 +28,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/model_return.rb index b9a9d4f6d52..0f7616d87d7 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/model_return.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/name.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/name.rb index 7bb6883cfce..3c6530b930a 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/name.rb @@ -34,9 +34,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -63,9 +68,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -109,6 +115,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/nullable_class.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/nullable_class.rb index 18d8d1ae4d1..0a38efb6d71 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/nullable_class.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/nullable_class.rb @@ -57,9 +57,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/number_only.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/number_only.rb index f475ab544c0..996db0954c8 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/number_only.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/object_with_deprecated_fields.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/object_with_deprecated_fields.rb index 75cb6745e25..e9aa2a53ef7 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/object_with_deprecated_fields.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/object_with_deprecated_fields.rb @@ -33,9 +33,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/order.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/order.rb index b773b3c354f..c8ba917229d 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/order.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_composite.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_composite.rb index 6c0c15af43f..292d20578f4 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_composite.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_composite.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_object_with_enum_property.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_object_with_enum_property.rb index 4d9941d170d..7e15b47da4e 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_object_with_enum_property.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/outer_object_with_enum_property.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -106,6 +112,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] value Value to be assigned + def value=(value) + if value.nil? + fail ArgumentError, 'value cannot be nil' + end + + @value = value + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/pet.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/pet.rb index 019fe607be9..9ae67fe9819 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/pet.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Custom attribute writer method with validation # @param [Object] photo_urls Value to be assigned def photo_urls=(photo_urls) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/property_name_mapping.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/property_name_mapping.rb index 5951423908c..54e00e94d12 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/property_name_mapping.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/property_name_mapping.rb @@ -33,9 +33,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::PropertyNameMapping`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::PropertyNameMapping`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/read_only_first.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/read_only_first.rb index 3154855b276..1be85ab0b0e 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/read_only_first.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/read_only_first.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/special_model_name.rb index 38de4501c8a..371f75d4170 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/special_model_name.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/tag.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/tag.rb index e3979de47b8..10e6d5a91df 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/tag.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/test_inline_freeform_additional_properties_request.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/test_inline_freeform_additional_properties_request.rb index 74d19b6fb37..ad6b08a8d1d 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/test_inline_freeform_additional_properties_request.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/test_inline_freeform_additional_properties_request.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/user.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/user.rb index 75adf8b1fde..b0ae94df6e3 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/user.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -79,9 +84,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/whale.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/whale.rb index 109eef7b216..324dfd339d4 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/whale.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/whale.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Whale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Whale`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -100,6 +106,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] classname Value to be assigned + def classname=(classname) + if classname.nil? + fail ArgumentError, 'classname cannot be nil' + end + + @classname = classname + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-httpx/lib/petstore/models/zebra.rb b/samples/client/petstore/ruby-httpx/lib/petstore/models/zebra.rb index 26d2bfcadf1..3d24fc46fe8 100644 --- a/samples/client/petstore/ruby-httpx/lib/petstore/models/zebra.rb +++ b/samples/client/petstore/ruby-httpx/lib/petstore/models/zebra.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Zebra`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Zebra`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -126,6 +132,16 @@ module Petstore @type = type end + # Custom attribute writer method with validation + # @param [Object] classname Value to be assigned + def classname=(classname) + if classname.nil? + fail ArgumentError, 'classname cannot be nil' + end + + @classname = classname + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby-httpx/spec/custom/base_object_spec.rb b/samples/client/petstore/ruby-httpx/spec/custom/base_object_spec.rb index 15e27c6e3b0..a046c5bd4e1 100644 --- a/samples/client/petstore/ruby-httpx/spec/custom/base_object_spec.rb +++ b/samples/client/petstore/ruby-httpx/spec/custom/base_object_spec.rb @@ -94,7 +94,7 @@ end describe 'BaseObject' do describe 'boolean values' do - let(:obj) { Petstore::Cat.new(declawed: false) } + let(:obj) { Petstore::Cat.new(class_name: "CAT", declawed: false) } it 'should have values set' do expect(obj.declawed).not_to be_nil 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 28ee88d2be4..a75805e7b7a 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 @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/all_of_with_single_ref.rb b/samples/client/petstore/ruby/lib/petstore/models/all_of_with_single_ref.rb index 1011fdc128c..e7a57f8863e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/all_of_with_single_ref.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/all_of_with_single_ref.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index 86aadf4507d..20419644984 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -99,6 +105,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] class_name Value to be assigned + def class_name=(class_name) + if class_name.nil? + fail ArgumentError, 'class_name cannot be nil' + end + + @class_name = class_name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) 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 c9d978ae76a..fd960b2bd0b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 82f9a60e018..72d3f1c6b51 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 @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 dd159424d16..5b332e5d62d 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 @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 861801b1be4..32e0bc3a649 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_test.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb b/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb index 3774ec8c0f4..b56fa024e81 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/capitalization.rb @@ -40,9 +40,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -71,9 +76,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb index 455163f6e31..c9124f15fa9 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index 8228f06f60a..45d22ef2884 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -92,6 +98,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) 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 58a6575b6ea..13c3d05a9b0 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/class_model.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/class_model.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/client.rb b/samples/client/petstore/ruby/lib/petstore/models/client.rb index 2fd29edbe7b..000f0b5f1f4 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/client.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/client.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/deprecated_object.rb b/samples/client/petstore/ruby/lib/petstore/models/deprecated_object.rb index 7781e78ba38..c8af0711ed2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/deprecated_object.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/deprecated_object.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DeprecatedObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb index a61886c1368..d1a5a00e4f5 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 a6f8d983f61..244f3b1c949 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_arrays.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 b6eff4f1622..ff7d26fedd8 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/enum_test.rb @@ -67,9 +67,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -101,9 +106,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/fake_big_decimal_map200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/fake_big_decimal_map200_response.rb index b6034f8a167..a8083f6cf50 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/fake_big_decimal_map200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/fake_big_decimal_map200_response.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/file.rb b/samples/client/petstore/ruby/lib/petstore/models/file.rb index f6ec9ceb275..29779af7893 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/file.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/file.rb @@ -26,9 +26,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 64c4432a7ff..5352e56d7af 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 @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/foo.rb b/samples/client/petstore/ruby/lib/petstore/models/foo.rb index 69c9c42962d..ea5c1a05c52 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/foo.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/foo.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Foo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/foo_get_default_response.rb b/samples/client/petstore/ruby/lib/petstore/models/foo_get_default_response.rb index 93b6196c4a9..cfb58beb67a 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/foo_get_default_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/foo_get_default_response.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FooGetDefaultResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 4c4de58c1ab..c1c6baa9d42 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -71,9 +71,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -112,9 +117,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -410,6 +416,26 @@ module Petstore @string = string end + # Custom attribute writer method with validation + # @param [Object] byte Value to be assigned + def byte=(byte) + if byte.nil? + fail ArgumentError, 'byte cannot be nil' + end + + @byte = byte + end + + # Custom attribute writer method with validation + # @param [Object] date Value to be assigned + def date=(date) + if date.nil? + fail ArgumentError, 'date cannot be nil' + end + + @date = date + end + # Custom attribute writer method with validation # @param [Object] password Value to be assigned def password=(password) 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 e57fac28ffd..21ba2346913 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 @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/health_check_result.rb b/samples/client/petstore/ruby/lib/petstore/models/health_check_result.rb index 4ee90daa914..b4bdd893539 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/health_check_result.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/health_check_result.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HealthCheckResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/list.rb b/samples/client/petstore/ruby/lib/petstore/models/list.rb index a1a18415a9e..0dfc210f435 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/list.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/list.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 ef2274e24b9..4f14ff1c27b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb @@ -55,9 +55,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -84,9 +89,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 15615cd4997..472e6ff631a 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 @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 7998909c9c5..5030eb2f7f2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model200_response.rb @@ -28,9 +28,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 b9a9d4f6d52..0f7616d87d7 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -25,9 +25,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/name.rb b/samples/client/petstore/ruby/lib/petstore/models/name.rb index 7bb6883cfce..3c6530b930a 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/name.rb @@ -34,9 +34,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -63,9 +68,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -109,6 +115,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby/lib/petstore/models/nullable_class.rb b/samples/client/petstore/ruby/lib/petstore/models/nullable_class.rb index 18d8d1ae4d1..0a38efb6d71 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/nullable_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/nullable_class.rb @@ -57,9 +57,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NullableClass`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 f475ab544c0..996db0954c8 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/number_only.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/number_only.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/object_with_deprecated_fields.rb b/samples/client/petstore/ruby/lib/petstore/models/object_with_deprecated_fields.rb index 75cb6745e25..e9aa2a53ef7 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/object_with_deprecated_fields.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/object_with_deprecated_fields.rb @@ -33,9 +33,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ObjectWithDeprecatedFields`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/order.rb b/samples/client/petstore/ruby/lib/petstore/models/order.rb index b773b3c354f..c8ba917229d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/order.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 6c0c15af43f..292d20578f4 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_object_with_enum_property.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_object_with_enum_property.rb index 4d9941d170d..7e15b47da4e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/outer_object_with_enum_property.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_object_with_enum_property.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -106,6 +112,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] value Value to be assigned + def value=(value) + if value.nil? + fail ArgumentError, 'value cannot be nil' + end + + @value = value + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index 019fe607be9..9ae67fe9819 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -62,9 +62,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Custom attribute writer method with validation # @param [Object] photo_urls Value to be assigned def photo_urls=(photo_urls) diff --git a/samples/client/petstore/ruby/lib/petstore/models/property_name_mapping.rb b/samples/client/petstore/ruby/lib/petstore/models/property_name_mapping.rb index 48e54c5d4d0..bebbde75588 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/property_name_mapping.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/property_name_mapping.rb @@ -33,9 +33,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::PropertyNameMapping`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::PropertyNameMapping`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 3154855b276..1be85ab0b0e 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 @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } 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 38de4501c8a..371f75d4170 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 @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/client/petstore/ruby/lib/petstore/models/tag.rb index e3979de47b8..10e6d5a91df 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/tag.rb @@ -27,9 +27,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/test_inline_freeform_additional_properties_request.rb b/samples/client/petstore/ruby/lib/petstore/models/test_inline_freeform_additional_properties_request.rb index 74d19b6fb37..ad6b08a8d1d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/test_inline_freeform_additional_properties_request.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/test_inline_freeform_additional_properties_request.rb @@ -24,9 +24,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TestInlineFreeformAdditionalPropertiesRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/user.rb b/samples/client/petstore/ruby/lib/petstore/models/user.rb index 75adf8b1fde..b0ae94df6e3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/user.rb @@ -46,9 +46,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -79,9 +84,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/client/petstore/ruby/lib/petstore/models/whale.rb b/samples/client/petstore/ruby/lib/petstore/models/whale.rb index 109eef7b216..324dfd339d4 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/whale.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/whale.rb @@ -30,9 +30,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Whale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Whale`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -100,6 +106,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] classname Value to be assigned + def classname=(classname) + if classname.nil? + fail ArgumentError, 'classname cannot be nil' + end + + @classname = classname + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby/lib/petstore/models/zebra.rb b/samples/client/petstore/ruby/lib/petstore/models/zebra.rb index 26d2bfcadf1..3d24fc46fe8 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/zebra.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/zebra.rb @@ -49,9 +49,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Zebra`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Zebra`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -126,6 +132,16 @@ module Petstore @type = type end + # Custom attribute writer method with validation + # @param [Object] classname Value to be assigned + def classname=(classname) + if classname.nil? + fail ArgumentError, 'classname cannot be nil' + end + + @classname = classname + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/samples/client/petstore/ruby/spec/custom/base_object_spec.rb b/samples/client/petstore/ruby/spec/custom/base_object_spec.rb index 15e27c6e3b0..a046c5bd4e1 100644 --- a/samples/client/petstore/ruby/spec/custom/base_object_spec.rb +++ b/samples/client/petstore/ruby/spec/custom/base_object_spec.rb @@ -94,7 +94,7 @@ end describe 'BaseObject' do describe 'boolean values' do - let(:obj) { Petstore::Cat.new(declawed: false) } + let(:obj) { Petstore::Cat.new(class_name: "CAT", declawed: false) } it 'should have values set' do expect(obj.declawed).not_to be_nil diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb index 978b8f41427..67a6c20b93d 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb @@ -21,9 +21,14 @@ module Petstore } end + # Returns attribute mapping this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + superclass.acceptable_attribute_map.merge(attribute_map) + end + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) def self.acceptable_attributes - attribute_map.values.concat(superclass.acceptable_attributes) + acceptable_attribute_map.values end # Attribute type mapping. @@ -46,9 +51,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayAlias`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayAlias`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb index 73af71d4faa..e553b136c86 100644 --- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb +++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb @@ -21,9 +21,14 @@ module Petstore } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -46,9 +51,10 @@ module Petstore end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapAlias`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapAlias`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v }