Skip to content

Commit e5b451d

Browse files
committed
Finalize tests
1 parent 79cc0af commit e5b451d

40 files changed

Lines changed: 392 additions & 11 deletions

modules/openapi-generator/src/main/resources/php-nextgen/api.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use GuzzleHttp\Psr7\MultipartStream;
2626
use GuzzleHttp\Psr7\Request;
2727
use GuzzleHttp\RequestOptions;
2828
use GuzzleHttp\Promise\PromiseInterface;
29+
use Psr\Http\Message\RequestInterface;
2930
use Psr\Http\Message\ResponseInterface;
3031
use {{invokerPackage}}\ApiException;
3132
use {{invokerPackage}}\Configuration;
@@ -296,6 +297,7 @@ use {{invokerPackage}}\ObjectSerializer;
296297
{{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
297298
return $this->handleResponseWithDataType(
298299
'{{{dataType}}}',
300+
$request,
299301
$response,
300302
);{{/isRange}}
301303
{{/dataType}}
@@ -307,6 +309,7 @@ use {{invokerPackage}}\ObjectSerializer;
307309
if ($this->responseWithinRangeCode('{{code}}', $statusCode)) {
308310
return $this->handleResponseWithDataType(
309311
'{{{dataType}}}',
312+
$request,
310313
$response,
311314
);
312315
}{{/isWildcard}}{{/isRange}}{{/dataType}}{{/responses}}
@@ -326,6 +329,7 @@ use {{invokerPackage}}\ObjectSerializer;
326329

327330
return $this->handleResponseWithDataType(
328331
'{{{returnType}}}',
332+
$request,
329333
$response,
330334
);
331335
{{/returnType}}
@@ -912,6 +916,7 @@ use {{invokerPackage}}\ObjectSerializer;
912916

913917
private function handleResponseWithDataType(
914918
string $dataType,
919+
RequestInterface $request,
915920
ResponseInterface $response,
916921
): array {
917922
if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {

modules/openapi-generator/src/main/resources/php/api.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use GuzzleHttp\Exception\RequestException;
2525
use GuzzleHttp\Psr7\MultipartStream;
2626
use GuzzleHttp\Psr7\Request;
2727
use GuzzleHttp\RequestOptions;
28+
use Psr\Http\Message\RequestInterface;
2829
use Psr\Http\Message\ResponseInterface;
2930
use {{invokerPackage}}\ApiException;
3031
use {{invokerPackage}}\Configuration;
@@ -265,6 +266,7 @@ use {{invokerPackage}}\ObjectSerializer;
265266
{{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
266267
return $this->handleResponseWithDataType(
267268
'{{{dataType}}}',
269+
$request,
268270
$response,
269271
);{{/isRange}}
270272
{{/dataType}}
@@ -276,6 +278,7 @@ use {{invokerPackage}}\ObjectSerializer;
276278
{{#responses}}{{#dataType}}{{#isRange}}{{^isWildcard}}if ($this->responseWithinRangeCode('{{code}}', $statusCode)) {
277279
return $this->handleResponseWithDataType(
278280
'{{{dataType}}}',
281+
$request,
279282
$response,
280283
);
281284
}{{/isWildcard}}{{/isRange}}{{/dataType}}{{/responses}}
@@ -295,6 +298,7 @@ use {{invokerPackage}}\ObjectSerializer;
295298

296299
return $this->handleResponseWithDataType(
297300
'{{{returnType}}}',
301+
$request,
298302
$response,
299303
);
300304
{{/returnType}}
@@ -835,6 +839,7 @@ use {{invokerPackage}}\ObjectSerializer;
835839

836840
private function handleResponseWithDataType(
837841
string $dataType,
842+
RequestInterface $request,
838843
ResponseInterface $response
839844
): array {
840845
if ($dataType === '\SplFileObject') {

modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ use function sprintf;
275275
{{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
276276
return $this->handleResponseWithDataType(
277277
'{{{dataType}}}',
278+
$request,
278279
$response,
279280
);{{/isRange}}
280281
{{/dataType}}
@@ -286,6 +287,7 @@ use function sprintf;
286287
{{#responses}}{{#dataType}}{{#isRange}}{{^isWildcard}}if ($this->responseWithinRangeCode('{{code}}', $statusCode)) {
287288
return $this->handleResponseWithDataType(
288289
'{{{dataType}}}',
290+
$request,
289291
$response,
290292
);
291293
}{{/isWildcard}}{{/isRange}}{{/dataType}}{{/responses}}
@@ -305,6 +307,7 @@ use function sprintf;
305307

306308
return $this->handleResponseWithDataType(
307309
'{{{returnType}}}',
310+
$request,
308311
$response,
309312
);
310313
{{/returnType}}
@@ -789,6 +792,7 @@ use function sprintf;
789792

790793
private function handleResponseWithDataType(
791794
string $dataType,
795+
RequestInterface $request,
792796
ResponseInterface $response
793797
): array {
794798
if ($dataType === '\SplFileObject') {

samples/client/echo_api/php-nextgen-streaming/src/Api/AuthApi.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use GuzzleHttp\Psr7\Request;
3737
use GuzzleHttp\RequestOptions;
3838
use GuzzleHttp\Promise\PromiseInterface;
39+
use Psr\Http\Message\RequestInterface;
3940
use Psr\Http\Message\ResponseInterface;
4041
use OpenAPI\Client\ApiException;
4142
use OpenAPI\Client\Configuration;
@@ -189,6 +190,7 @@ public function testAuthHttpBasicWithHttpInfo(
189190
case 200:
190191
return $this->handleResponseWithDataType(
191192
'string',
193+
$request,
192194
$response,
193195
);
194196
}
@@ -209,6 +211,7 @@ public function testAuthHttpBasicWithHttpInfo(
209211

210212
return $this->handleResponseWithDataType(
211213
'string',
214+
$request,
212215
$response,
213216
);
214217
} catch (ApiException $e) {
@@ -446,6 +449,7 @@ public function testAuthHttpBearerWithHttpInfo(
446449
case 200:
447450
return $this->handleResponseWithDataType(
448451
'string',
452+
$request,
449453
$response,
450454
);
451455
}
@@ -466,6 +470,7 @@ public function testAuthHttpBearerWithHttpInfo(
466470

467471
return $this->handleResponseWithDataType(
468472
'string',
473+
$request,
469474
$response,
470475
);
471476
} catch (ApiException $e) {
@@ -662,6 +667,7 @@ protected function createHttpClientOption(): array
662667

663668
private function handleResponseWithDataType(
664669
string $dataType,
670+
RequestInterface $request,
665671
ResponseInterface $response,
666672
): array {
667673
if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {

samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use GuzzleHttp\Psr7\Request;
3737
use GuzzleHttp\RequestOptions;
3838
use GuzzleHttp\Promise\PromiseInterface;
39+
use Psr\Http\Message\RequestInterface;
3940
use Psr\Http\Message\ResponseInterface;
4041
use OpenAPI\Client\ApiException;
4142
use OpenAPI\Client\Configuration;
@@ -213,6 +214,7 @@ public function testBinaryGifWithHttpInfo(
213214
case 200:
214215
return $this->handleResponseWithDataType(
215216
'\Psr\Http\Message\StreamInterface',
217+
$request,
216218
$response,
217219
);
218220
}
@@ -233,6 +235,7 @@ public function testBinaryGifWithHttpInfo(
233235

234236
return $this->handleResponseWithDataType(
235237
'\Psr\Http\Message\StreamInterface',
238+
$request,
236239
$response,
237240
);
238241
} catch (ApiException $e) {
@@ -470,6 +473,7 @@ public function testBodyApplicationOctetstreamBinaryWithHttpInfo(
470473
case 200:
471474
return $this->handleResponseWithDataType(
472475
'string',
476+
$request,
473477
$response,
474478
);
475479
}
@@ -490,6 +494,7 @@ public function testBodyApplicationOctetstreamBinaryWithHttpInfo(
490494

491495
return $this->handleResponseWithDataType(
492496
'string',
497+
$request,
493498
$response,
494499
);
495500
} catch (ApiException $e) {
@@ -741,6 +746,7 @@ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(
741746
case 200:
742747
return $this->handleResponseWithDataType(
743748
'string',
749+
$request,
744750
$response,
745751
);
746752
}
@@ -761,6 +767,7 @@ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(
761767

762768
return $this->handleResponseWithDataType(
763769
'string',
770+
$request,
764771
$response,
765772
);
766773
} catch (ApiException $e) {
@@ -1025,6 +1032,7 @@ public function testBodyMultipartFormdataSingleBinaryWithHttpInfo(
10251032
case 200:
10261033
return $this->handleResponseWithDataType(
10271034
'string',
1035+
$request,
10281036
$response,
10291037
);
10301038
}
@@ -1045,6 +1053,7 @@ public function testBodyMultipartFormdataSingleBinaryWithHttpInfo(
10451053

10461054
return $this->handleResponseWithDataType(
10471055
'string',
1056+
$request,
10481057
$response,
10491058
);
10501059
} catch (ApiException $e) {
@@ -1303,6 +1312,7 @@ public function testEchoBodyAllOfPetWithHttpInfo(
13031312
case 200:
13041313
return $this->handleResponseWithDataType(
13051314
'\OpenAPI\Client\Model\Pet',
1315+
$request,
13061316
$response,
13071317
);
13081318
}
@@ -1323,6 +1333,7 @@ public function testEchoBodyAllOfPetWithHttpInfo(
13231333

13241334
return $this->handleResponseWithDataType(
13251335
'\OpenAPI\Client\Model\Pet',
1336+
$request,
13261337
$response,
13271338
);
13281339
} catch (ApiException $e) {
@@ -1574,6 +1585,7 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo(
15741585
case 200:
15751586
return $this->handleResponseWithDataType(
15761587
'string',
1588+
$request,
15771589
$response,
15781590
);
15791591
}
@@ -1594,6 +1606,7 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo(
15941606

15951607
return $this->handleResponseWithDataType(
15961608
'string',
1609+
$request,
15971610
$response,
15981611
);
15991612
} catch (ApiException $e) {
@@ -1845,6 +1858,7 @@ public function testEchoBodyPetWithHttpInfo(
18451858
case 200:
18461859
return $this->handleResponseWithDataType(
18471860
'\OpenAPI\Client\Model\Pet',
1861+
$request,
18481862
$response,
18491863
);
18501864
}
@@ -1865,6 +1879,7 @@ public function testEchoBodyPetWithHttpInfo(
18651879

18661880
return $this->handleResponseWithDataType(
18671881
'\OpenAPI\Client\Model\Pet',
1882+
$request,
18681883
$response,
18691884
);
18701885
} catch (ApiException $e) {
@@ -2116,6 +2131,7 @@ public function testEchoBodyPetResponseStringWithHttpInfo(
21162131
case 200:
21172132
return $this->handleResponseWithDataType(
21182133
'string',
2134+
$request,
21192135
$response,
21202136
);
21212137
}
@@ -2136,6 +2152,7 @@ public function testEchoBodyPetResponseStringWithHttpInfo(
21362152

21372153
return $this->handleResponseWithDataType(
21382154
'string',
2155+
$request,
21392156
$response,
21402157
);
21412158
} catch (ApiException $e) {
@@ -2387,6 +2404,7 @@ public function testEchoBodyStringEnumWithHttpInfo(
23872404
case 200:
23882405
return $this->handleResponseWithDataType(
23892406
'\OpenAPI\Client\Model\StringEnumRef',
2407+
$request,
23902408
$response,
23912409
);
23922410
}
@@ -2407,6 +2425,7 @@ public function testEchoBodyStringEnumWithHttpInfo(
24072425

24082426
return $this->handleResponseWithDataType(
24092427
'\OpenAPI\Client\Model\StringEnumRef',
2428+
$request,
24102429
$response,
24112430
);
24122431
} catch (ApiException $e) {
@@ -2658,6 +2677,7 @@ public function testEchoBodyTagResponseStringWithHttpInfo(
26582677
case 200:
26592678
return $this->handleResponseWithDataType(
26602679
'string',
2680+
$request,
26612681
$response,
26622682
);
26632683
}
@@ -2678,6 +2698,7 @@ public function testEchoBodyTagResponseStringWithHttpInfo(
26782698

26792699
return $this->handleResponseWithDataType(
26802700
'string',
2701+
$request,
26812702
$response,
26822703
);
26832704
} catch (ApiException $e) {
@@ -2884,6 +2905,7 @@ protected function createHttpClientOption(): array
28842905

28852906
private function handleResponseWithDataType(
28862907
string $dataType,
2908+
RequestInterface $request,
28872909
ResponseInterface $response,
28882910
): array {
28892911
if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {

samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use GuzzleHttp\Psr7\Request;
3737
use GuzzleHttp\RequestOptions;
3838
use GuzzleHttp\Promise\PromiseInterface;
39+
use Psr\Http\Message\RequestInterface;
3940
use Psr\Http\Message\ResponseInterface;
4041
use OpenAPI\Client\ApiException;
4142
use OpenAPI\Client\Configuration;
@@ -204,6 +205,7 @@ public function testFormIntegerBooleanStringWithHttpInfo(
204205
case 200:
205206
return $this->handleResponseWithDataType(
206207
'string',
208+
$request,
207209
$response,
208210
);
209211
}
@@ -224,6 +226,7 @@ public function testFormIntegerBooleanStringWithHttpInfo(
224226

225227
return $this->handleResponseWithDataType(
226228
'string',
229+
$request,
227230
$response,
228231
);
229232
} catch (ApiException $e) {
@@ -494,6 +497,7 @@ public function testFormObjectMultipartWithHttpInfo(
494497
case 200:
495498
return $this->handleResponseWithDataType(
496499
'string',
500+
$request,
497501
$response,
498502
);
499503
}
@@ -514,6 +518,7 @@ public function testFormObjectMultipartWithHttpInfo(
514518

515519
return $this->handleResponseWithDataType(
516520
'string',
521+
$request,
517522
$response,
518523
);
519524
} catch (ApiException $e) {
@@ -788,6 +793,7 @@ public function testFormOneofWithHttpInfo(
788793
case 200:
789794
return $this->handleResponseWithDataType(
790795
'string',
796+
$request,
791797
$response,
792798
);
793799
}
@@ -808,6 +814,7 @@ public function testFormOneofWithHttpInfo(
808814

809815
return $this->handleResponseWithDataType(
810816
'string',
817+
$request,
811818
$response,
812819
);
813820
} catch (ApiException $e) {
@@ -1066,6 +1073,7 @@ protected function createHttpClientOption(): array
10661073

10671074
private function handleResponseWithDataType(
10681075
string $dataType,
1076+
RequestInterface $request,
10691077
ResponseInterface $response,
10701078
): array {
10711079
if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {

0 commit comments

Comments
 (0)