[PHP] Fix deserialize ApiException as a Model (#757)

* [PHP] Fix deserialize for default responses. Update samples

* [PHP] Update sample files

* Fix the distination ("-o") of petstore-security-test

* Clean up "petstore-security-test" folder

* Update petstore-security-test sample files

* Update petstore OpenAPI3 sample files
This commit is contained in:
Yann Milin 2018-09-06 17:52:59 +02:00 committed by Akihito Nakano
parent a8cbae4dc8
commit c5463232d3
28 changed files with 51 additions and 324 deletions

View File

@ -33,6 +33,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/php -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php -o samples/client/petstore-security-test/php $@"
ags="generate -t modules/openapi-generator/src/main/resources/php -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php -o samples/client/petstore-security-test/php/OpenAPIClient-php $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -220,6 +220,8 @@ class ObjectSerializer
if (null === $data) {
return null;
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
$data = is_string($data) ? json_decode($data) : $data;
settype($data, 'array');
$inner = substr($class, 4, -1);
$deserialized = [];
if (strrpos($inner, ",") !== false) {
@ -231,6 +233,7 @@ class ObjectSerializer
}
return $deserialized;
} elseif (strcasecmp(substr($class, -2), '[]') === 0) {
$data = is_string($data) ? json_decode($data) : $data;
$subClass = substr($class, 0, -2);
$values = [];
foreach ($data as $key => $value) {
@ -280,6 +283,7 @@ class ObjectSerializer
}
return $data;
} else {
$data = is_string($data) ? json_decode($data) : $data;
// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {

View File

@ -166,9 +166,6 @@ use {{invokerPackage}}\ObjectSerializer;
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('{{dataType}}' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -188,9 +185,6 @@ use {{invokerPackage}}\ObjectSerializer;
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -280,9 +274,6 @@ use {{invokerPackage}}\ObjectSerializer;
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -12,6 +12,8 @@ Method | HTTP request | Description
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
### Example
```php
<?php

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 3.1.1-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*/
/**
@ -230,6 +230,8 @@ class ObjectSerializer
if (null === $data) {
return null;
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
$data = is_string($data) ? json_decode($data) : $data;
settype($data, 'array');
$inner = substr($class, 4, -1);
$deserialized = [];
if (strrpos($inner, ",") !== false) {
@ -241,6 +243,7 @@ class ObjectSerializer
}
return $deserialized;
} elseif (strcasecmp(substr($class, -2), '[]') === 0) {
$data = is_string($data) ? json_decode($data) : $data;
$subClass = substr($class, 0, -2);
$values = [];
foreach ($data as $key => $value) {
@ -290,6 +293,7 @@ class ObjectSerializer
}
return $data;
} else {
$data = is_string($data) ? json_decode($data) : $data;
// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {

View File

@ -154,9 +154,6 @@ class AnotherFakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -172,9 +169,6 @@ class AnotherFakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -242,9 +236,6 @@ class AnotherFakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -150,9 +150,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('bool' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -168,9 +165,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -238,9 +232,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -416,9 +407,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -434,9 +422,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -504,9 +489,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -682,9 +664,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('float' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -700,9 +679,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -770,9 +746,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -948,9 +921,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -966,9 +936,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1036,9 +1003,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1663,9 +1627,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1681,9 +1642,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1751,9 +1709,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -154,9 +154,6 @@ class FakeClassnameTags123Api
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -172,9 +169,6 @@ class FakeClassnameTags123Api
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -242,9 +236,6 @@ class FakeClassnameTags123Api
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -614,9 +614,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -632,9 +629,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -702,9 +696,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -898,9 +889,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -916,9 +904,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -986,9 +971,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1182,9 +1164,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Pet' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1200,9 +1179,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1270,9 +1246,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1941,9 +1914,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1959,9 +1929,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2033,9 +2000,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2245,9 +2209,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2263,9 +2224,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2337,9 +2295,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -376,9 +376,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('map[string,int]' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -394,9 +391,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -462,9 +456,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -645,9 +636,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Order' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -663,9 +651,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -733,9 +718,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -933,9 +915,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Order' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -951,9 +930,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1021,9 +997,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -1035,9 +1035,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\User' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1053,9 +1050,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1123,9 +1117,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1318,9 +1309,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1336,9 +1324,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1408,9 +1393,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -230,6 +230,8 @@ class ObjectSerializer
if (null === $data) {
return null;
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
$data = is_string($data) ? json_decode($data) : $data;
settype($data, 'array');
$inner = substr($class, 4, -1);
$deserialized = [];
if (strrpos($inner, ",") !== false) {
@ -241,6 +243,7 @@ class ObjectSerializer
}
return $deserialized;
} elseif (strcasecmp(substr($class, -2), '[]') === 0) {
$data = is_string($data) ? json_decode($data) : $data;
$subClass = substr($class, 0, -2);
$values = [];
foreach ($data as $key => $value) {
@ -290,6 +293,7 @@ class ObjectSerializer
}
return $data;
} else {
$data = is_string($data) ? json_decode($data) : $data;
// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {

View File

@ -154,9 +154,6 @@ class AnotherFakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -172,9 +169,6 @@ class AnotherFakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -242,9 +236,6 @@ class AnotherFakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -150,9 +150,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('bool' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -168,9 +165,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -238,9 +232,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -416,9 +407,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -434,9 +422,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -504,9 +489,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -682,9 +664,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('float' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -700,9 +679,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -770,9 +746,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -948,9 +921,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -966,9 +936,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1036,9 +1003,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1663,9 +1627,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1681,9 +1642,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1751,9 +1709,6 @@ class FakeApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -154,9 +154,6 @@ class FakeClassnameTags123Api
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -172,9 +169,6 @@ class FakeClassnameTags123Api
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -242,9 +236,6 @@ class FakeClassnameTags123Api
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -614,9 +614,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -632,9 +629,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -702,9 +696,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -898,9 +889,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -916,9 +904,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -986,9 +971,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1182,9 +1164,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Pet' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1200,9 +1179,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1270,9 +1246,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1941,9 +1914,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1959,9 +1929,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2033,9 +2000,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2245,9 +2209,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2263,9 +2224,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -2337,9 +2295,6 @@ class PetApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -376,9 +376,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('map[string,int]' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -394,9 +391,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -462,9 +456,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -645,9 +636,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Order' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -663,9 +651,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -733,9 +718,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -933,9 +915,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\Order' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -951,9 +930,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1021,9 +997,6 @@ class StoreApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -1035,9 +1035,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('\OpenAPI\Client\Model\User' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1053,9 +1050,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1123,9 +1117,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1318,9 +1309,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('string' !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1336,9 +1324,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
@ -1408,9 +1393,6 @@ class UserApi
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [

View File

@ -230,6 +230,8 @@ class ObjectSerializer
if (null === $data) {
return null;
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
$data = is_string($data) ? json_decode($data) : $data;
settype($data, 'array');
$inner = substr($class, 4, -1);
$deserialized = [];
if (strrpos($inner, ",") !== false) {
@ -241,6 +243,7 @@ class ObjectSerializer
}
return $deserialized;
} elseif (strcasecmp(substr($class, -2), '[]') === 0) {
$data = is_string($data) ? json_decode($data) : $data;
$subClass = substr($class, 0, -2);
$values = [];
foreach ($data as $key => $value) {
@ -290,6 +293,7 @@ class ObjectSerializer
}
return $data;
} else {
$data = is_string($data) ? json_decode($data) : $data;
// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {