Fix maximum, minimum for Integer (#4335)

* fix int/long max, min value (removing decimal)

* fix integer min/max in parameter
This commit is contained in:
wing328
2016-12-07 19:29:36 +08:00
committed by GitHub
parent f781f1df5b
commit 162352cb4b
7 changed files with 70 additions and 44 deletions

View File

@@ -145,20 +145,20 @@ module Petstore
# verify the required parameter 'byte' is set
fail ArgumentError, "Missing the required parameter 'byte' when calling FakeApi.test_endpoint_parameters" if byte.nil?
if !opts[:'integer'].nil? && opts[:'integer'] > 100.0
fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.0.'
if !opts[:'integer'].nil? && opts[:'integer'] > 100
fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.'
end
if !opts[:'integer'].nil? && opts[:'integer'] < 10.0
fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.0.'
if !opts[:'integer'].nil? && opts[:'integer'] < 10
fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.'
end
if !opts[:'int32'].nil? && opts[:'int32'] > 200.0
fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.0.'
if !opts[:'int32'].nil? && opts[:'int32'] > 200
fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.'
end
if !opts[:'int32'].nil? && opts[:'int32'] < 20.0
fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.0.'
if !opts[:'int32'].nil? && opts[:'int32'] < 20
fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.'
end
if !opts[:'float'].nil? && opts[:'float'] > 987.6

View File

@@ -141,12 +141,12 @@ module Petstore
end
# verify the required parameter 'order_id' is set
fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.get_order_by_id" if order_id.nil?
if order_id > 5.0
fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.0.'
if order_id > 5
fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.'
end
if order_id < 1.0
fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.0.'
if order_id < 1
fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.'
end
# resource path

View File

@@ -145,20 +145,20 @@ 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.")
if !@integer.nil? && @integer > 100
invalid_properties.push("invalid value for 'integer', must be smaller than or equal to 100.")
end
if !@integer.nil? && @integer < 10.0
invalid_properties.push("invalid value for 'integer', must be greater than or equal to 10.0.")
if !@integer.nil? && @integer < 10
invalid_properties.push("invalid value for 'integer', must be greater than or equal to 10.")
end
if !@int32.nil? && @int32 > 200.0
invalid_properties.push("invalid value for 'int32', must be smaller than or equal to 200.0.")
if !@int32.nil? && @int32 > 200
invalid_properties.push("invalid value for 'int32', must be smaller than or equal to 200.")
end
if !@int32.nil? && @int32 < 20.0
invalid_properties.push("invalid value for 'int32', must be greater than or equal to 20.0.")
if !@int32.nil? && @int32 < 20
invalid_properties.push("invalid value for 'int32', must be greater than or equal to 20.")
end
if @number.nil?
@@ -219,10 +219,10 @@ module Petstore
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if !@integer.nil? && @integer > 100.0
return false if !@integer.nil? && @integer < 10.0
return false if !@int32.nil? && @int32 > 200.0
return false if !@int32.nil? && @int32 < 20.0
return false if !@integer.nil? && @integer > 100
return false if !@integer.nil? && @integer < 10
return false if !@int32.nil? && @int32 > 200
return false if !@int32.nil? && @int32 < 20
return false if @number.nil?
return false if @number > 543.2
return false if @number < 32.1
@@ -243,12 +243,12 @@ module Petstore
# @param [Object] integer Value to be assigned
def integer=(integer)
if !integer.nil? && integer > 100.0
fail ArgumentError, "invalid value for 'integer', must be smaller than or equal to 100.0."
if !integer.nil? && integer > 100
fail ArgumentError, "invalid value for 'integer', must be smaller than or equal to 100."
end
if !integer.nil? && integer < 10.0
fail ArgumentError, "invalid value for 'integer', must be greater than or equal to 10.0."
if !integer.nil? && integer < 10
fail ArgumentError, "invalid value for 'integer', must be greater than or equal to 10."
end
@integer = integer
@@ -258,12 +258,12 @@ module Petstore
# @param [Object] int32 Value to be assigned
def int32=(int32)
if !int32.nil? && int32 > 200.0
fail ArgumentError, "invalid value for 'int32', must be smaller than or equal to 200.0."
if !int32.nil? && int32 > 200
fail ArgumentError, "invalid value for 'int32', must be smaller than or equal to 200."
end
if !int32.nil? && int32 < 20.0
fail ArgumentError, "invalid value for 'int32', must be greater than or equal to 20.0."
if !int32.nil? && int32 < 20
fail ArgumentError, "invalid value for 'int32', must be greater than or equal to 20."
end
@int32 = int32