Skip to content

Commit 1c8493d

Browse files
committed
Add tests for no response body exception
1 parent 313dbb8 commit 1c8493d

12 files changed

Lines changed: 2060 additions & 0 deletions

File tree

modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,23 @@ paths:
13811381
$ref: '#/components/schemas/ErrorResponse'
13821382
requestBody:
13831383
$ref: '#/components/requestBodies/Pet'
1384+
/fake/with_4xx_range_response_no_4xx_datatype/endpoint:
1385+
post:
1386+
tags:
1387+
- fake
1388+
summary: test endpoint with 400-499 range response http code without dataType
1389+
operationId: fake-with_4xx_range_response_no_4xx_datatype-endpoint
1390+
responses:
1391+
200:
1392+
description: Valid status value
1393+
content:
1394+
application/json:
1395+
schema:
1396+
$ref: '#/components/schemas/Pet'
1397+
'4xx':
1398+
description: Range of HTTP code 400-499
1399+
requestBody:
1400+
$ref: '#/components/requestBodies/Pet'
13841401
/fake/with_400_and_4xx_range_response/endpoint:
13851402
post:
13861403
tags:
@@ -1408,6 +1425,25 @@ paths:
14081425
$ref: '#/components/schemas/ErrorResponse'
14091426
requestBody:
14101427
$ref: '#/components/requestBodies/Pet'
1428+
/fake/with_400_and_4xx_range_response_no_4xx_datatype/endpoint:
1429+
post:
1430+
tags:
1431+
- fake
1432+
summary: test endpoint with 400 and 400-499 range response http code without dataType
1433+
operationId: fake-with_400_and_4xx_range_response_no_4xx_datatype-endpoint
1434+
responses:
1435+
200:
1436+
description: Valid status value
1437+
content:
1438+
application/json:
1439+
schema:
1440+
$ref: '#/components/schemas/Pet'
1441+
'400':
1442+
description: Invalid status value
1443+
'4xx':
1444+
description: Range of HTTP code 400-499
1445+
requestBody:
1446+
$ref: '#/components/requestBodies/Pet'
14111447
servers:
14121448
- url: 'http://{server}.swagger.io:{port}/v2'
14131449
description: petstore server

modules/openapi-generator/src/test/resources/3_0/php/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,23 @@ paths:
14361436
$ref: '#/components/schemas/ErrorResponse'
14371437
requestBody:
14381438
$ref: '#/components/requestBodies/Pet'
1439+
/fake/with_4xx_range_response_no_4xx_datatype/endpoint:
1440+
post:
1441+
tags:
1442+
- fake
1443+
summary: test endpoint with 400-499 range response http code without dataType
1444+
operationId: fake-with_4xx_range_response_no_4xx_datatype-endpoint
1445+
responses:
1446+
200:
1447+
description: Valid status value
1448+
content:
1449+
application/json:
1450+
schema:
1451+
$ref: '#/components/schemas/Pet'
1452+
'4xx':
1453+
description: Range of HTTP code 400-499
1454+
requestBody:
1455+
$ref: '#/components/requestBodies/Pet'
14391456
/fake/with_400_and_4xx_range_response/endpoint:
14401457
post:
14411458
tags:
@@ -1463,6 +1480,25 @@ paths:
14631480
$ref: '#/components/schemas/ErrorResponse'
14641481
requestBody:
14651482
$ref: '#/components/requestBodies/Pet'
1483+
/fake/with_400_and_4xx_range_response_no_4xx_datatype/endpoint:
1484+
post:
1485+
tags:
1486+
- fake
1487+
summary: test endpoint with 400 and 400-499 range response http code without dataType
1488+
operationId: fake-with_400_and_4xx_range_response_no_4xx_datatype-endpoint
1489+
responses:
1490+
200:
1491+
description: Valid status value
1492+
content:
1493+
application/json:
1494+
schema:
1495+
$ref: '#/components/schemas/Pet'
1496+
'400':
1497+
description: Invalid status value
1498+
'4xx':
1499+
description: Range of HTTP code 400-499
1500+
requestBody:
1501+
$ref: '#/components/requestBodies/Pet'
14661502
servers:
14671503
- url: 'http://{server}.swagger.io:{port}/v2'
14681504
description: petstore server

