[PHP] Use appDescription in composer.mustache (#1485)

* Use appDescription in composer.mustache

* Update petstore files

* More updated php petstore files

* Yet another updated php petstore file

* Use "{{{appDescription}}}" instead of "{{appDescription}}"
This commit is contained in:
Alwin Garside 2018-11-20 02:30:14 +01:00 committed by Akihito Nakano
parent 2b58f6737a
commit 792f95eb09
12 changed files with 36 additions and 28 deletions

View File

@ -3,7 +3,7 @@
{{#artifactVersion}} {{#artifactVersion}}
"version": "{{artifactVersion}}", "version": "{{artifactVersion}}",
{{/artifactVersion}} {{/artifactVersion}}
"description": "{{description}}", "description": "{{{appDescription}}}",
"keywords": [ "keywords": [
"openapitools", "openapitools",
"openapi-generator", "openapi-generator",

View File

@ -1,6 +1,6 @@
{ {
"name": "GIT_USER_ID/GIT_REPO_ID", "name": "GIT_USER_ID/GIT_REPO_ID",
"description": "", "description": "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --",
"keywords": [ "keywords": [
"openapitools", "openapitools",
"openapi-generator", "openapi-generator",

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.3.0-SNAPSHOT * OpenAPI Generator version: 3.3.4-SNAPSHOT
*/ */
/** /**
@ -253,10 +253,10 @@ class FakeApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
// $_tempBody is the method argument, if present // $_tempBody is the method argument, if present
$httpBody = $_tempBody; if ($headers['Content-Type'] === 'application/json') {
// \stdClass has no __toString(), so we should encode it manually $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { } else {
$httpBody = \GuzzleHttp\json_encode($httpBody); $httpBody = $_tempBody;
} }
} elseif (count($formParams) > 0) { } elseif (count($formParams) > 0) {
if ($multipart) { if ($multipart) {

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.3.0-SNAPSHOT * OpenAPI Generator version: 3.3.4-SNAPSHOT
*/ */
/** /**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.3.0-SNAPSHOT * OpenAPI Generator version: 3.3.4-SNAPSHOT
*/ */
/** /**

View File

@ -17,7 +17,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.3.0-SNAPSHOT * OpenAPI Generator version: 3.3.4-SNAPSHOT
*/ */
/** /**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.3.0-SNAPSHOT * OpenAPI Generator version: 3.3.4-SNAPSHOT
*/ */
/** /**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.3.0-SNAPSHOT * OpenAPI Generator version: 3.3.4-SNAPSHOT
*/ */
/** /**

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.3.0-SNAPSHOT * OpenAPI Generator version: 3.3.4-SNAPSHOT
*/ */
/** /**
@ -29,6 +29,8 @@
namespace OpenAPI\Client; namespace OpenAPI\Client;
use OpenAPI\Client\Model\ModelInterface;
/** /**
* ObjectSerializer Class Doc Comment * ObjectSerializer Class Doc Comment
* *
@ -61,19 +63,25 @@ class ObjectSerializer
return $data; return $data;
} elseif (is_object($data)) { } elseif (is_object($data)) {
$values = []; $values = [];
$formats = $data::openAPIFormats(); if ($data instanceof ModelInterface) {
foreach ($data::openAPITypes() as $property => $openAPIType) { $formats = $data::openAPIFormats();
$getter = $data::getters()[$property]; foreach ($data::openAPITypes() as $property => $openAPIType) {
$value = $data->$getter(); $getter = $data::getters()[$property];
if ($value !== null $value = $data->$getter();
&& !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) if ($value !== null
&& method_exists($openAPIType, 'getAllowableEnumValues') && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)
&& !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { && method_exists($openAPIType, 'getAllowableEnumValues')
$imploded = implode("', '", $openAPIType::getAllowableEnumValues()); && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) {
throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); $imploded = implode("', '", $openAPIType::getAllowableEnumValues());
throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'");
}
if ($value !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
}
} }
if ($value !== null) { } else {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); foreach($data as $property => $value) {
$values[$property] = self::sanitizeForSerialization($value);
} }
} }
return (object)$values; return (object)$values;

View File

@ -1,6 +1,6 @@
{ {
"name": "GIT_USER_ID/GIT_REPO_ID", "name": "GIT_USER_ID/GIT_REPO_ID",
"description": "", "description": "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\",
"keywords": [ "keywords": [
"openapitools", "openapitools",
"openapi-generator", "openapi-generator",

View File

@ -1,6 +1,6 @@
{ {
"name": "GIT_USER_ID/GIT_REPO_ID", "name": "GIT_USER_ID/GIT_REPO_ID",
"description": "", "description": "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\",
"keywords": [ "keywords": [
"openapitools", "openapitools",
"openapi-generator", "openapi-generator",