minor fix to mustache layout

This commit is contained in:
wing328
2016-05-09 16:32:49 +08:00
parent cf6e8cffbb
commit f30b32afc4
22 changed files with 132 additions and 184 deletions

View File

@@ -171,7 +171,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{/required}}
{{#isEnum}}
$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
if (!in_array($this->container['{{name}}'], $allowed_values))) {
if (!in_array($this->container['{{name}}'], $allowed_values)) {
$invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}.";
}
{{/isEnum}}
@@ -207,10 +207,10 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
@@ -218,12 +218,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{#required}}
if ($this->container['{{name}}'] === null) {
return false;
}{{/required}}
}
{{/required}}
{{#isEnum}}
$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
if (!in_array($this->container['{{name}}'], $allowed_values))) {
if (!in_array($this->container['{{name}}'], $allowed_values)) {
return false;
}{{/isEnum}}
}
{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if (strlen($this->container['{{name}}']) > {{maxLength}}) {
@@ -255,7 +257,6 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
return true;
}
{{#vars}}
/**
* Gets {{name}}

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)

View File

@@ -149,21 +149,19 @@ class Animal implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @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

View File

@@ -134,17 +134,16 @@ class AnimalFarm implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @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

@@ -169,23 +169,16 @@ class ApiResponse implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets code
* @return int

View File

@@ -143,19 +143,16 @@ class Cat extends Animal implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets declawed
* @return bool

View File

@@ -156,21 +156,16 @@ class Category implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets id
* @return int

View File

@@ -143,19 +143,16 @@ class Dog extends Animal implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets breed
* @return string

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

@@ -350,80 +350,58 @@ class FormatTest implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @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;
}
@@ -433,7 +411,6 @@ class FormatTest implements ArrayAccess
return true;
}
/**
* Gets integer
* @return int

View File

@@ -143,19 +143,16 @@ class Model200Response implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets name
* @return int

View File

@@ -143,19 +143,16 @@ class ModelReturn implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets return
* @return int

View File

@@ -172,25 +172,19 @@ class Name implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
if ($this->container['name'] === null) {
return false;
}
return true;
}
/**
* Gets name
* @return int

View File

@@ -220,39 +220,27 @@ class Order implements ArrayAccess
{
$invalid_properties = array();
$allowed_values = array("placed", "approved", "delivered");
if (!in_array($this->container['status'], $allowed_values))) {
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
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @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))) {
if (!in_array($this->container['status'], $allowed_values)) {
return false;
}
return true;
}
/**
* Gets id
* @return int

View File

@@ -226,43 +226,33 @@ class Pet implements ArrayAccess
$invalid_properties[] = "'$photo_urls' can't be null";
}
$allowed_values = array("available", "pending", "sold");
if (!in_array($this->container['status'], $allowed_values))) {
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
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @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))) {
if (!in_array($this->container['status'], $allowed_values)) {
return false;
}
return true;
}
/**
* Gets id
* @return int

View File

@@ -143,19 +143,16 @@ class SpecialModelName implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets special_property_name
* @return int

View File

@@ -156,21 +156,16 @@ class Tag implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets id
* @return int

View File

@@ -234,33 +234,16 @@ class User implements ArrayAccess
}
/**
* validate all the parameters in the model
* validate all the properties in the model
* return true if all passed
*
* @return bool [description]
* @return bool True if all properteis are valid
*/
public function valid()
{
return true;
}
/**
* Gets id
* @return int

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() {