Merge branch 'php_parameter_validation' of https://github.com/abcsun/swagger-codegen into abcsun-php_parameter_validation

Conflicts:
	samples/client/petstore/php/SwaggerClient-php/README.md
	samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php
	samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php
This commit is contained in:
wing328 2016-05-09 16:21:40 +08:00
commit cf6e8cffbb
18 changed files with 971 additions and 103 deletions

View File

@ -131,7 +131,7 @@ use \{{invokerPackage}}\ObjectSerializer;
} }
{{/maxLength}} {{/maxLength}}
{{#minLength}} {{#minLength}}
if (strlen(${{paramName}}) > {{minLength}}) { if (strlen(${{paramName}}) < {{minLength}}) {
throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
} }
{{/minLength}} {{/minLength}}

View File

@ -147,10 +147,115 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{/discriminator}} {{/discriminator}}
if ($data != null) { if ($data != null) {
{{#vars}}$this->container['{{name}}'] = $data['{{name}}'];{{#hasMore}} {{#vars}}
{{/hasMore}}{{/vars}} if (isset($data["{{name}}"])) {
$this->container['{{name}}'] = $data["{{name}}"];
}{{#hasMore}}{{/hasMore}}
{{/vars}}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
{{#vars}}
{{#required}}
if ($this->container['{{name}}'] === null) {
$invalid_properties[] = "'${{name}}' can't be null";
}
{{/required}}
{{#isEnum}}
$allowed_values = array({{#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}.";
}
{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if (strlen($this->container['{{name}}']) > {{maxLength}}) {
$invalid_properties[] = "invalid value for '${{name}}', the character length must be smaller than or equal to {{{maxLength}}}.";
}
{{/maxLength}}
{{#minLength}}
if (strlen($this->container['{{name}}']) < {{minLength}}) {
$invalid_properties[] = "invalid value for '${{name}}', the character length must be bigger than or equal to {{{minLength}}}.";
}
{{/minLength}}
{{#maximum}}
if ($this->container['{{name}}'] > {{maximum}}) {
$invalid_properties[] = "invalid value for '${{name}}', must be smaller than or equal to {{maximum}}.";
}
{{/maximum}}
{{#minimum}}
if ($this->container['{{name}}'] < {{minimum}}) {
$invalid_properties[] = "invalid value for '${{name}}', must be bigger than or equal to {{minimum}}.";
}
{{/minimum}}
{{#pattern}}
if (!preg_match("{{pattern}}", $this->container['{{name}}'])) {
$invalid_properties[] = "invalid value for '${{name}}', must be conform to the pattern {{pattern}}.";
}
{{/pattern}}
{{/hasValidation}}
{{/vars}}
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
{{#vars}}
{{#required}}
if ($this->container['{{name}}'] === null) {
return false;
}{{/required}}
{{#isEnum}}
$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
if (!in_array($this->container['{{name}}'], $allowed_values))) {
return false;
}{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if (strlen($this->container['{{name}}']) > {{maxLength}}) {
return false;
}
{{/maxLength}}
{{#minLength}}
if (strlen($this->container['{{name}}']) < {{minLength}}) {
return false;
}
{{/minLength}}
{{#maximum}}
if ($this->container['{{name}}'] > {{maximum}}) {
return false;
}
{{/maximum}}
{{#minimum}}
if ($this->container['{{name}}'] < {{minimum}}) {
return false;
}
{{/minimum}}
{{#pattern}}
if (!preg_match("{{pattern}}", $this->container['{{name}}'])) {
return false;
}
{{/pattern}}
{{/hasValidation}}
{{/vars}}
return true;
}
{{#vars}} {{#vars}}
/** /**
* Gets {{name}} * Gets {{name}}
@ -168,11 +273,40 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
*/ */
public function {{setter}}(${{name}}) public function {{setter}}(${{name}})
{ {
{{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); {{#isEnum}}
$allowed_values = array({{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
if (!in_array(${{{name}}}, $allowed_values)) { if (!in_array(${{{name}}}, $allowed_values)) {
throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"); throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}");
}{{/isEnum}} }
{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if (strlen(${{name}}) > {{maxLength}}) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
}{{/maxLength}}
{{#minLength}}
if (strlen(${{name}}) < {{minLength}}) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
}
{{/minLength}}
{{#maximum}}
if (${{name}} > {{maximum}}) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.');
}
{{/maximum}}
{{#minimum}}
if (${{name}} < {{minimum}}) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.');
}
{{/minimum}}
{{#pattern}}
if (!preg_match("{{pattern}}", ${{name}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{pattern}}.');
}
{{/pattern}}
{{/hasValidation}}
$this->container['{{name}}'] = ${{name}}; $this->container['{{name}}'] = ${{name}};
return $this; return $this;
} }
{{/vars}} {{/vars}}

View File

@ -206,7 +206,7 @@ class FakeApi
if (strlen($password) > 64) { if (strlen($password) > 64) {
throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.'); throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.');
} }
if (strlen($password) > 10) { if (strlen($password) < 10) {
throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.');
} }

View File

@ -128,9 +128,42 @@ class Animal implements ArrayAccess
$this->container[$discrimintor] = static::$swaggerModelName; $this->container[$discrimintor] = static::$swaggerModelName;
if ($data != null) { if ($data != null) {
$this->container['class_name'] = $data['class_name']; if (isset($data["class_name"])) {
$this->container['class_name'] = $data["class_name"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
if ($this->container['class_name'] === null) {
$invalid_properties[] = "'$class_name' can't be null";
}
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
if ($this->container['class_name'] === null) {
return false;
}
return true;
}
/** /**
* Gets class_name * Gets class_name
* @return string * @return string
@ -147,8 +180,8 @@ class Animal implements ArrayAccess
*/ */
public function setClassName($class_name) public function setClassName($class_name)
{ {
$this->container['class_name'] = $class_name; $this->container['class_name'] = $class_name;
return $this; return $this;
} }
/** /**

View File

@ -119,9 +119,32 @@ class AnimalFarm implements ArrayAccess
if ($data != null) { if ($data != null) {
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Returns true if offset exists. False otherwise. * Returns true if offset exists. False otherwise.
* @param integer $offset Offset * @param integer $offset Offset

View File

@ -145,11 +145,47 @@ class ApiResponse implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['code'] = $data['code']; if (isset($data["code"])) {
$this->container['type'] = $data['type']; $this->container['code'] = $data["code"];
$this->container['message'] = $data['message']; }
if (isset($data["type"])) {
$this->container['type'] = $data["type"];
}
if (isset($data["message"])) {
$this->container['message'] = $data["message"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets code * Gets code
* @return int * @return int
@ -166,8 +202,8 @@ class ApiResponse implements ArrayAccess
*/ */
public function setCode($code) public function setCode($code)
{ {
$this->container['code'] = $code; $this->container['code'] = $code;
return $this; return $this;
} }
/** /**
@ -186,8 +222,8 @@ class ApiResponse implements ArrayAccess
*/ */
public function setType($type) public function setType($type)
{ {
$this->container['type'] = $type; $this->container['type'] = $type;
return $this; return $this;
} }
/** /**
@ -206,8 +242,8 @@ class ApiResponse implements ArrayAccess
*/ */
public function setMessage($message) public function setMessage($message)
{ {
$this->container['message'] = $message; $this->container['message'] = $message;
return $this; return $this;
} }
/** /**

View File

@ -125,9 +125,37 @@ class Cat extends Animal implements ArrayAccess
parent::__construct($data); parent::__construct($data);
if ($data != null) { if ($data != null) {
$this->container['declawed'] = $data['declawed']; if (isset($data["declawed"])) {
$this->container['declawed'] = $data["declawed"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets declawed * Gets declawed
* @return bool * @return bool
@ -144,8 +172,8 @@ class Cat extends Animal implements ArrayAccess
*/ */
public function setDeclawed($declawed) public function setDeclawed($declawed)
{ {
$this->container['declawed'] = $declawed; $this->container['declawed'] = $declawed;
return $this; return $this;
} }
/** /**

View File

@ -135,10 +135,42 @@ class Category implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['id'] = $data['id']; if (isset($data["id"])) {
$this->container['name'] = $data['name']; $this->container['id'] = $data["id"];
}
if (isset($data["name"])) {
$this->container['name'] = $data["name"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets id * Gets id
* @return int * @return int
@ -155,8 +187,8 @@ class Category implements ArrayAccess
*/ */
public function setId($id) public function setId($id)
{ {
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
} }
/** /**
@ -175,8 +207,8 @@ class Category implements ArrayAccess
*/ */
public function setName($name) public function setName($name)
{ {
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
} }
/** /**

View File

@ -125,9 +125,37 @@ class Dog extends Animal implements ArrayAccess
parent::__construct($data); parent::__construct($data);
if ($data != null) { if ($data != null) {
$this->container['breed'] = $data['breed']; if (isset($data["breed"])) {
$this->container['breed'] = $data["breed"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets breed * Gets breed
* @return string * @return string
@ -144,8 +172,8 @@ class Dog extends Animal implements ArrayAccess
*/ */
public function setBreed($breed) public function setBreed($breed)
{ {
$this->container['breed'] = $breed; $this->container['breed'] = $breed;
return $this; return $this;
} }
/** /**

View File

@ -245,21 +245,195 @@ class FormatTest implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['integer'] = $data['integer']; if (isset($data["integer"])) {
$this->container['int32'] = $data['int32']; $this->container['integer'] = $data["integer"];
$this->container['int64'] = $data['int64']; }
$this->container['number'] = $data['number']; if (isset($data["int32"])) {
$this->container['float'] = $data['float']; $this->container['int32'] = $data["int32"];
$this->container['double'] = $data['double']; }
$this->container['string'] = $data['string']; if (isset($data["int64"])) {
$this->container['byte'] = $data['byte']; $this->container['int64'] = $data["int64"];
$this->container['binary'] = $data['binary']; }
$this->container['date'] = $data['date']; if (isset($data["number"])) {
$this->container['date_time'] = $data['date_time']; $this->container['number'] = $data["number"];
$this->container['uuid'] = $data['uuid']; }
$this->container['password'] = $data['password']; if (isset($data["float"])) {
$this->container['float'] = $data["float"];
}
if (isset($data["double"])) {
$this->container['double'] = $data["double"];
}
if (isset($data["string"])) {
$this->container['string'] = $data["string"];
}
if (isset($data["byte"])) {
$this->container['byte'] = $data["byte"];
}
if (isset($data["binary"])) {
$this->container['binary'] = $data["binary"];
}
if (isset($data["date"])) {
$this->container['date'] = $data["date"];
}
if (isset($data["date_time"])) {
$this->container['date_time'] = $data["date_time"];
}
if (isset($data["uuid"])) {
$this->container['uuid'] = $data["uuid"];
}
if (isset($data["password"])) {
$this->container['password'] = $data["password"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
if ($this->container['integer'] > 100.0) {
$invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0.";
}
if ($this->container['integer'] < 10.0) {
$invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0.";
}
if ($this->container['int32'] > 200.0) {
$invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0.";
}
if ($this->container['int32'] < 20.0) {
$invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0.";
}
if ($this->container['number'] === null) {
$invalid_properties[] = "'$number' can't be null";
}
if ($this->container['number'] > 543.2) {
$invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2.";
}
if ($this->container['number'] < 32.1) {
$invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1.";
}
if ($this->container['float'] > 987.6) {
$invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6.";
}
if ($this->container['float'] < 54.3) {
$invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3.";
}
if ($this->container['double'] > 123.4) {
$invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4.";
}
if ($this->container['double'] < 67.8) {
$invalid_properties[] = "invalid value for '$double', must be bigger than or equal to 67.8.";
}
if (!preg_match("/[a-z]/i", $this->container['string'])) {
$invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i.";
}
if ($this->container['byte'] === null) {
$invalid_properties[] = "'$byte' can't be null";
}
if ($this->container['date'] === null) {
$invalid_properties[] = "'$date' can't be null";
}
if ($this->container['password'] === null) {
$invalid_properties[] = "'$password' can't be null";
}
if (strlen($this->container['password']) > 64) {
$invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64.";
}
if (strlen($this->container['password']) < 10) {
$invalid_properties[] = "invalid value for '$password', the character length must be bigger than or equal to 10.";
}
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
if ($this->container['integer'] > 100.0) {
return false;
}
if ($this->container['integer'] < 10.0) {
return false;
}
if ($this->container['int32'] > 200.0) {
return false;
}
if ($this->container['int32'] < 20.0) {
return false;
}
if ($this->container['number'] === null) {
return false;
}
if ($this->container['number'] > 543.2) {
return false;
}
if ($this->container['number'] < 32.1) {
return false;
}
if ($this->container['float'] > 987.6) {
return false;
}
if ($this->container['float'] < 54.3) {
return false;
}
if ($this->container['double'] > 123.4) {
return false;
}
if ($this->container['double'] < 67.8) {
return false;
}
if (!preg_match("/[a-z]/i", $this->container['string'])) {
return false;
}
if ($this->container['byte'] === null) {
return false;
}
if ($this->container['date'] === null) {
return false;
}
if ($this->container['password'] === null) {
return false;
}
if (strlen($this->container['password']) > 64) {
return false;
}
if (strlen($this->container['password']) < 10) {
return false;
}
return true;
}
/** /**
* Gets integer * Gets integer
* @return int * @return int
@ -277,7 +451,14 @@ class FormatTest implements ArrayAccess
public function setInteger($integer) public function setInteger($integer)
{ {
if ($integer > 100.0) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.0.');
}
if ($integer < 10.0) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.0.');
}
$this->container['integer'] = $integer; $this->container['integer'] = $integer;
return $this; return $this;
} }
/** /**
@ -297,7 +478,14 @@ class FormatTest implements ArrayAccess
public function setInt32($int32) public function setInt32($int32)
{ {
if ($int32 > 200.0) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.0.');
}
if ($int32 < 20.0) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.0.');
}
$this->container['int32'] = $int32; $this->container['int32'] = $int32;
return $this; return $this;
} }
/** /**
@ -316,8 +504,8 @@ class FormatTest implements ArrayAccess
*/ */
public function setInt64($int64) public function setInt64($int64)
{ {
$this->container['int64'] = $int64; $this->container['int64'] = $int64;
return $this; return $this;
} }
/** /**
@ -337,7 +525,14 @@ class FormatTest implements ArrayAccess
public function setNumber($number) public function setNumber($number)
{ {
if ($number > 543.2) {
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be smaller than or equal to 543.2.');
}
if ($number < 32.1) {
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.');
}
$this->container['number'] = $number; $this->container['number'] = $number;
return $this; return $this;
} }
/** /**
@ -357,7 +552,14 @@ class FormatTest implements ArrayAccess
public function setFloat($float) public function setFloat($float)
{ {
if ($float > 987.6) {
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be smaller than or equal to 987.6.');
}
if ($float < 54.3) {
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.');
}
$this->container['float'] = $float; $this->container['float'] = $float;
return $this; return $this;
} }
/** /**
@ -377,7 +579,14 @@ class FormatTest implements ArrayAccess
public function setDouble($double) public function setDouble($double)
{ {
if ($double > 123.4) {
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be smaller than or equal to 123.4.');
}
if ($double < 67.8) {
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.');
}
$this->container['double'] = $double; $this->container['double'] = $double;
return $this; return $this;
} }
/** /**
@ -397,7 +606,11 @@ class FormatTest implements ArrayAccess
public function setString($string) public function setString($string)
{ {
if (!preg_match("/[a-z]/i", $string)) {
throw new \InvalidArgumentException('invalid value for $string when calling FormatTest., must be conform to the pattern /[a-z]/i.');
}
$this->container['string'] = $string; $this->container['string'] = $string;
return $this; return $this;
} }
/** /**
@ -416,8 +629,8 @@ class FormatTest implements ArrayAccess
*/ */
public function setByte($byte) public function setByte($byte)
{ {
$this->container['byte'] = $byte; $this->container['byte'] = $byte;
return $this; return $this;
} }
/** /**
@ -436,8 +649,8 @@ class FormatTest implements ArrayAccess
*/ */
public function setBinary($binary) public function setBinary($binary)
{ {
$this->container['binary'] = $binary; $this->container['binary'] = $binary;
return $this; return $this;
} }
/** /**
@ -456,8 +669,8 @@ class FormatTest implements ArrayAccess
*/ */
public function setDate($date) public function setDate($date)
{ {
$this->container['date'] = $date; $this->container['date'] = $date;
return $this; return $this;
} }
/** /**
@ -476,8 +689,8 @@ class FormatTest implements ArrayAccess
*/ */
public function setDateTime($date_time) public function setDateTime($date_time)
{ {
$this->container['date_time'] = $date_time; $this->container['date_time'] = $date_time;
return $this; return $this;
} }
/** /**
@ -496,8 +709,8 @@ class FormatTest implements ArrayAccess
*/ */
public function setUuid($uuid) public function setUuid($uuid)
{ {
$this->container['uuid'] = $uuid; $this->container['uuid'] = $uuid;
return $this; return $this;
} }
/** /**
@ -516,8 +729,14 @@ class FormatTest implements ArrayAccess
*/ */
public function setPassword($password) public function setPassword($password)
{ {
if (strlen($password) > 64) {
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be smaller than or equal to 64.');
}
if (strlen($password) < 10) {
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.');
}
$this->container['password'] = $password; $this->container['password'] = $password;
return $this; return $this;
} }
/** /**

View File

@ -125,9 +125,37 @@ class Model200Response implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['name'] = $data['name']; if (isset($data["name"])) {
$this->container['name'] = $data["name"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets name * Gets name
* @return int * @return int
@ -144,8 +172,8 @@ class Model200Response implements ArrayAccess
*/ */
public function setName($name) public function setName($name)
{ {
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
} }
/** /**

View File

@ -125,9 +125,37 @@ class ModelReturn implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['return'] = $data['return']; if (isset($data["return"])) {
$this->container['return'] = $data["return"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets return * Gets return
* @return int * @return int
@ -144,8 +172,8 @@ class ModelReturn implements ArrayAccess
*/ */
public function setReturn($return) public function setReturn($return)
{ {
$this->container['return'] = $return; $this->container['return'] = $return;
return $this; return $this;
} }
/** /**

View File

@ -145,11 +145,52 @@ class Name implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['name'] = $data['name']; if (isset($data["name"])) {
$this->container['snake_case'] = $data['snake_case']; $this->container['name'] = $data["name"];
$this->container['property'] = $data['property']; }
if (isset($data["snake_case"])) {
$this->container['snake_case'] = $data["snake_case"];
}
if (isset($data["property"])) {
$this->container['property'] = $data["property"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
if ($this->container['name'] === null) {
$invalid_properties[] = "'$name' can't be null";
}
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}
return true;
}
/** /**
* Gets name * Gets name
* @return int * @return int
@ -166,8 +207,8 @@ class Name implements ArrayAccess
*/ */
public function setName($name) public function setName($name)
{ {
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
} }
/** /**
@ -186,8 +227,8 @@ class Name implements ArrayAccess
*/ */
public function setSnakeCase($snake_case) public function setSnakeCase($snake_case)
{ {
$this->container['snake_case'] = $snake_case; $this->container['snake_case'] = $snake_case;
return $this; return $this;
} }
/** /**
@ -206,8 +247,8 @@ class Name implements ArrayAccess
*/ */
public function setProperty($property) public function setProperty($property)
{ {
$this->container['property'] = $property; $this->container['property'] = $property;
return $this; return $this;
} }
/** /**

View File

@ -190,14 +190,69 @@ class Order implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['id'] = $data['id']; if (isset($data["id"])) {
$this->container['pet_id'] = $data['pet_id']; $this->container['id'] = $data["id"];
$this->container['quantity'] = $data['quantity']; }
$this->container['ship_date'] = $data['ship_date']; if (isset($data["pet_id"])) {
$this->container['status'] = $data['status']; $this->container['pet_id'] = $data["pet_id"];
$this->container['complete'] = $data['complete']; }
if (isset($data["quantity"])) {
$this->container['quantity'] = $data["quantity"];
}
if (isset($data["ship_date"])) {
$this->container['ship_date'] = $data["ship_date"];
}
if (isset($data["status"])) {
$this->container['status'] = $data["status"];
}
if (isset($data["complete"])) {
$this->container['complete'] = $data["complete"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
$allowed_values = array("placed", "approved", "delivered");
if (!in_array($this->container['status'], $allowed_values))) {
$invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}.";
}
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
$allowed_values = array("placed", "approved", "delivered");
if (!in_array($this->container['status'], $allowed_values))) {
return false;
}
return true;
}
/** /**
* Gets id * Gets id
* @return int * @return int
@ -214,8 +269,8 @@ class Order implements ArrayAccess
*/ */
public function setId($id) public function setId($id)
{ {
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
} }
/** /**
@ -234,8 +289,8 @@ class Order implements ArrayAccess
*/ */
public function setPetId($pet_id) public function setPetId($pet_id)
{ {
$this->container['pet_id'] = $pet_id; $this->container['pet_id'] = $pet_id;
return $this; return $this;
} }
/** /**
@ -254,8 +309,8 @@ class Order implements ArrayAccess
*/ */
public function setQuantity($quantity) public function setQuantity($quantity)
{ {
$this->container['quantity'] = $quantity; $this->container['quantity'] = $quantity;
return $this; return $this;
} }
/** /**
@ -274,8 +329,8 @@ class Order implements ArrayAccess
*/ */
public function setShipDate($ship_date) public function setShipDate($ship_date)
{ {
$this->container['ship_date'] = $ship_date; $this->container['ship_date'] = $ship_date;
return $this; return $this;
} }
/** /**
@ -299,6 +354,7 @@ class Order implements ArrayAccess
throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'"); throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'");
} }
$this->container['status'] = $status; $this->container['status'] = $status;
return $this; return $this;
} }
/** /**
@ -317,8 +373,8 @@ class Order implements ArrayAccess
*/ */
public function setComplete($complete) public function setComplete($complete)
{ {
$this->container['complete'] = $complete; $this->container['complete'] = $complete;
return $this; return $this;
} }
/** /**

View File

@ -190,14 +190,79 @@ class Pet implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['id'] = $data['id']; if (isset($data["id"])) {
$this->container['category'] = $data['category']; $this->container['id'] = $data["id"];
$this->container['name'] = $data['name']; }
$this->container['photo_urls'] = $data['photo_urls']; if (isset($data["category"])) {
$this->container['tags'] = $data['tags']; $this->container['category'] = $data["category"];
$this->container['status'] = $data['status']; }
if (isset($data["name"])) {
$this->container['name'] = $data["name"];
}
if (isset($data["photo_urls"])) {
$this->container['photo_urls'] = $data["photo_urls"];
}
if (isset($data["tags"])) {
$this->container['tags'] = $data["tags"];
}
if (isset($data["status"])) {
$this->container['status'] = $data["status"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
if ($this->container['name'] === null) {
$invalid_properties[] = "'$name' can't be null";
}
if ($this->container['photo_urls'] === null) {
$invalid_properties[] = "'$photo_urls' can't be null";
}
$allowed_values = array("available", "pending", "sold");
if (!in_array($this->container['status'], $allowed_values))) {
$invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}.";
}
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}
if ($this->container['photo_urls'] === null) {
return false;
}
$allowed_values = array("available", "pending", "sold");
if (!in_array($this->container['status'], $allowed_values))) {
return false;
}
return true;
}
/** /**
* Gets id * Gets id
* @return int * @return int
@ -214,8 +279,8 @@ class Pet implements ArrayAccess
*/ */
public function setId($id) public function setId($id)
{ {
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
} }
/** /**
@ -234,8 +299,8 @@ class Pet implements ArrayAccess
*/ */
public function setCategory($category) public function setCategory($category)
{ {
$this->container['category'] = $category; $this->container['category'] = $category;
return $this; return $this;
} }
/** /**
@ -254,8 +319,8 @@ class Pet implements ArrayAccess
*/ */
public function setName($name) public function setName($name)
{ {
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
} }
/** /**
@ -274,8 +339,8 @@ class Pet implements ArrayAccess
*/ */
public function setPhotoUrls($photo_urls) public function setPhotoUrls($photo_urls)
{ {
$this->container['photo_urls'] = $photo_urls; $this->container['photo_urls'] = $photo_urls;
return $this; return $this;
} }
/** /**
@ -294,8 +359,8 @@ class Pet implements ArrayAccess
*/ */
public function setTags($tags) public function setTags($tags)
{ {
$this->container['tags'] = $tags; $this->container['tags'] = $tags;
return $this; return $this;
} }
/** /**
@ -319,6 +384,7 @@ class Pet implements ArrayAccess
throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'"); throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'");
} }
$this->container['status'] = $status; $this->container['status'] = $status;
return $this; return $this;
} }
/** /**

View File

@ -125,9 +125,37 @@ class SpecialModelName implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['special_property_name'] = $data['special_property_name']; if (isset($data["special_property_name"])) {
$this->container['special_property_name'] = $data["special_property_name"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets special_property_name * Gets special_property_name
* @return int * @return int
@ -144,8 +172,8 @@ class SpecialModelName implements ArrayAccess
*/ */
public function setSpecialPropertyName($special_property_name) public function setSpecialPropertyName($special_property_name)
{ {
$this->container['special_property_name'] = $special_property_name; $this->container['special_property_name'] = $special_property_name;
return $this; return $this;
} }
/** /**

View File

@ -135,10 +135,42 @@ class Tag implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['id'] = $data['id']; if (isset($data["id"])) {
$this->container['name'] = $data['name']; $this->container['id'] = $data["id"];
}
if (isset($data["name"])) {
$this->container['name'] = $data["name"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets id * Gets id
* @return int * @return int
@ -155,8 +187,8 @@ class Tag implements ArrayAccess
*/ */
public function setId($id) public function setId($id)
{ {
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
} }
/** /**
@ -175,8 +207,8 @@ class Tag implements ArrayAccess
*/ */
public function setName($name) public function setName($name)
{ {
$this->container['name'] = $name; $this->container['name'] = $name;
return $this; return $this;
} }
/** /**

View File

@ -195,16 +195,72 @@ class User implements ArrayAccess
if ($data != null) { if ($data != null) {
$this->container['id'] = $data['id']; if (isset($data["id"])) {
$this->container['username'] = $data['username']; $this->container['id'] = $data["id"];
$this->container['first_name'] = $data['first_name']; }
$this->container['last_name'] = $data['last_name']; if (isset($data["username"])) {
$this->container['email'] = $data['email']; $this->container['username'] = $data["username"];
$this->container['password'] = $data['password']; }
$this->container['phone'] = $data['phone']; if (isset($data["first_name"])) {
$this->container['user_status'] = $data['user_status']; $this->container['first_name'] = $data["first_name"];
}
if (isset($data["last_name"])) {
$this->container['last_name'] = $data["last_name"];
}
if (isset($data["email"])) {
$this->container['email'] = $data["email"];
}
if (isset($data["password"])) {
$this->container['password'] = $data["password"];
}
if (isset($data["phone"])) {
$this->container['phone'] = $data["phone"];
}
if (isset($data["user_status"])) {
$this->container['user_status'] = $data["user_status"];
}
} }
} }
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
return $invalid_properties;
}
/**
* validate all the parameters in the model
* return true if all passed
*
* @return bool [description]
*/
public function valid()
{
return true;
}
/** /**
* Gets id * Gets id
* @return int * @return int
@ -221,8 +277,8 @@ class User implements ArrayAccess
*/ */
public function setId($id) public function setId($id)
{ {
$this->container['id'] = $id; $this->container['id'] = $id;
return $this; return $this;
} }
/** /**
@ -241,8 +297,8 @@ class User implements ArrayAccess
*/ */
public function setUsername($username) public function setUsername($username)
{ {
$this->container['username'] = $username; $this->container['username'] = $username;
return $this; return $this;
} }
/** /**
@ -261,8 +317,8 @@ class User implements ArrayAccess
*/ */
public function setFirstName($first_name) public function setFirstName($first_name)
{ {
$this->container['first_name'] = $first_name; $this->container['first_name'] = $first_name;
return $this; return $this;
} }
/** /**
@ -281,8 +337,8 @@ class User implements ArrayAccess
*/ */
public function setLastName($last_name) public function setLastName($last_name)
{ {
$this->container['last_name'] = $last_name; $this->container['last_name'] = $last_name;
return $this; return $this;
} }
/** /**
@ -301,8 +357,8 @@ class User implements ArrayAccess
*/ */
public function setEmail($email) public function setEmail($email)
{ {
$this->container['email'] = $email; $this->container['email'] = $email;
return $this; return $this;
} }
/** /**
@ -321,8 +377,8 @@ class User implements ArrayAccess
*/ */
public function setPassword($password) public function setPassword($password)
{ {
$this->container['password'] = $password; $this->container['password'] = $password;
return $this; return $this;
} }
/** /**
@ -341,8 +397,8 @@ class User implements ArrayAccess
*/ */
public function setPhone($phone) public function setPhone($phone)
{ {
$this->container['phone'] = $phone; $this->container['phone'] = $phone;
return $this; return $this;
} }
/** /**
@ -361,8 +417,8 @@ class User implements ArrayAccess
*/ */
public function setUserStatus($user_status) public function setUserStatus($user_status)
{ {
$this->container['user_status'] = $user_status; $this->container['user_status'] = $user_status;
return $this; return $this;
} }
/** /**