diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 25e95250762..1d485379588 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1889,7 +1889,7 @@ public class DefaultCodegen { // set the example value // if not specified in x-example, generate a default value if (p.vendorExtensions.containsKey("x-example")) { - p.example = (String) p.vendorExtensions.get("x-example"); + p.example = Objects.toString(p.vendorExtensions.get("x-example")); } else if (Boolean.TRUE.equals(p.isString)) { p.example = p.paramName + "_example"; } else if (Boolean.TRUE.equals(p.isBoolean)) { diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index ac92e7daa21..efc4130e160 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -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-04-19T21:31:44.449+02:00 +- Build date: 2016-04-23T16:49:49.572+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -122,6 +122,12 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## petstore_auth - **Type**: OAuth @@ -131,12 +137,6 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## Author diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Name.md b/samples/client/petstore/php/SwaggerClient-php/docs/Name.md index 905680a7d30..5f31a2cc7fd 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Name.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Name.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **int** | | **snake_case** | **int** | | [optional] +**property** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php index c44cda7b709..9e1c4b92762 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -58,7 +58,8 @@ class Name implements ArrayAccess */ static $swaggerTypes = array( 'name' => 'int', - 'snake_case' => 'int' + 'snake_case' => 'int', + 'property' => 'string' ); static function swaggerTypes() { @@ -71,7 +72,8 @@ class Name implements ArrayAccess */ static $attributeMap = array( 'name' => 'name', - 'snake_case' => 'snake_case' + 'snake_case' => 'snake_case', + 'property' => 'property' ); static function attributeMap() { @@ -84,7 +86,8 @@ class Name implements ArrayAccess */ static $setters = array( 'name' => 'setName', - 'snake_case' => 'setSnakeCase' + 'snake_case' => 'setSnakeCase', + 'property' => 'setProperty' ); static function setters() { @@ -97,7 +100,8 @@ class Name implements ArrayAccess */ static $getters = array( 'name' => 'getName', - 'snake_case' => 'getSnakeCase' + 'snake_case' => 'getSnakeCase', + 'property' => 'getProperty' ); static function getters() { @@ -114,6 +118,11 @@ class Name implements ArrayAccess * @var int */ protected $snake_case; + /** + * $property + * @var string + */ + protected $property; /** * Constructor @@ -126,6 +135,7 @@ class Name implements ArrayAccess if ($data != null) { $this->name = $data["name"]; $this->snake_case = $data["snake_case"]; + $this->property = $data["property"]; } } /** @@ -168,6 +178,26 @@ class Name implements ArrayAccess $this->snake_case = $snake_case; return $this; } + /** + * Gets property + * @return string + */ + public function getProperty() + { + return $this->property; + } + + /** + * Sets property + * @param string $property + * @return $this + */ + public function setProperty($property) + { + + $this->property = $property; + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index ac63c18fbd5..3adaa899f5f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -256,7 +256,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { + } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') {