From 3476e83a36481d25f0563c51fe8d13e5e4c3979c Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 24 Jan 2017 20:11:49 -0800 Subject: [PATCH] fix for allowable values, #4645 (#4646) * fix for allowable values, #4645 * fixed string values * rebuilt for #4645 --- .../src/main/resources/php/model_generic.mustache | 2 +- .../petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php | 2 +- .../petstore/php/SwaggerClient-php/lib/Model/EnumTest.php | 6 +++--- .../petstore/php/SwaggerClient-php/lib/Model/Order.php | 2 +- .../client/petstore/php/SwaggerClient-php/lib/Model/Pet.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache index f7ab60ad616..114d3372516 100644 --- a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache @@ -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}} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php index 271d1ed66a9..44bb6e85996 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumArrays.php @@ -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; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index b940c29265c..da3b08d5e6f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -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; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index c997ee00a2b..56f63be8a27 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -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; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index 4f19109a288..5589879cbce 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -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;