Fix syntax error (#8675)

Added missing closing brace in list_invalid_properties model method.
This commit is contained in:
miyucy
2021-02-12 00:43:19 +09:00
committed by GitHub
parent 23de86a434
commit 3c4b1a0c4c
8 changed files with 76 additions and 3 deletions

View File

@@ -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}}

View File

@@ -1627,6 +1627,8 @@ components:
type: array
items:
type: string
minItems: 0
maxItems: 3
array_array_of_integer:
type: array
items:

View File

@@ -152,6 +152,8 @@ namespace Org.OpenAPITools.Model
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -66,7 +66,7 @@ public class ArrayTest {
**/
@JsonProperty("array_of_string")
@ApiModelProperty(value = "")
@Size(min=0,max=3)
public List<String> getArrayOfString() {
return arrayOfString;
}