Skip to content

Commit b3ac83d

Browse files
committed
refactor java tests
1 parent 73a24f0 commit b3ac83d

7 files changed

Lines changed: 65 additions & 283 deletions

File tree

modules/openapi-generator/src/test/resources/3_0/enum-implements.yaml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,64 @@ paths:
1717
type: array
1818
items:
1919
$ref: '#/components/schemas/Pony'
20+
/fake/null-request-body:
21+
get:
22+
summary: to ensure null request body wont' throw exception
23+
operationId: null-request-body
24+
parameters:
25+
- name: Accept-Language
26+
in: header
27+
schema:
28+
type: string
29+
example: application/json
30+
requestBody:
31+
content:
32+
text/plain:
33+
examples:
34+
Generar Orden por External ID:
35+
value: |-
36+
{
37+
"external_reference": "{{external_order_ref}}",
38+
"notification_url": "www.yourserver.com/yourendpoint",
39+
"sponsor_id": 446566691,
40+
"items": [
41+
{
42+
"title": "Papas frita",
43+
"currency_id": "{{currency_id}}",
44+
"unit_price": 6000,
45+
"quantity": 1
46+
},
47+
{
48+
"title": "Gaseosa",
49+
"currency_id": "{{currency_id}}",
50+
"unit_price": 3000,
51+
"quantity": 1
52+
}
53+
]/*,
54+
"taxes": [
55+
{
56+
"value": 0,
57+
"type": "IVA"
58+
}
59+
]*/
60+
}
61+
responses:
62+
'200':
63+
description: ''
64+
/myExample:
65+
get:
66+
responses:
67+
'200':
68+
description: Response
69+
content:
70+
application/json:
71+
schema:
72+
oneOf:
73+
- type: array
74+
items:
75+
"$ref": "#/components/schemas/OneOf1"
76+
- type: object
77+
"$ref": "#/components/schemas/OneOf1"
2078
components:
2179
schemas:
2280
Pony:
@@ -30,4 +88,9 @@ components:
3088
enum:
3189
- Earth
3290
- Pegasi
33-
- Unicorn
91+
- Unicorn
92+
OneOf1:
93+
type: object
94+
properties:
95+
message1:
96+
type: string

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

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,52 +1297,6 @@ paths:
12971297
responses:
12981298
200:
12991299
description: OK
1300-
/fake/null-request-body:
1301-
get:
1302-
tags:
1303-
- another_fake
1304-
summary: null request body
1305-
operationId: null-request-body
1306-
parameters:
1307-
- name: Accept-Language
1308-
in: header
1309-
schema:
1310-
type: string
1311-
example: application/json
1312-
requestBody:
1313-
content:
1314-
text/plain:
1315-
examples:
1316-
Generar Orden por External ID:
1317-
value: |-
1318-
{
1319-
"external_reference": "{{external_order_ref}}",
1320-
"notification_url": "www.yourserver.com/yourendpoint",
1321-
"sponsor_id": 446566691,
1322-
"items": [
1323-
{
1324-
"title": "Papas frita",
1325-
"currency_id": "{{currency_id}}",
1326-
"unit_price": 6000,
1327-
"quantity": 1
1328-
},
1329-
{
1330-
"title": "Gaseosa",
1331-
"currency_id": "{{currency_id}}",
1332-
"unit_price": 3000,
1333-
"quantity": 1
1334-
}
1335-
]/*,
1336-
"taxes": [
1337-
{
1338-
"value": 0,
1339-
"type": "IVA"
1340-
}
1341-
]*/
1342-
}
1343-
responses:
1344-
'200':
1345-
description: ''
13461300
'/fake/pet/{petId}/uploadImage':
13471301
post:
13481302
tags:

modules/openapi-generator/src/test/resources/3_0/oneOf_array.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ paths:
1515
- type: array
1616
items:
1717
"$ref": "#/components/schemas/OneOf1"
18-
- type: object
19-
"$ref": "#/components/schemas/OneOf1"
18+
- "$ref": "#/components/schemas/OneOf1"
2019
components:
2120
schemas:
2221
OneOf1:

