fix for allowable values, #4645 (#4646)

* fix for allowable values, #4645

* fixed string values

* rebuilt for #4645
This commit is contained in:
Tony Tam 2017-01-24 20:11:49 -08:00 committed by wing328
parent 6e846e7463
commit 3476e83a36
5 changed files with 7 additions and 7 deletions

View File

@ -128,7 +128,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{^isContainer}}
$allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}];
if (!in_array($this->container['{{name}}'], $allowed_values)) {
$invalid_properties[] = "invalid value for '{{name}}', must be one of #{allowed_values}.";
$invalid_properties[] = "invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}.";
}
{{/isContainer}}

View File

@ -165,7 +165,7 @@ class EnumArrays implements ArrayAccess
$invalid_properties = [];
$allowed_values = [">=", "$"];
if (!in_array($this->container['just_symbol'], $allowed_values)) {
$invalid_properties[] = "invalid value for 'just_symbol', must be one of #{allowed_values}.";
$invalid_properties[] = "invalid value for 'just_symbol', must be one of '>=', '$'.";
}
return $invalid_properties;

View File

@ -191,17 +191,17 @@ class EnumTest implements ArrayAccess
$invalid_properties = [];
$allowed_values = ["UPPER", "lower", ""];
if (!in_array($this->container['enum_string'], $allowed_values)) {
$invalid_properties[] = "invalid value for 'enum_string', must be one of #{allowed_values}.";
$invalid_properties[] = "invalid value for 'enum_string', must be one of 'UPPER', 'lower', ''.";
}
$allowed_values = ["1", "-1"];
if (!in_array($this->container['enum_integer'], $allowed_values)) {
$invalid_properties[] = "invalid value for 'enum_integer', must be one of #{allowed_values}.";
$invalid_properties[] = "invalid value for 'enum_integer', must be one of '1', '-1'.";
}
$allowed_values = ["1.1", "-1.2"];
if (!in_array($this->container['enum_number'], $allowed_values)) {
$invalid_properties[] = "invalid value for 'enum_number', must be one of #{allowed_values}.";
$invalid_properties[] = "invalid value for 'enum_number', must be one of '1.1', '-1.2'.";
}
return $invalid_properties;

View File

@ -173,7 +173,7 @@ class Order implements ArrayAccess
$invalid_properties = [];
$allowed_values = ["placed", "approved", "delivered"];
if (!in_array($this->container['status'], $allowed_values)) {
$invalid_properties[] = "invalid value for 'status', must be one of #{allowed_values}.";
$invalid_properties[] = "invalid value for 'status', must be one of 'placed', 'approved', 'delivered'.";
}
return $invalid_properties;

View File

@ -179,7 +179,7 @@ class Pet implements ArrayAccess
}
$allowed_values = ["available", "pending", "sold"];
if (!in_array($this->container['status'], $allowed_values)) {
$invalid_properties[] = "invalid value for 'status', must be one of #{allowed_values}.";
$invalid_properties[] = "invalid value for 'status', must be one of 'available', 'pending', 'sold'.";
}
return $invalid_properties;