[PHP] check if json_decode was able to decode response (#16879)

* [PHP] check if json_decode was able to decode response

* use try/catch to check if json_decode failed
This commit is contained in:
Artur Neumann 2023-10-31 13:37:33 +05:45 committed by GitHub
parent 08d518319e
commit 6cd73eba2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 692 additions and 134 deletions

View File

@ -162,7 +162,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/servers}} {{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
* *
* @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}}
{{#isDeprecated}} {{#isDeprecated}}
@ -221,7 +221,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/servers}} {{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
* *
* @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings)
{{#isDeprecated}} {{#isDeprecated}}
@ -279,7 +279,19 @@ use {{invokerPackage}}\ObjectSerializer;
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('{{{dataType}}}' !== 'string') { if ('{{{dataType}}}' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -300,7 +312,19 @@ use {{invokerPackage}}\ObjectSerializer;
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }

View File

@ -130,7 +130,7 @@ class AnotherFakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required) * @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Client * @return \OpenAPI\Client\Model\Client
*/ */
@ -148,7 +148,7 @@ class AnotherFakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required) * @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -198,7 +198,19 @@ class AnotherFakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Client' !== 'string') { if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -215,7 +227,19 @@ class AnotherFakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }

View File

@ -127,7 +127,7 @@ class DefaultApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\FooGetDefaultResponse * @return \OpenAPI\Client\Model\FooGetDefaultResponse
*/ */
@ -142,7 +142,7 @@ class DefaultApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\FooGetDefaultResponse, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\FooGetDefaultResponse, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -192,7 +192,19 @@ class DefaultApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\FooGetDefaultResponse' !== 'string') { if ('\OpenAPI\Client\Model\FooGetDefaultResponse' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -209,7 +221,19 @@ class DefaultApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }

View File

@ -185,7 +185,7 @@ class FakeApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\FakeBigDecimalMap200Response * @return \OpenAPI\Client\Model\FakeBigDecimalMap200Response
*/ */
@ -200,7 +200,7 @@ class FakeApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\FakeBigDecimalMap200Response, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\FakeBigDecimalMap200Response, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -250,7 +250,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\FakeBigDecimalMap200Response' !== 'string') { if ('\OpenAPI\Client\Model\FakeBigDecimalMap200Response' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -267,7 +279,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -442,7 +466,7 @@ class FakeApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHealthGet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHealthGet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\HealthCheckResult * @return \OpenAPI\Client\Model\HealthCheckResult
*/ */
@ -459,7 +483,7 @@ class FakeApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHealthGet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHealthGet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\HealthCheckResult, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\HealthCheckResult, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -509,7 +533,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\HealthCheckResult' !== 'string') { if ('\OpenAPI\Client\Model\HealthCheckResult' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -526,7 +562,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -708,7 +756,7 @@ class FakeApi
* @param string $header_1 header parameter (optional) * @param string $header_1 header parameter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHttpSignatureTest'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHttpSignatureTest'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -727,7 +775,7 @@ class FakeApi
* @param string $header_1 header parameter (optional) * @param string $header_1 header parameter (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHttpSignatureTest'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeHttpSignatureTest'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -957,7 +1005,7 @@ class FakeApi
* @param bool $body Input boolean as post body (optional) * @param bool $body Input boolean as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterBooleanSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterBooleanSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return bool * @return bool
*/ */
@ -973,7 +1021,7 @@ class FakeApi
* @param bool $body Input boolean as post body (optional) * @param bool $body Input boolean as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterBooleanSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterBooleanSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of bool, HTTP status code, HTTP response headers (array of strings) * @return array of bool, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1023,7 +1071,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('bool' !== 'string') { if ('bool' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1040,7 +1100,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1225,7 +1297,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterCompositeSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterCompositeSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\OuterComposite * @return \OpenAPI\Client\Model\OuterComposite
*/ */
@ -1241,7 +1313,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional) * @param \OpenAPI\Client\Model\OuterComposite $outer_composite Input composite as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterCompositeSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterCompositeSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\OuterComposite, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\OuterComposite, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1291,7 +1363,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') { if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1308,7 +1392,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1493,7 +1589,7 @@ class FakeApi
* @param float $body Input number as post body (optional) * @param float $body Input number as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterNumberSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterNumberSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return float * @return float
*/ */
@ -1509,7 +1605,7 @@ class FakeApi
* @param float $body Input number as post body (optional) * @param float $body Input number as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterNumberSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterNumberSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of float, HTTP status code, HTTP response headers (array of strings) * @return array of float, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1559,7 +1655,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('float' !== 'string') { if ('float' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1576,7 +1684,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1761,7 +1881,7 @@ class FakeApi
* @param string $body Input string as post body (optional) * @param string $body Input string as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterStringSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterStringSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return string * @return string
*/ */
@ -1777,7 +1897,7 @@ class FakeApi
* @param string $body Input string as post body (optional) * @param string $body Input string as post body (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterStringSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeOuterStringSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings) * @return array of string, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1827,7 +1947,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('string' !== 'string') { if ('string' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1844,7 +1976,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -2029,7 +2173,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required) * @param \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakePropertyEnumIntegerSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakePropertyEnumIntegerSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\OuterObjectWithEnumProperty * @return \OpenAPI\Client\Model\OuterObjectWithEnumProperty
*/ */
@ -2045,7 +2189,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required) * @param \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakePropertyEnumIntegerSerialize'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakePropertyEnumIntegerSerialize'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\OuterObjectWithEnumProperty, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\OuterObjectWithEnumProperty, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -2095,7 +2239,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\OuterObjectWithEnumProperty' !== 'string') { if ('\OpenAPI\Client\Model\OuterObjectWithEnumProperty' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -2112,7 +2268,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -2309,7 +2477,7 @@ class FakeApi
* @param string $http_debug_option http debug option (to test parameter naming option) (required) * @param string $http_debug_option http debug option (to test parameter naming option) (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterNameMapping'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterNameMapping'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -2330,7 +2498,7 @@ class FakeApi
* @param string $http_debug_option http debug option (to test parameter naming option) (required) * @param string $http_debug_option http debug option (to test parameter naming option) (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterNameMapping'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getParameterNameMapping'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -2602,7 +2770,7 @@ class FakeApi
* @param \SplFileObject $body image to upload (required) * @param \SplFileObject $body image to upload (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithBinary'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithBinary'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -2617,7 +2785,7 @@ class FakeApi
* @param \SplFileObject $body image to upload (required) * @param \SplFileObject $body image to upload (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithBinary'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithBinary'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -2822,7 +2990,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class file_schema_test_class (required) * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class file_schema_test_class (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithFileSchema'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithFileSchema'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -2837,7 +3005,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required) * @param \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithFileSchema'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithFileSchema'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -3043,7 +3211,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\User $user user (required) * @param \OpenAPI\Client\Model\User $user user (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -3059,7 +3227,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\User $user (required) * @param \OpenAPI\Client\Model\User $user (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyWithQueryParams'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -3285,7 +3453,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required) * @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClientModel'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClientModel'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Client * @return \OpenAPI\Client\Model\Client
*/ */
@ -3303,7 +3471,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required) * @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClientModel'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClientModel'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -3353,7 +3521,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Client' !== 'string') { if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -3370,7 +3550,19 @@ class FakeApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -3580,7 +3772,7 @@ class FakeApi
* @param string $callback None (optional) * @param string $callback None (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEndpointParameters'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEndpointParameters'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -3610,7 +3802,7 @@ class FakeApi
* @param string $callback None (optional) * @param string $callback None (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEndpointParameters'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEndpointParameters'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -3999,7 +4191,7 @@ class FakeApi
* @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg') * @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumParameters'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumParameters'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -4024,7 +4216,7 @@ class FakeApi
* @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg') * @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg')
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumParameters'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumParameters'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -4325,7 +4517,7 @@ class FakeApi
* @param int $int64_group Integer in group parameters (optional) * @param int $int64_group Integer in group parameters (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testGroupParameters'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testGroupParameters'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -4349,7 +4541,7 @@ class FakeApi
* @param int $int64_group Integer in group parameters (optional) * @param int $int64_group Integer in group parameters (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testGroupParameters'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testGroupParameters'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -4647,7 +4839,7 @@ class FakeApi
* @param array<string,string> $request_body request body (required) * @param array<string,string> $request_body request body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineAdditionalProperties'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineAdditionalProperties'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -4664,7 +4856,7 @@ class FakeApi
* @param array<string,string> $request_body request body (required) * @param array<string,string> $request_body request body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineAdditionalProperties'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineAdditionalProperties'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -4875,7 +5067,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required) * @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -4892,7 +5084,7 @@ class FakeApi
* @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required) * @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -5104,7 +5296,7 @@ class FakeApi
* @param string $param2 field2 (required) * @param string $param2 field2 (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testJsonFormData'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testJsonFormData'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -5122,7 +5314,7 @@ class FakeApi
* @param string $param2 field2 (required) * @param string $param2 field2 (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testJsonFormData'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testJsonFormData'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -5348,7 +5540,7 @@ class FakeApi
* @param array<string,string> $language language (optional) * @param array<string,string> $language language (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryParameterCollectionFormat'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryParameterCollectionFormat'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -5369,7 +5561,7 @@ class FakeApi
* @param array<string,string> $language (optional) * @param array<string,string> $language (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryParameterCollectionFormat'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryParameterCollectionFormat'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */

View File

@ -130,7 +130,7 @@ class FakeClassnameTags123Api
* @param \OpenAPI\Client\Model\Client $client client model (required) * @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Client * @return \OpenAPI\Client\Model\Client
*/ */
@ -148,7 +148,7 @@ class FakeClassnameTags123Api
* @param \OpenAPI\Client\Model\Client $client client model (required) * @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -198,7 +198,19 @@ class FakeClassnameTags123Api
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Client' !== 'string') { if ('\OpenAPI\Client\Model\Client' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -215,7 +227,19 @@ class FakeClassnameTags123Api
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }

View File

@ -174,7 +174,7 @@ class PetApi
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array. * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -209,7 +209,7 @@ class PetApi
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array. * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addPet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -531,7 +531,7 @@ class PetApi
* @param string $api_key api_key (optional) * @param string $api_key api_key (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -549,7 +549,7 @@ class PetApi
* @param string $api_key (optional) * @param string $api_key (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -773,7 +773,7 @@ class PetApi
* @param string[] $status Status values that need to be considered for filter (required) (deprecated) * @param string[] $status Status values that need to be considered for filter (required) (deprecated)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByStatus'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByStatus'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Pet[] * @return \OpenAPI\Client\Model\Pet[]
*/ */
@ -791,7 +791,7 @@ class PetApi
* @param string[] $status Status values that need to be considered for filter (required) (deprecated) * @param string[] $status Status values that need to be considered for filter (required) (deprecated)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByStatus'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByStatus'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings)
*/ */
@ -841,7 +841,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -858,7 +870,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1061,7 +1085,7 @@ class PetApi
* @param string[] $tags Tags to filter by (required) * @param string[] $tags Tags to filter by (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByTags'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByTags'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Pet[] * @return \OpenAPI\Client\Model\Pet[]
* @deprecated * @deprecated
@ -1080,7 +1104,7 @@ class PetApi
* @param string[] $tags Tags to filter by (required) * @param string[] $tags Tags to filter by (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByTags'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['findPetsByTags'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings)
* @deprecated * @deprecated
@ -1131,7 +1155,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { if ('\OpenAPI\Client\Model\Pet[]' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1148,7 +1184,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1354,7 +1402,7 @@ class PetApi
* @param int $pet_id ID of pet to return (required) * @param int $pet_id ID of pet to return (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPetById'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPetById'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Pet * @return \OpenAPI\Client\Model\Pet
*/ */
@ -1372,7 +1420,7 @@ class PetApi
* @param int $pet_id ID of pet to return (required) * @param int $pet_id ID of pet to return (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPetById'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPetById'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1422,7 +1470,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Pet' !== 'string') { if ('\OpenAPI\Client\Model\Pet' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1439,7 +1499,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1660,7 +1732,7 @@ class PetApi
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array. * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -1695,7 +1767,7 @@ class PetApi
* @param array $variables Associative array of variables to pass to the host. Defaults to empty array. * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePet'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePet'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -2018,7 +2090,7 @@ class PetApi
* @param string $status Updated status of the pet (optional) * @param string $status Updated status of the pet (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePetWithForm'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePetWithForm'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -2037,7 +2109,7 @@ class PetApi
* @param string $status Updated status of the pet (optional) * @param string $status Updated status of the pet (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePetWithForm'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePetWithForm'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -2271,7 +2343,7 @@ class PetApi
* @param \SplFileObject $file file to upload (optional) * @param \SplFileObject $file file to upload (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFile'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFile'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\ApiResponse * @return \OpenAPI\Client\Model\ApiResponse
*/ */
@ -2291,7 +2363,7 @@ class PetApi
* @param \SplFileObject $file file to upload (optional) * @param \SplFileObject $file file to upload (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFile'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFile'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -2341,7 +2413,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -2358,7 +2442,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -2586,7 +2682,7 @@ class PetApi
* @param string $additional_metadata Additional data to pass to server (optional) * @param string $additional_metadata Additional data to pass to server (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFileWithRequiredFile'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFileWithRequiredFile'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\ApiResponse * @return \OpenAPI\Client\Model\ApiResponse
*/ */
@ -2606,7 +2702,7 @@ class PetApi
* @param string $additional_metadata Additional data to pass to server (optional) * @param string $additional_metadata Additional data to pass to server (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFileWithRequiredFile'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadFileWithRequiredFile'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -2656,7 +2752,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -2673,7 +2781,19 @@ class PetApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }

View File

@ -139,7 +139,7 @@ class StoreApi
* @param string $order_id ID of the order that needs to be deleted (required) * @param string $order_id ID of the order that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -156,7 +156,7 @@ class StoreApi
* @param string $order_id ID of the order that needs to be deleted (required) * @param string $order_id ID of the order that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -367,7 +367,7 @@ class StoreApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array<string,int> * @return array<string,int>
*/ */
@ -384,7 +384,7 @@ class StoreApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of array<string,int>, HTTP status code, HTTP response headers (array of strings) * @return array of array<string,int>, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -434,7 +434,19 @@ class StoreApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('array<string,int>' !== 'string') { if ('array<string,int>' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -451,7 +463,19 @@ class StoreApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -636,7 +660,7 @@ class StoreApi
* @param int $order_id ID of pet that needs to be fetched (required) * @param int $order_id ID of pet that needs to be fetched (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Order * @return \OpenAPI\Client\Model\Order
*/ */
@ -654,7 +678,7 @@ class StoreApi
* @param int $order_id ID of pet that needs to be fetched (required) * @param int $order_id ID of pet that needs to be fetched (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -704,7 +728,19 @@ class StoreApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Order' !== 'string') { if ('\OpenAPI\Client\Model\Order' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -721,7 +757,19 @@ class StoreApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -925,7 +973,7 @@ class StoreApi
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\Order * @return \OpenAPI\Client\Model\Order
*/ */
@ -943,7 +991,7 @@ class StoreApi
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required) * @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -993,7 +1041,19 @@ class StoreApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Order' !== 'string') { if ('\OpenAPI\Client\Model\Order' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1010,7 +1070,19 @@ class StoreApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }

View File

@ -151,7 +151,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Created user object (required) * @param \OpenAPI\Client\Model\User $user Created user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -168,7 +168,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Created user object (required) * @param \OpenAPI\Client\Model\User $user Created user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -379,7 +379,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required) * @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -396,7 +396,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required) * @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -607,7 +607,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required) * @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -624,7 +624,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required) * @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -835,7 +835,7 @@ class UserApi
* @param string $username The name that needs to be deleted (required) * @param string $username The name that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -852,7 +852,7 @@ class UserApi
* @param string $username The name that needs to be deleted (required) * @param string $username The name that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1064,7 +1064,7 @@ class UserApi
* @param string $username The name that needs to be fetched. Use user1 for testing. (required) * @param string $username The name that needs to be fetched. Use user1 for testing. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return \OpenAPI\Client\Model\User * @return \OpenAPI\Client\Model\User
*/ */
@ -1082,7 +1082,7 @@ class UserApi
* @param string $username The name that needs to be fetched. Use user1 for testing. (required) * @param string $username The name that needs to be fetched. Use user1 for testing. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of \OpenAPI\Client\Model\User, HTTP status code, HTTP response headers (array of strings) * @return array of \OpenAPI\Client\Model\User, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1132,7 +1132,19 @@ class UserApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\User' !== 'string') { if ('\OpenAPI\Client\Model\User' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1149,7 +1161,19 @@ class UserApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1348,7 +1372,7 @@ class UserApi
* @param string $password The password for login in clear text (required) * @param string $password The password for login in clear text (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return string * @return string
*/ */
@ -1367,7 +1391,7 @@ class UserApi
* @param string $password The password for login in clear text (required) * @param string $password The password for login in clear text (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings) * @return array of string, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1417,7 +1441,19 @@ class UserApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ('string' !== 'string') { if ('string' !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1434,7 +1470,19 @@ class UserApi
} else { } else {
$content = (string) $response->getBody(); $content = (string) $response->getBody();
if ($returnType !== 'string') { if ($returnType !== 'string') {
$content = json_decode($content); try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
throw new ApiException(
sprintf(
'Error JSON decoding server response (%s)',
$request->getUri()
),
$statusCode,
$response->getHeaders(),
$content
);
}
} }
} }
@ -1651,7 +1699,7 @@ class UserApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -1667,7 +1715,7 @@ class UserApi
* *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */
@ -1862,7 +1910,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Updated user object (required) * @param \OpenAPI\Client\Model\User $user Updated user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return void * @return void
*/ */
@ -1880,7 +1928,7 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Updated user object (required) * @param \OpenAPI\Client\Model\User $user Updated user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation
* *
* @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \OpenAPI\Client\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings) * @return array of null, HTTP status code, HTTP response headers (array of strings)
*/ */

View File

@ -2,10 +2,12 @@
namespace OpenAPI\Client; namespace OpenAPI\Client;
use GuzzleHttp\Psr7\Response;
use OpenAPI\Client\Api\FakeApi; use OpenAPI\Client\Api\FakeApi;
use OpenAPI\Client\Api\PetApi; use OpenAPI\Client\Api\PetApi;
use OpenAPI\Client\Model\Pet; use OpenAPI\Client\Model\Pet;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
require_once __DIR__ . '/FakeHttpClient.php'; require_once __DIR__ . '/FakeHttpClient.php';
@ -17,6 +19,7 @@ class AuthTest extends TestCase
$authConfig->setApiKey('api_key', '123qwe'); $authConfig->setApiKey('api_key', '123qwe');
$fakeHttpClient = new FakeHttpClient(); $fakeHttpClient = new FakeHttpClient();
$fakeHttpClient->setResponse(new Response(200, [], json_encode([])));
$api = new PetApi($fakeHttpClient, $authConfig); $api = new PetApi($fakeHttpClient, $authConfig);
$api->getPetById(123); $api->getPetById(123);

View File

@ -2,6 +2,7 @@
namespace OpenAPI\Client; namespace OpenAPI\Client;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/FakeHttpClient.php'; require_once __DIR__ . '/FakeHttpClient.php';
@ -14,6 +15,7 @@ class HeadersTest extends TestCase
public function setUp(): void public function setUp(): void
{ {
$this->fakeHttpClient = new FakeHttpClient(); $this->fakeHttpClient = new FakeHttpClient();
$this->fakeHttpClient->setResponse(new Response(200, [], json_encode([])));
} }
public function testUserAgent() public function testUserAgent()

View File

@ -89,4 +89,29 @@ class ResponseTypesTest extends TestCase
$this->assertNull($result); $this->assertNull($result);
} }
public function invalidJSONResponseProvider()
{
return [
'status 200, content empty' => [200, ''],
'status 200, content leading comma' => [200, '{"key": "value",}'],
'status 200, content just text' => [200, 'invalid JSON'],
'status 200, content null' => [200, null],
'status 204, content empty' => [204, ''],
'status 204, content leading comma' => [204, '{"key": "value",}'],
'status 204, content just text' => [204, 'invalid JSON'],
'status 204, content null' => [204, null],
];
}
/**
* @dataProvider invalidJSONResponseProvider
*/
public function testNotJSONResponse($statusCode, $responseBody)
{
$this->expectExceptionCode($statusCode);
$this->expectException(\OpenAPI\Client\ApiException::class);
$this->fakeHttpClient->setResponse(new Response($statusCode, [], $responseBody));
$this->api->getPetById(123);
}
} }