fix required prop check for ruby client

This commit is contained in:
wing328 2016-10-13 16:38:39 +08:00
parent 34f1e36146
commit 47c387470c
7 changed files with 34 additions and 7 deletions

View File

@ -78,13 +78,13 @@
def list_invalid_properties
invalid_properties = Array.new
{{#vars}}
{{#hasValidation}}
{{#required}}
if @{{{name}}}.nil?
invalid_properties.push("invalid value for '{{{name}}}', {{{name}}} cannot be nil.")
end
{{/required}}
{{/required}}
{{#hasValidation}}
{{#maxLength}}
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
invalid_properties.push("invalid value for '{{{name}}}', the character length must be smaller than or equal to {{{maxLength}}}.")

View File

@ -71,6 +71,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @class_name.nil?
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
end
return invalid_properties
end

View File

@ -79,6 +79,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @class_name.nil?
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
end
return invalid_properties
end

View File

@ -79,6 +79,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @class_name.nil?
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
end
return invalid_properties
end

View File

@ -157,7 +157,6 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if !@integer.nil? && @integer > 100.0
invalid_properties.push("invalid value for 'integer', must be smaller than or equal to 100.0.")
end
@ -166,7 +165,6 @@ module Petstore
invalid_properties.push("invalid value for 'integer', must be greater than or equal to 10.0.")
end
if !@int32.nil? && @int32 > 200.0
invalid_properties.push("invalid value for 'int32', must be smaller than or equal to 200.0.")
end
@ -187,7 +185,6 @@ module Petstore
invalid_properties.push("invalid value for 'number', must be greater than or equal to 32.1.")
end
if !@float.nil? && @float > 987.6
invalid_properties.push("invalid value for 'float', must be smaller than or equal to 987.6.")
end
@ -196,7 +193,6 @@ module Petstore
invalid_properties.push("invalid value for 'float', must be greater than or equal to 54.3.")
end
if !@double.nil? && @double > 123.4
invalid_properties.push("invalid value for 'double', must be smaller than or equal to 123.4.")
end
@ -205,11 +201,18 @@ module Petstore
invalid_properties.push("invalid value for 'double', must be greater than or equal to 67.8.")
end
if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
invalid_properties.push("invalid value for 'string', must conform to the pattern /[a-z]/i.")
end
if @byte.nil?
invalid_properties.push("invalid value for 'byte', byte cannot be nil.")
end
if @date.nil?
invalid_properties.push("invalid value for 'date', date cannot be nil.")
end
if @password.nil?
invalid_properties.push("invalid value for 'password', password cannot be nil.")
end

View File

@ -85,6 +85,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @name.nil?
invalid_properties.push("invalid value for 'name', name cannot be nil.")
end
return invalid_properties
end

View File

@ -127,6 +127,14 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @name.nil?
invalid_properties.push("invalid value for 'name', name cannot be nil.")
end
if @photo_urls.nil?
invalid_properties.push("invalid value for 'photo_urls', photo_urls cannot be nil.")
end
return invalid_properties
end