samples/client/petstore/java/okhttp-gson/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ Class | Method | HTTP request | Description
117117
*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
118118
*AnotherFakeApi* | [**getParameterArrayNumber**](docs/AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value
119119
*AnotherFakeApi* | [**getParameterStringNumber**](docs/AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number
120-
*AnotherFakeApi* | [**nullRequestBody**](docs/AnotherFakeApi.md#nullRequestBody) | **GET** /fake/null-request-body | null request body
121120
*DefaultApi* | [**fakeAnyOfWIthSameErasureGet**](docs/DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure |
122121
*DefaultApi* | [**fakeFreeFormQueryParametersGet**](docs/DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters |
123122
*DefaultApi* | [**fakeOneOfWIthSameErasureGet**](docs/DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure |

samples/client/petstore/java/okhttp-gson/api/openapi.yaml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,57 +1404,6 @@ paths:
14041404
- another_fake
14051405
x-accepts:
14061406
- application/json
1407-
/fake/null-request-body:
1408-
get:
1409-
operationId: null-request-body
1410-
parameters:
1411-
- explode: false
1412-
in: header
1413-
name: Accept-Language
1414-
required: false
1415-
schema:
1416-
example: application/json
1417-
type: string
1418-
style: simple
1419-
requestBody:
1420-
content:
1421-
text/plain:
1422-
examples:
1423-
Generar Orden por External ID:
1424-
value: |-
1425-
{
1426-
"external_reference": "{{external_order_ref}}",
1427-
"notification_url": "www.yourserver.com/yourendpoint",
1428-
"sponsor_id": 446566691,
1429-
"items": [
1430-
{
1431-
"title": "Papas frita",
1432-
"currency_id": "{{currency_id}}",
1433-
"unit_price": 6000,
1434-
"quantity": 1
1435-
},
1436-
{
1437-
"title": "Gaseosa",
1438-
"currency_id": "{{currency_id}}",
1439-
"unit_price": 3000,
1440-
"quantity": 1
1441-
}
1442-
]/*,
1443-
"taxes": [
1444-
{
1445-
"value": 0,
1446-
"type": "IVA"
1447-
}
1448-
]*/
1449-
}
1450-
responses:
1451-
"200":
1452-
description: ""
1453-
summary: null request body
1454-
tags:
1455-
- another_fake
1456-
x-accepts:
1457-
- application/json
14581407
/fake/pet/{petId}/uploadImage:
14591408
post:
14601409
description: ""

samples/client/petstore/java/okhttp-gson/docs/AnotherFakeApi.md

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
77
| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags |
88
| [**getParameterArrayNumber**](AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value |
99
| [**getParameterStringNumber**](AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number |
10-
| [**nullRequestBody**](AnotherFakeApi.md#nullRequestBody) | **GET** /fake/null-request-body | null request body |
1110

1211

1312
<a id="call123testSpecialTags"></a>
@@ -190,62 +189,3 @@ No authorization required
190189
|-------------|-------------|------------------|
191190
| **200** | OK | - |
192191

193-
<a id="nullRequestBody"></a>
194-
# **nullRequestBody**
195-
> nullRequestBody(acceptLanguage)
196-
197-
null request body
198-
199-
### Example
200-
```java
201-
// Import classes:
202-
import org.openapitools.client.ApiClient;
203-
import org.openapitools.client.ApiException;
204-
import org.openapitools.client.Configuration;
205-
import org.openapitools.client.models.*;
206-
import org.openapitools.client.api.AnotherFakeApi;
207-
208-
public class Example {
209-
public static void main(String[] args) {
210-
ApiClient defaultClient = Configuration.getDefaultApiClient();
211-
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
212-
213-
AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
214-
String acceptLanguage = "application/json"; // String |
215-
try {
216-
apiInstance.nullRequestBody(acceptLanguage);
217-
} catch (ApiException e) {
218-
System.err.println("Exception when calling AnotherFakeApi#nullRequestBody");
219-
System.err.println("Status code: " + e.getCode());
220-
System.err.println("Reason: " + e.getResponseBody());
221-
System.err.println("Response headers: " + e.getResponseHeaders());
222-
e.printStackTrace();
223-
}
224-
}
225-
}
226-
```
227-
228-
### Parameters
229-
230-
| Name | Type | Description | Notes |
231-
|------------- | ------------- | ------------- | -------------|
232-
| **acceptLanguage** | **String**| | [optional] |
233-
234-
### Return type
235-
236-
null (empty response body)
237-
238-
### Authorization
239-
240-
No authorization required
241-
242-
### HTTP request headers
243-
244-
- **Content-Type**: text/plain
245-
- **Accept**: Not defined
246-
247-
### HTTP response details
248-
| Status code | Description | Response headers |
249-
|-------------|-------------|------------------|
250-
| **200** | | - |
251-

0 commit comments

Comments
 (0)