-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
28 changed files
with
51 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
samples/client/petstore-security-test/php/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.2.1-SNAPSHOT | ||
3.2.1-SNAPSHOT |
23 changes: 23 additions & 0 deletions
23
samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
1 change: 1 addition & 0 deletions
1
samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.2.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =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 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =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 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =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 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =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 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =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 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =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 | ||
*/ | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: [email protected] *_/ ' \" =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 @@ public static function deserialize($data, $class, $httpHeaders = null) | |
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 @@ public static function deserialize($data, $class, $httpHeaders = null) | |
} | ||
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 @@ public static function deserialize($data, $class, $httpHeaders = null) | |
} | ||
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})) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.