forked from loafle/openapi-generator-original
Fix syntax error (#8675)
Added missing closing brace in list_invalid_properties model method.
This commit is contained in:
@@ -197,13 +197,13 @@
|
||||
{{/pattern}}
|
||||
{{#maxItems}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}}
|
||||
invalid_properties.push('invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.'
|
||||
invalid_properties.push('invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.')
|
||||
end
|
||||
|
||||
{{/maxItems}}
|
||||
{{#minItems}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}}
|
||||
invalid_properties.push('invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.'
|
||||
invalid_properties.push('invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.')
|
||||
end
|
||||
|
||||
{{/minItems}}
|
||||
|
||||
@@ -1627,6 +1627,8 @@ components:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
minItems: 0
|
||||
maxItems: 3
|
||||
array_array_of_integer:
|
||||
type: array
|
||||
items:
|
||||
|
||||
@@ -152,6 +152,8 @@ namespace Org.OpenAPITools.Model
|
||||
/// <returns>Validation Result</returns>
|
||||
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
|
||||
{
|
||||
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +206,14 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
{
|
||||
$invalidProperties = [];
|
||||
|
||||
if (!is_null($this->container['array_of_string']) && (count($this->container['array_of_string']) > 3)) {
|
||||
$invalidProperties[] = "invalid value for 'array_of_string', number of items must be less than or equal to 3.";
|
||||
}
|
||||
|
||||
if (!is_null($this->container['array_of_string']) && (count($this->container['array_of_string']) < 0)) {
|
||||
$invalidProperties[] = "invalid value for 'array_of_string', number of items must be greater than or equal to 0.";
|
||||
}
|
||||
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
@@ -240,6 +248,13 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
*/
|
||||
public function setArrayOfString($array_of_string)
|
||||
{
|
||||
|
||||
if (!is_null($array_of_string) && (count($array_of_string) > 3)) {
|
||||
throw new \InvalidArgumentException('invalid value for $array_of_string when calling ArrayTest., number of items must be less than or equal to 3.');
|
||||
}
|
||||
if (!is_null($array_of_string) && (count($array_of_string) < 0)) {
|
||||
throw new \InvalidArgumentException('invalid length for $array_of_string when calling ArrayTest., number of items must be greater than or equal to 0.');
|
||||
}
|
||||
$this->container['array_of_string'] = $array_of_string;
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -88,15 +88,39 @@ module Petstore
|
||||
# @return Array for valid properties with the reasons
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if !@array_of_string.nil? && @array_of_string.length > 3
|
||||
invalid_properties.push('invalid value for "array_of_string", number of items must be less than or equal to 3.')
|
||||
end
|
||||
|
||||
if !@array_of_string.nil? && @array_of_string.length < 0
|
||||
invalid_properties.push('invalid value for "array_of_string", number of items must be greater than or equal to 0.')
|
||||
end
|
||||
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
# 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 !@array_of_string.nil? && @array_of_string.length > 3
|
||||
return false if !@array_of_string.nil? && @array_of_string.length < 0
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] array_of_string Value to be assigned
|
||||
def array_of_string=(array_of_string)
|
||||
if !array_of_string.nil? && array_of_string.length > 3
|
||||
fail ArgumentError, 'invalid value for "array_of_string", number of items must be less than or equal to 3.'
|
||||
end
|
||||
|
||||
if !array_of_string.nil? && array_of_string.length < 0
|
||||
fail ArgumentError, 'invalid value for "array_of_string", number of items must be greater than or equal to 0.'
|
||||
end
|
||||
|
||||
@array_of_string = array_of_string
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
# @param [Object] Object to be compared
|
||||
def ==(o)
|
||||
|
||||
@@ -88,15 +88,39 @@ module Petstore
|
||||
# @return Array for valid properties with the reasons
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if !@array_of_string.nil? && @array_of_string.length > 3
|
||||
invalid_properties.push('invalid value for "array_of_string", number of items must be less than or equal to 3.')
|
||||
end
|
||||
|
||||
if !@array_of_string.nil? && @array_of_string.length < 0
|
||||
invalid_properties.push('invalid value for "array_of_string", number of items must be greater than or equal to 0.')
|
||||
end
|
||||
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
# 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 !@array_of_string.nil? && @array_of_string.length > 3
|
||||
return false if !@array_of_string.nil? && @array_of_string.length < 0
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] array_of_string Value to be assigned
|
||||
def array_of_string=(array_of_string)
|
||||
if !array_of_string.nil? && array_of_string.length > 3
|
||||
fail ArgumentError, 'invalid value for "array_of_string", number of items must be less than or equal to 3.'
|
||||
end
|
||||
|
||||
if !array_of_string.nil? && array_of_string.length < 0
|
||||
fail ArgumentError, 'invalid value for "array_of_string", number of items must be greater than or equal to 0.'
|
||||
end
|
||||
|
||||
@array_of_string = array_of_string
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
# @param [Object] Object to be compared
|
||||
def ==(o)
|
||||
|
||||
@@ -80,6 +80,12 @@ class ArrayTest(object):
|
||||
:param array_of_string: The array_of_string of this ArrayTest. # noqa: E501
|
||||
:type array_of_string: list[str]
|
||||
"""
|
||||
if (self.local_vars_configuration.client_side_validation and
|
||||
array_of_string is not None and len(array_of_string) > 3):
|
||||
raise ValueError("Invalid value for `array_of_string`, number of items must be less than or equal to `3`") # noqa: E501
|
||||
if (self.local_vars_configuration.client_side_validation and
|
||||
array_of_string is not None and len(array_of_string) < 0):
|
||||
raise ValueError("Invalid value for `array_of_string`, number of items must be greater than or equal to `0`") # noqa: E501
|
||||
|
||||
self._array_of_string = array_of_string
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ArrayTest {
|
||||
**/
|
||||
@JsonProperty("array_of_string")
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Size(min=0,max=3)
|
||||
public List<String> getArrayOfString() {
|
||||
return arrayOfString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user