samples/client/petstore/php-nextgen/OpenAPIClient-php/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ Class | Method | HTTP request | Description
8383
*FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
8484
*FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int |
8585
*FakeApi* | [**fakeWith400And4xxRangeResponseEndpoint**](docs/Api/FakeApi.md#fakewith400and4xxrangeresponseendpoint) | **POST** /fake/with_400_and_4xx_range_response/endpoint | test endpoint with 400 and 400-499 range response http code with dataType
86+
*FakeApi* | [**fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint**](docs/Api/FakeApi.md#fakewith400and4xxrangeresponseno4xxdatatypeendpoint) | **POST** /fake/with_400_and_4xx_range_response_no_4xx_datatype/endpoint | test endpoint with 400 and 400-499 range response http code without dataType
8687
*FakeApi* | [**fakeWith400ResponseEndpoint**](docs/Api/FakeApi.md#fakewith400responseendpoint) | **POST** /fake/with_400_response/endpoint | test endpoint with 400 response http code with dataType
8788
*FakeApi* | [**fakeWith4xxRangeResponseEndpoint**](docs/Api/FakeApi.md#fakewith4xxrangeresponseendpoint) | **POST** /fake/with_4xx_range_response/endpoint | test endpoint with 400-499 range response http code with dataType
89+
*FakeApi* | [**fakeWith4xxRangeResponseNo4xxDatatypeEndpoint**](docs/Api/FakeApi.md#fakewith4xxrangeresponseno4xxdatatypeendpoint) | **POST** /fake/with_4xx_range_response_no_4xx_datatype/endpoint | test endpoint with 400-499 range response http code without dataType
8890
*FakeApi* | [**testAdditionalPropertiesReference**](docs/Api/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties
8991
*FakeApi* | [**testBodyWithBinary**](docs/Api/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary |
9092
*FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema |

samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati
1414
| [**fakeOuterStringSerialize()**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | |
1515
| [**fakePropertyEnumIntegerSerialize()**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | |
1616
| [**fakeWith400And4xxRangeResponseEndpoint()**](FakeApi.md#fakeWith400And4xxRangeResponseEndpoint) | **POST** /fake/with_400_and_4xx_range_response/endpoint | test endpoint with 400 and 400-499 range response http code with dataType |
17+
| [**fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint()**](FakeApi.md#fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint) | **POST** /fake/with_400_and_4xx_range_response_no_4xx_datatype/endpoint | test endpoint with 400 and 400-499 range response http code without dataType |
1718
| [**fakeWith400ResponseEndpoint()**](FakeApi.md#fakeWith400ResponseEndpoint) | **POST** /fake/with_400_response/endpoint | test endpoint with 400 response http code with dataType |
1819
| [**fakeWith4xxRangeResponseEndpoint()**](FakeApi.md#fakeWith4xxRangeResponseEndpoint) | **POST** /fake/with_4xx_range_response/endpoint | test endpoint with 400-499 range response http code with dataType |
20+
| [**fakeWith4xxRangeResponseNo4xxDatatypeEndpoint()**](FakeApi.md#fakeWith4xxRangeResponseNo4xxDatatypeEndpoint) | **POST** /fake/with_4xx_range_response_no_4xx_datatype/endpoint | test endpoint with 400-499 range response http code without dataType |
1921
| [**testAdditionalPropertiesReference()**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties |
2022
| [**testBodyWithBinary()**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | |
2123
| [**testBodyWithFileSchema()**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | |
@@ -587,6 +589,60 @@ No authorization required
587589
[[Back to Model list]](../../README.md#models)
588590
[[Back to README]](../../README.md)
589591

592+
## `fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint()`
593+
594+
```php
595+
fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint($pet): \OpenAPI\Client\Model\Pet
596+
```
597+
598+
test endpoint with 400 and 400-499 range response http code without dataType
599+
600+
### Example
601+
602+
```php
603+
<?php
604+
require_once(__DIR__ . '/vendor/autoload.php');
605+
606+
607+
608+
$apiInstance = new OpenAPI\Client\Api\FakeApi(
609+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
610+
// This is optional, `GuzzleHttp\Client` will be used as default.
611+
new GuzzleHttp\Client()
612+
);
613+
$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store
614+
615+
try {
616+
$result = $apiInstance->fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint($pet);
617+
print_r($result);
618+
} catch (Exception $e) {
619+
echo 'Exception when calling FakeApi->fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint: ', $e->getMessage(), PHP_EOL;
620+
}
621+
```
622+
623+
### Parameters
624+
625+
| Name | Type | Description | Notes |
626+
| ------------- | ------------- | ------------- | ------------- |
627+
| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | |
628+
629+
### Return type
630+
631+
[**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)
632+
633+
### Authorization
634+
635+
No authorization required
636+
637+
### HTTP request headers
638+
639+
- **Content-Type**: `application/json`, `application/xml`
640+
- **Accept**: `application/json`
641+
642+
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
643+
[[Back to Model list]](../../README.md#models)
644+
[[Back to README]](../../README.md)
645+
590646
## `fakeWith400ResponseEndpoint()`
591647

592648
```php
@@ -695,6 +751,60 @@ No authorization required
695751
[[Back to Model list]](../../README.md#models)
696752
[[Back to README]](../../README.md)
697753

754+
## `fakeWith4xxRangeResponseNo4xxDatatypeEndpoint()`
755+
756+
```php
757+
fakeWith4xxRangeResponseNo4xxDatatypeEndpoint($pet): \OpenAPI\Client\Model\Pet
758+
```
759+
760+
test endpoint with 400-499 range response http code without dataType
761+
762+
### Example
763+
764+
```php
765+
<?php
766+
require_once(__DIR__ . '/vendor/autoload.php');
767+
768+
769+
770+
$apiInstance = new OpenAPI\Client\Api\FakeApi(
771+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
772+
// This is optional, `GuzzleHttp\Client` will be used as default.
773+
new GuzzleHttp\Client()
774+
);
775+
$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store
776+
777+
try {
778+
$result = $apiInstance->fakeWith4xxRangeResponseNo4xxDatatypeEndpoint($pet);
779+
print_r($result);
780+
} catch (Exception $e) {
781+
echo 'Exception when calling FakeApi->fakeWith4xxRangeResponseNo4xxDatatypeEndpoint: ', $e->getMessage(), PHP_EOL;
782+
}
783+
```
784+
785+
### Parameters
786+
787+
| Name | Type | Description | Notes |
788+
| ------------- | ------------- | ------------- | ------------- |
789+
| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | |
790+
791+
### Return type
792+
793+
[**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)
794+
795+
### Authorization
796+
797+
No authorization required
798+
799+
### HTTP request headers
800+
801+
- **Content-Type**: `application/json`, `application/xml`
802+
- **Accept**: `application/json`
803+
804+
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
805+
[[Back to Model list]](../../README.md#models)
806+
[[Back to README]](../../README.md)
807+
698808
## `testAdditionalPropertiesReference()`
699809

700810
```php

0 commit comments

Comments
 (0)