Merge branch 'abcsun-php_parameter_validation'

This commit is contained in:
wing328 2016-05-09 16:33:25 +08:00
commit 94978e019e
23 changed files with 959 additions and 143 deletions

View File

@ -131,7 +131,7 @@ use \{{invokerPackage}}\ObjectSerializer;
}
{{/maxLength}}
{{#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}}.');
}
{{/minLength}}

View File

@ -147,10 +147,116 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{/discriminator}}
if ($data != null) {
{{#vars}}$this->container['{{name}}'] = $data['{{name}}'];{{#hasMore}}
{{/hasMore}}{{/vars}}
{{#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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
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}}
/**
* Gets {{name}}
@ -168,11 +274,40 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
*/
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)) {
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}};
return $this;
}
{{/vars}}

View File

@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-05-06T16:24:00.420+08:00
- Build date: 2016-05-09T16:31:19.614+08:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
## Requirements
@ -87,11 +87,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status

View File

@ -4,27 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
# **testEndpointParameters**
> testEndpointParameters($number, $double, $string, $byte, $integer, $int32, $int64, $float, $binary, $date, $date_time, $password)
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
### Example
```php

View File

@ -93,11 +93,7 @@ class FakeApi
/**
* testEndpointParameters
*
* Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @param float $number None (required)
* @param double $double None (required)
@ -124,11 +120,7 @@ class FakeApi
/**
* testEndpointParametersWithHttpInfo
*
* Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @param float $number None (required)
* @param double $double None (required)
@ -206,7 +198,7 @@ class FakeApi
if (strlen($password) > 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.');
}

View File

@ -128,9 +128,40 @@ class Animal implements ArrayAccess
$this->container[$discrimintor] = static::$swaggerModelName;
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
if ($this->container['class_name'] === null) {
return false;
}
return true;
}
/**
* Gets class_name
* @return string
@ -147,8 +178,8 @@ class Animal implements ArrayAccess
*/
public function setClassName($class_name)
{
$this->container['class_name'] = $class_name;
return $this;
}
/**

View File

@ -119,9 +119,31 @@ class AnimalFarm implements ArrayAccess
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Returns true if offset exists. False otherwise.
* @param integer $offset Offset

View File

@ -145,11 +145,40 @@ class ApiResponse implements ArrayAccess
if ($data != null) {
$this->container['code'] = $data['code'];
$this->container['type'] = $data['type'];
$this->container['message'] = $data['message'];
if (isset($data["code"])) {
$this->container['code'] = $data["code"];
}
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets code
* @return int
@ -166,8 +195,8 @@ class ApiResponse implements ArrayAccess
*/
public function setCode($code)
{
$this->container['code'] = $code;
return $this;
}
/**
@ -186,8 +215,8 @@ class ApiResponse implements ArrayAccess
*/
public function setType($type)
{
$this->container['type'] = $type;
return $this;
}
/**
@ -206,8 +235,8 @@ class ApiResponse implements ArrayAccess
*/
public function setMessage($message)
{
$this->container['message'] = $message;
return $this;
}
/**

View File

@ -125,9 +125,34 @@ class Cat extends Animal implements ArrayAccess
parent::__construct($data);
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets declawed
* @return bool
@ -144,8 +169,8 @@ class Cat extends Animal implements ArrayAccess
*/
public function setDeclawed($declawed)
{
$this->container['declawed'] = $declawed;
return $this;
}
/**

View File

@ -135,10 +135,37 @@ class Category implements ArrayAccess
if ($data != null) {
$this->container['id'] = $data['id'];
$this->container['name'] = $data['name'];
if (isset($data["id"])) {
$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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets id
* @return int
@ -155,8 +182,8 @@ class Category implements ArrayAccess
*/
public function setId($id)
{
$this->container['id'] = $id;
return $this;
}
/**
@ -175,8 +202,8 @@ class Category implements ArrayAccess
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**

View File

@ -125,9 +125,34 @@ class Dog extends Animal implements ArrayAccess
parent::__construct($data);
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets breed
* @return string
@ -144,8 +169,8 @@ class Dog extends Animal implements ArrayAccess
*/
public function setBreed($breed)
{
$this->container['breed'] = $breed;
return $this;
}
/**

View File

@ -119,9 +119,31 @@ class EnumClass implements ArrayAccess
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Returns true if offset exists. False otherwise.
* @param integer $offset Offset

View File

@ -184,11 +184,64 @@ class EnumTest implements ArrayAccess
if ($data != null) {
$this->container['enum_string'] = $data['enum_string'];
$this->container['enum_integer'] = $data['enum_integer'];
$this->container['enum_number'] = $data['enum_number'];
if (isset($data["enum_string"])) {
$this->container['enum_string'] = $data["enum_string"];
}
if (isset($data["enum_integer"])) {
$this->container['enum_integer'] = $data["enum_integer"];
}
if (isset($data["enum_number"])) {
$this->container['enum_number'] = $data["enum_number"];
}
}
}
/**
* show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function list_invalid_properties()
{
$invalid_properties = array();
$allowed_values = array("UPPER", "lower");
if (!in_array($this->container['enum_string'], $allowed_values)) {
$invalid_properties[] = "invalid value for '$enum_string', must be one of #{allowed_values}.";
}
$allowed_values = array("1", "-1");
if (!in_array($this->container['enum_integer'], $allowed_values)) {
$invalid_properties[] = "invalid value for '$enum_integer', must be one of #{allowed_values}.";
}
$allowed_values = array("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}.";
}
return $invalid_properties;
}
/**
* validate all the properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
$allowed_values = array("UPPER", "lower");
if (!in_array($this->container['enum_string'], $allowed_values)) {
return false;
}
$allowed_values = array("1", "-1");
if (!in_array($this->container['enum_integer'], $allowed_values)) {
return false;
}
$allowed_values = array("1.1", "-1.2");
if (!in_array($this->container['enum_number'], $allowed_values)) {
return false;
}
return true;
}
/**
* Gets enum_string
* @return string
@ -210,6 +263,7 @@ class EnumTest implements ArrayAccess
throw new \InvalidArgumentException("Invalid value for 'enum_string', must be one of 'UPPER', 'lower'");
}
$this->container['enum_string'] = $enum_string;
return $this;
}
/**
@ -233,6 +287,7 @@ class EnumTest implements ArrayAccess
throw new \InvalidArgumentException("Invalid value for 'enum_integer', must be one of '1', '-1'");
}
$this->container['enum_integer'] = $enum_integer;
return $this;
}
/**
@ -256,6 +311,7 @@ class EnumTest implements ArrayAccess
throw new \InvalidArgumentException("Invalid value for 'enum_number', must be one of '1.1', '-1.2'");
}
$this->container['enum_number'] = $enum_number;
return $this;
}
/**

View File

@ -245,21 +245,172 @@ class FormatTest implements ArrayAccess
if ($data != null) {
$this->container['integer'] = $data['integer'];
$this->container['int32'] = $data['int32'];
$this->container['int64'] = $data['int64'];
$this->container['number'] = $data['number'];
$this->container['float'] = $data['float'];
$this->container['double'] = $data['double'];
$this->container['string'] = $data['string'];
$this->container['byte'] = $data['byte'];
$this->container['binary'] = $data['binary'];
$this->container['date'] = $data['date'];
$this->container['date_time'] = $data['date_time'];
$this->container['uuid'] = $data['uuid'];
$this->container['password'] = $data['password'];
if (isset($data["integer"])) {
$this->container['integer'] = $data["integer"];
}
if (isset($data["int32"])) {
$this->container['int32'] = $data["int32"];
}
if (isset($data["int64"])) {
$this->container['int64'] = $data["int64"];
}
if (isset($data["number"])) {
$this->container['number'] = $data["number"];
}
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
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
* @return int
@ -276,8 +427,15 @@ class FormatTest implements ArrayAccess
*/
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;
return $this;
}
/**
@ -296,8 +454,15 @@ class FormatTest implements ArrayAccess
*/
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;
return $this;
}
/**
@ -316,8 +481,8 @@ class FormatTest implements ArrayAccess
*/
public function setInt64($int64)
{
$this->container['int64'] = $int64;
return $this;
}
/**
@ -336,8 +501,15 @@ class FormatTest implements ArrayAccess
*/
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;
return $this;
}
/**
@ -356,8 +528,15 @@ class FormatTest implements ArrayAccess
*/
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;
return $this;
}
/**
@ -376,8 +555,15 @@ class FormatTest implements ArrayAccess
*/
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;
return $this;
}
/**
@ -396,8 +582,12 @@ class FormatTest implements ArrayAccess
*/
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;
return $this;
}
/**
@ -416,8 +606,8 @@ class FormatTest implements ArrayAccess
*/
public function setByte($byte)
{
$this->container['byte'] = $byte;
return $this;
}
/**
@ -436,8 +626,8 @@ class FormatTest implements ArrayAccess
*/
public function setBinary($binary)
{
$this->container['binary'] = $binary;
return $this;
}
/**
@ -456,8 +646,8 @@ class FormatTest implements ArrayAccess
*/
public function setDate($date)
{
$this->container['date'] = $date;
return $this;
}
/**
@ -476,8 +666,8 @@ class FormatTest implements ArrayAccess
*/
public function setDateTime($date_time)
{
$this->container['date_time'] = $date_time;
return $this;
}
/**
@ -496,8 +686,8 @@ class FormatTest implements ArrayAccess
*/
public function setUuid($uuid)
{
$this->container['uuid'] = $uuid;
return $this;
}
/**
@ -516,8 +706,14 @@ class FormatTest implements ArrayAccess
*/
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;
return $this;
}
/**

View File

@ -125,9 +125,34 @@ class Model200Response implements ArrayAccess
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets name
* @return int
@ -144,8 +169,8 @@ class Model200Response implements ArrayAccess
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**

View File

@ -125,9 +125,34 @@ class ModelReturn implements ArrayAccess
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets return
* @return int
@ -144,8 +169,8 @@ class ModelReturn implements ArrayAccess
*/
public function setReturn($return)
{
$this->container['return'] = $return;
return $this;
}
/**

View File

@ -145,11 +145,46 @@ class Name implements ArrayAccess
if ($data != null) {
$this->container['name'] = $data['name'];
$this->container['snake_case'] = $data['snake_case'];
$this->container['property'] = $data['property'];
if (isset($data["name"])) {
$this->container['name'] = $data["name"];
}
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}
return true;
}
/**
* Gets name
* @return int
@ -166,8 +201,8 @@ class Name implements ArrayAccess
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**
@ -186,8 +221,8 @@ class Name implements ArrayAccess
*/
public function setSnakeCase($snake_case)
{
$this->container['snake_case'] = $snake_case;
return $this;
}
/**
@ -206,8 +241,8 @@ class Name implements ArrayAccess
*/
public function setProperty($property)
{
$this->container['property'] = $property;
return $this;
}
/**

View File

@ -190,14 +190,57 @@ class Order implements ArrayAccess
if ($data != null) {
$this->container['id'] = $data['id'];
$this->container['pet_id'] = $data['pet_id'];
$this->container['quantity'] = $data['quantity'];
$this->container['ship_date'] = $data['ship_date'];
$this->container['status'] = $data['status'];
$this->container['complete'] = $data['complete'];
if (isset($data["id"])) {
$this->container['id'] = $data["id"];
}
if (isset($data["pet_id"])) {
$this->container['pet_id'] = $data["pet_id"];
}
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
$allowed_values = array("placed", "approved", "delivered");
if (!in_array($this->container['status'], $allowed_values)) {
return false;
}
return true;
}
/**
* Gets id
* @return int
@ -214,8 +257,8 @@ class Order implements ArrayAccess
*/
public function setId($id)
{
$this->container['id'] = $id;
return $this;
}
/**
@ -234,8 +277,8 @@ class Order implements ArrayAccess
*/
public function setPetId($pet_id)
{
$this->container['pet_id'] = $pet_id;
return $this;
}
/**
@ -254,8 +297,8 @@ class Order implements ArrayAccess
*/
public function setQuantity($quantity)
{
$this->container['quantity'] = $quantity;
return $this;
}
/**
@ -274,8 +317,8 @@ class Order implements ArrayAccess
*/
public function setShipDate($ship_date)
{
$this->container['ship_date'] = $ship_date;
return $this;
}
/**
@ -299,6 +342,7 @@ class Order implements ArrayAccess
throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'");
}
$this->container['status'] = $status;
return $this;
}
/**
@ -317,8 +361,8 @@ class Order implements ArrayAccess
*/
public function setComplete($complete)
{
$this->container['complete'] = $complete;
return $this;
}
/**

View File

@ -190,14 +190,69 @@ class Pet implements ArrayAccess
if ($data != null) {
$this->container['id'] = $data['id'];
$this->container['category'] = $data['category'];
$this->container['name'] = $data['name'];
$this->container['photo_urls'] = $data['photo_urls'];
$this->container['tags'] = $data['tags'];
$this->container['status'] = $data['status'];
if (isset($data["id"])) {
$this->container['id'] = $data["id"];
}
if (isset($data["category"])) {
$this->container['category'] = $data["category"];
}
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
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
* @return int
@ -214,8 +269,8 @@ class Pet implements ArrayAccess
*/
public function setId($id)
{
$this->container['id'] = $id;
return $this;
}
/**
@ -234,8 +289,8 @@ class Pet implements ArrayAccess
*/
public function setCategory($category)
{
$this->container['category'] = $category;
return $this;
}
/**
@ -254,8 +309,8 @@ class Pet implements ArrayAccess
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**
@ -274,8 +329,8 @@ class Pet implements ArrayAccess
*/
public function setPhotoUrls($photo_urls)
{
$this->container['photo_urls'] = $photo_urls;
return $this;
}
/**
@ -294,8 +349,8 @@ class Pet implements ArrayAccess
*/
public function setTags($tags)
{
$this->container['tags'] = $tags;
return $this;
}
/**
@ -319,6 +374,7 @@ class Pet implements ArrayAccess
throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'");
}
$this->container['status'] = $status;
return $this;
}
/**

View File

@ -125,9 +125,34 @@ class SpecialModelName implements ArrayAccess
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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets special_property_name
* @return int
@ -144,8 +169,8 @@ class SpecialModelName implements ArrayAccess
*/
public function setSpecialPropertyName($special_property_name)
{
$this->container['special_property_name'] = $special_property_name;
return $this;
}
/**

View File

@ -135,10 +135,37 @@ class Tag implements ArrayAccess
if ($data != null) {
$this->container['id'] = $data['id'];
$this->container['name'] = $data['name'];
if (isset($data["id"])) {
$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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets id
* @return int
@ -155,8 +182,8 @@ class Tag implements ArrayAccess
*/
public function setId($id)
{
$this->container['id'] = $id;
return $this;
}
/**
@ -175,8 +202,8 @@ class Tag implements ArrayAccess
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**

View File

@ -195,16 +195,55 @@ class User implements ArrayAccess
if ($data != null) {
$this->container['id'] = $data['id'];
$this->container['username'] = $data['username'];
$this->container['first_name'] = $data['first_name'];
$this->container['last_name'] = $data['last_name'];
$this->container['email'] = $data['email'];
$this->container['password'] = $data['password'];
$this->container['phone'] = $data['phone'];
$this->container['user_status'] = $data['user_status'];
if (isset($data["id"])) {
$this->container['id'] = $data["id"];
}
if (isset($data["username"])) {
$this->container['username'] = $data["username"];
}
if (isset($data["first_name"])) {
$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 properties in the model
* return true if all passed
*
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets id
* @return int
@ -221,8 +260,8 @@ class User implements ArrayAccess
*/
public function setId($id)
{
$this->container['id'] = $id;
return $this;
}
/**
@ -241,8 +280,8 @@ class User implements ArrayAccess
*/
public function setUsername($username)
{
$this->container['username'] = $username;
return $this;
}
/**
@ -261,8 +300,8 @@ class User implements ArrayAccess
*/
public function setFirstName($first_name)
{
$this->container['first_name'] = $first_name;
return $this;
}
/**
@ -281,8 +320,8 @@ class User implements ArrayAccess
*/
public function setLastName($last_name)
{
$this->container['last_name'] = $last_name;
return $this;
}
/**
@ -301,8 +340,8 @@ class User implements ArrayAccess
*/
public function setEmail($email)
{
$this->container['email'] = $email;
return $this;
}
/**
@ -321,8 +360,8 @@ class User implements ArrayAccess
*/
public function setPassword($password)
{
$this->container['password'] = $password;
return $this;
}
/**
@ -341,8 +380,8 @@ class User implements ArrayAccess
*/
public function setPhone($phone)
{
$this->container['phone'] = $phone;
return $this;
}
/**
@ -361,8 +400,8 @@ class User implements ArrayAccess
*/
public function setUserStatus($user_status)
{
$this->container['user_status'] = $user_status;
return $this;
}
/**

View File

@ -67,11 +67,7 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
/**
* Test case for testEndpointParameters
*
* Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
*/
public function test_testEndpointParameters() {