[java] improve petstore tests with openapi v3 spec (#16447)

* regenerate tests in jersey2-java8 client

* update samples

* fix java google api client tests

* update java resteasy to use v3 spec for tests

* update java vertx to test with v3 spec

* update java resttemplate to test with v3 spec

* add new files

* regenerate jersey1 tests
This commit is contained in:
William Cheng
2023-08-30 12:33:01 +08:00
committed by GitHub
parent 611a60411b
commit 8386a6eaaf
615 changed files with 22444 additions and 10026 deletions

View File

@@ -4,15 +4,19 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem |
| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | |
| [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint |
| [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication |
| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | |
| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | |
| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | |
| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | |
| [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | |
| [**testBodyWithBinary**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | |
| [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | |
| [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | |
| [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model |
| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 |
| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 |
| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters |
| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) |
| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties |
@@ -21,13 +25,13 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
## createXmlItem
## fakeBigDecimalMap
> createXmlItem(xmlItem)
> FakeBigDecimalMap200Response fakeBigDecimalMap()
creates an XmlItem
this route creates an XmlItem
for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys
### Example
@@ -45,11 +49,135 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body
try {
apiInstance.createXmlItem(xmlItem);
FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#createXmlItem");
System.err.println("Exception when calling FakeApi#fakeBigDecimalMap");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
## fakeHealthGet
> HealthCheckResult fakeHealthGet()
Health check endpoint
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
try {
HealthCheckResult result = apiInstance.fakeHealthGet();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeHealthGet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**HealthCheckResult**](HealthCheckResult.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | The instance started successfully | - |
## fakeHttpSignatureTest
> fakeHttpSignatureTest(pet, query1, header1)
test http signature authentication
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
String query1 = "query1_example"; // String | query parameter
String header1 = "header1_example"; // String | header parameter
try {
apiInstance.fakeHttpSignatureTest(pet, query1, header1);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeHttpSignatureTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
@@ -64,7 +192,9 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | |
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | |
| **query1** | **String**| query parameter | [optional] |
| **header1** | **String**| header parameter | [optional] |
### Return type
@@ -72,18 +202,18 @@ null (empty response body)
### Authorization
No authorization required
[http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
| **200** | The instance started successfully | - |
## fakeOuterBooleanSerialize
@@ -142,7 +272,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
@@ -154,7 +284,7 @@ No authorization required
## fakeOuterCompositeSerialize
> OuterComposite fakeOuterCompositeSerialize(body)
> OuterComposite fakeOuterCompositeSerialize(outerComposite)
@@ -176,9 +306,9 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body
OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body
try {
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body);
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize");
@@ -196,7 +326,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] |
| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] |
### Return type
@@ -208,7 +338,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
@@ -274,7 +404,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
@@ -340,7 +470,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: */*
@@ -350,13 +480,13 @@ No authorization required
| **200** | Output string | - |
## testBodyWithFileSchema
## fakePropertyEnumIntegerSerialize
> testBodyWithFileSchema(body)
> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty)
For this test, the body for this request much reference a schema named `File`.
Test serialization of enum (int) properties with examples
### Example
@@ -374,9 +504,140 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass |
OuterObjectWithEnumProperty outerObjectWithEnumProperty = new OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
try {
apiInstance.testBodyWithFileSchema(body);
OuterObjectWithEnumProperty result = apiInstance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakePropertyEnumIntegerSerialize");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | |
### Return type
[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Output enum (int) | - |
## testBodyWithBinary
> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
File body = new File("/path/to/file"); // File | image to upload
try {
apiInstance.testBodyWithBinary(body);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithBinary");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | **File**| image to upload | |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success | - |
## testBodyWithFileSchema
> testBodyWithFileSchema(fileSchemaTestClass)
For this test, the body for this request must reference a schema named `File`.
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass |
try {
apiInstance.testBodyWithFileSchema(fileSchemaTestClass);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithFileSchema");
System.err.println("Status code: " + e.getCode());
@@ -393,7 +654,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | |
| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | |
### Return type
@@ -417,7 +678,7 @@ No authorization required
## testBodyWithQueryParams
> testBodyWithQueryParams(query, body)
> testBodyWithQueryParams(query, user)
@@ -438,9 +699,9 @@ public class Example {
FakeApi apiInstance = new FakeApi(defaultClient);
String query = "query_example"; // String |
User body = new User(); // User |
User user = new User(); // User |
try {
apiInstance.testBodyWithQueryParams(query, body);
apiInstance.testBodyWithQueryParams(query, user);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithQueryParams");
System.err.println("Status code: " + e.getCode());
@@ -458,7 +719,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **query** | **String**| | |
| **body** | [**User**](User.md)| | |
| **user** | [**User**](User.md)| | |
### Return type
@@ -482,7 +743,7 @@ No authorization required
## testClientModel
> Client testClientModel(body)
> Client testClientModel(client)
To test \"client\" model
@@ -504,9 +765,9 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
Client body = new Client(); // Client | client model
Client client = new Client(); // Client | client model
try {
Client result = apiInstance.testClientModel(body);
Client result = apiInstance.testClientModel(client);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testClientModel");
@@ -524,7 +785,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**Client**](Client.md)| client model | |
| **client** | [**Client**](Client.md)| client model | |
### Return type
@@ -550,9 +811,9 @@ No authorization required
> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
### Example
@@ -646,7 +907,7 @@ null (empty response body)
## testEnumParameters
> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)
> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString)
To test enum parameters
@@ -674,10 +935,11 @@ public class Example {
String enumQueryString = "_abc"; // String | Query parameter enum test (string)
Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double)
Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double)
List<EnumClass> enumQueryModelArray = Arrays.asList(-efg); // List<EnumClass> |
List<String> enumFormStringArray = Arrays.asList("$"); // List<String> | Form parameter enum test (string array)
String enumFormString = "_abc"; // String | Form parameter enum test (string)
try {
apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEnumParameters");
System.err.println("Status code: " + e.getCode());
@@ -700,6 +962,7 @@ public class Example {
| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] |
| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] |
| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] |
| **enumQueryModelArray** | [**List&lt;EnumClass&gt;**](EnumClass.md)| | [optional] |
| **enumFormStringArray** | [**List&lt;String&gt;**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] |
| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] |
@@ -739,6 +1002,7 @@ Fake endpoint to test group parameters (optional)
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
@@ -746,6 +1010,10 @@ public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure HTTP bearer authorization: bearer_test
HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test");
bearer_test.setBearerToken("BEARER TOKEN");
FakeApi apiInstance = new FakeApi(defaultClient);
Integer requiredStringGroup = 56; // Integer | Required String in group parameters
@@ -785,7 +1053,7 @@ null (empty response body)
### Authorization
No authorization required
[bearer_test](../README.md#bearer_test)
### HTTP request headers
@@ -801,10 +1069,12 @@ No authorization required
## testInlineAdditionalProperties
> testInlineAdditionalProperties(param)
> testInlineAdditionalProperties(requestBody)
test inline additionalProperties
### Example
```java
@@ -821,9 +1091,9 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
Map<String, String> param = new HashMap(); // Map<String, String> | request body
Map<String, String> requestBody = new HashMap(); // Map<String, String> | request body
try {
apiInstance.testInlineAdditionalProperties(param);
apiInstance.testInlineAdditionalProperties(requestBody);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties");
System.err.println("Status code: " + e.getCode());
@@ -840,7 +1110,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **param** | [**Map&lt;String, String&gt;**](String.md)| request body | |
| **requestBody** | [**Map&lt;String, String&gt;**](String.md)| request body | |
### Return type
@@ -868,6 +1138,8 @@ No authorization required
test json serialization of form data
### Example
```java
@@ -929,7 +1201,7 @@ No authorization required
## testQueryParameterCollectionFormat
> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context)
> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language)
@@ -956,8 +1228,10 @@ public class Example {
List<String> http = Arrays.asList(); // List<String> |
List<String> url = Arrays.asList(); // List<String> |
List<String> context = Arrays.asList(); // List<String> |
String allowEmpty = "allowEmpty_example"; // String |
Map<String, String> language = new HashMap(); // Map<String, String> |
try {
apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat");
System.err.println("Status code: " + e.getCode());
@@ -979,6 +1253,8 @@ public class Example {
| **http** | [**List&lt;String&gt;**](String.md)| | |
| **url** | [**List&lt;String&gt;**](String.md)| | |
| **context** | [**List&lt;String&gt;**](String.md)| | |
| **allowEmpty** | **String**| | |
| **language** | [**Map&lt;String, String&gt;**](String.md)| | [optional] |
### Return type