From 217d1bc57c1dc81b938a8269461adce280b202c4 Mon Sep 17 00:00:00 2001 From: Fabian Oudhaarlem Date: Thu, 16 Dec 2021 17:14:40 +0100 Subject: [PATCH 1/2] Change value validation to length > 0 Currently the generator validates a custom value for custom attributes with length < -1 which is never. Thus resulting in an error on all values with data. --- .../models/channel_product_extra_data_item_response.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb b/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb index 5227c9c..4d52163 100644 --- a/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb +++ b/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb @@ -136,8 +136,8 @@ def key=(key) # Custom attribute writer method with validation # @param [Object] value Value to be assigned def value=(value) - if !value.nil? && value.to_s.length > -1 - fail ArgumentError, 'invalid value for "value", the character length must be smaller than or equal to -1.' + if !value.nil? && value.to_s.length < 1 + fail ArgumentError, 'invalid value for "value", the character length must be bigger than or equal to 1.' end @value = value From 0a1d15a4db7fb82bc4a07b13a2ad074456caf912 Mon Sep 17 00:00:00 2001 From: Fabian Oudhaarlem Date: Thu, 16 Dec 2021 17:25:34 +0100 Subject: [PATCH 2/2] Value bigger than -1 validation. What a validation.. --- .../models/channel_product_extra_data_item_response.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb b/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb index 4d52163..72704ba 100644 --- a/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb +++ b/lib/channelengine_channel_api_client_ruby/models/channel_product_extra_data_item_response.rb @@ -136,8 +136,8 @@ def key=(key) # Custom attribute writer method with validation # @param [Object] value Value to be assigned def value=(value) - if !value.nil? && value.to_s.length < 1 - fail ArgumentError, 'invalid value for "value", the character length must be bigger than or equal to 1.' + if !value.nil? && value.to_s.length < -1 + fail ArgumentError, 'invalid value for "value", the character length must be bigger than -1.' end @value = value