[java][native] Add tests for oneOf form parameters (#16487)

* add tests for oneOf form parameters

* update samples
This commit is contained in:
William Cheng
2023-09-03 16:15:54 +08:00
committed by GitHub
parent 69c3f567ce
commit ebc9bcda44
23 changed files with 1601 additions and 0 deletions

View File

@@ -113,6 +113,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
*BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
*FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
*FormApi* | [**testFormOneof**](docs/FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
*HeaderApi* | [**testHeaderIntegerBooleanString**](docs/HeaderApi.md#testHeaderIntegerBooleanString) | **GET** /header/integer/boolean/string | Test header parameter(s)
*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
*QueryApi* | [**testEnumRefString**](docs/QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s)

View File

@@ -62,6 +62,27 @@ paths:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/form/oneof:
post:
description: Test form parameter(s) for oneOf schema
operationId: test/form/oneof
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/test_form_oneof_request'
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test form parameter(s) for oneOf schema
tags:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/header/integer/boolean/string:
get:
description: Test header parameter(s)
@@ -667,6 +688,26 @@ components:
string_form:
type: string
type: object
test_form_oneof_request_oneOf:
properties:
form1:
type: string
form2:
type: integer
type: object
test_form_oneof_request_oneOf_1:
properties:
form3:
type: string
form4:
type: boolean
type: object
test_form_oneof_request:
oneOf:
- $ref: '#/components/schemas/test_form_oneof_request_oneOf'
- $ref: '#/components/schemas/test_form_oneof_request_oneOf_1'
- $ref: '#/components/schemas/Tag'
type: object
test_query_style_form_explode_true_array_string_query_object_parameter:
properties:
values:

View File

@@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) |
| [**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
@@ -77,3 +78,79 @@ No authorization required
|-------------|-------------|------------------|
| **200** | Successful operation | - |
## testFormOneof
> String testFormOneof(form1, form2, form3, form4, id, name)
Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema
### 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.FormApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
FormApi apiInstance = new FormApi(defaultClient);
String form1 = "form1_example"; // String |
Integer form2 = 56; // Integer |
String form3 = "form3_example"; // String |
Boolean form4 = true; // Boolean |
Long id = 56L; // Long |
String name = "name_example"; // String |
try {
String result = apiInstance.testFormOneof(form1, form2, form3, form4, id, name);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FormApi#testFormOneof");
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 |
|------------- | ------------- | ------------- | -------------|
| **form1** | **String**| | [optional] |
| **form2** | **Integer**| | [optional] |
| **form3** | **String**| | [optional] |
| **form4** | **Boolean**| | [optional] |
| **id** | **Long**| | [optional] |
| **name** | **String**| | [optional] |
### Return type
**String**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

View File

@@ -129,4 +129,95 @@ if (stringForm != null)
);
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @return String
* @throws ApiException if fails to make API call
*/
public String testFormOneof(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws ApiException {
return this.testFormOneof(form1, form2, form3, form4, id, name, Collections.emptyMap());
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @param additionalHeaders additionalHeaders for this call
* @return String
* @throws ApiException if fails to make API call
*/
public String testFormOneof(String form1, Integer form2, String form3, Boolean form4, Long id, String name, Map<String, String> additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/form/oneof";
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.putAll(additionalHeaders);
if (form1 != null)
localVarFormParams.put("form1", form1);
if (form2 != null)
localVarFormParams.put("form2", form2);
if (form3 != null)
localVarFormParams.put("form3", form3);
if (form4 != null)
localVarFormParams.put("form4", form4);
if (id != null)
localVarFormParams.put("id", id);
if (name != null)
localVarFormParams.put("name", name);
final String[] localVarAccepts = {
"text/plain"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/x-www-form-urlencoded"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(),
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
}

View File

@@ -62,6 +62,27 @@ paths:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/form/oneof:
post:
description: Test form parameter(s) for oneOf schema
operationId: test/form/oneof
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/test_form_oneof_request'
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test form parameter(s) for oneOf schema
tags:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/header/integer/boolean/string:
get:
description: Test header parameter(s)
@@ -667,6 +688,26 @@ components:
string_form:
type: string
type: object
test_form_oneof_request_oneOf:
properties:
form1:
type: string
form2:
type: integer
type: object
test_form_oneof_request_oneOf_1:
properties:
form3:
type: string
form4:
type: boolean
type: object
test_form_oneof_request:
oneOf:
- $ref: '#/components/schemas/test_form_oneof_request_oneOf'
- $ref: '#/components/schemas/test_form_oneof_request_oneOf_1'
- $ref: '#/components/schemas/Tag'
type: object
test_query_style_form_explode_true_array_string_query_object_parameter:
properties:
values:

View File

@@ -47,4 +47,43 @@ public interface FormApi extends ApiClient.Api {
ApiResponse<String> testFormIntegerBooleanStringWithHttpInfo(@Param("integer_form") Integer integerForm, @Param("boolean_form") Boolean booleanForm, @Param("string_form") String stringForm);
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @return String
*/
@RequestLine("POST /form/oneof")
@Headers({
"Content-Type: application/x-www-form-urlencoded",
"Accept: text/plain",
})
String testFormOneof(@Param("form1") String form1, @Param("form2") Integer form2, @Param("form3") String form3, @Param("form4") Boolean form4, @Param("id") Long id, @Param("name") String name);
/**
* Test form parameter(s) for oneOf schema
* Similar to <code>testFormOneof</code> but it also returns the http response headers .
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /form/oneof")
@Headers({
"Content-Type: application/x-www-form-urlencoded",
"Accept: text/plain",
})
ApiResponse<String> testFormOneofWithHttpInfo(@Param("form1") String form1, @Param("form2") Integer form2, @Param("form3") String form3, @Param("form4") Boolean form4, @Param("id") Long id, @Param("name") String name);
}

View File

@@ -120,6 +120,8 @@ Class | Method | HTTP request | Description
*BodyApi* | [**testEchoBodyTagResponseStringWithHttpInfo**](docs/BodyApi.md#testEchoBodyTagResponseStringWithHttpInfo) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
*FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
*FormApi* | [**testFormIntegerBooleanStringWithHttpInfo**](docs/FormApi.md#testFormIntegerBooleanStringWithHttpInfo) | **POST** /form/integer/boolean/string | Test form parameter(s)
*FormApi* | [**testFormOneof**](docs/FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
*FormApi* | [**testFormOneofWithHttpInfo**](docs/FormApi.md#testFormOneofWithHttpInfo) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
*HeaderApi* | [**testHeaderIntegerBooleanString**](docs/HeaderApi.md#testHeaderIntegerBooleanString) | **GET** /header/integer/boolean/string | Test header parameter(s)
*HeaderApi* | [**testHeaderIntegerBooleanStringWithHttpInfo**](docs/HeaderApi.md#testHeaderIntegerBooleanStringWithHttpInfo) | **GET** /header/integer/boolean/string | Test header parameter(s)
*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)

View File

@@ -62,6 +62,27 @@ paths:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/form/oneof:
post:
description: Test form parameter(s) for oneOf schema
operationId: test/form/oneof
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/test_form_oneof_request'
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test form parameter(s) for oneOf schema
tags:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/header/integer/boolean/string:
get:
description: Test header parameter(s)
@@ -667,6 +688,26 @@ components:
string_form:
type: string
type: object
test_form_oneof_request_oneOf:
properties:
form1:
type: string
form2:
type: integer
type: object
test_form_oneof_request_oneOf_1:
properties:
form3:
type: string
form4:
type: boolean
type: object
test_form_oneof_request:
oneOf:
- $ref: '#/components/schemas/test_form_oneof_request_oneOf'
- $ref: '#/components/schemas/test_form_oneof_request_oneOf_1'
- $ref: '#/components/schemas/Tag'
type: object
test_query_style_form_explode_true_array_string_query_object_parameter:
properties:
values:

View File

@@ -6,6 +6,8 @@ All URIs are relative to *http://localhost:3000*
|------------- | ------------- | -------------|
| [**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) |
| [**testFormIntegerBooleanStringWithHttpInfo**](FormApi.md#testFormIntegerBooleanStringWithHttpInfo) | **POST** /form/integer/boolean/string | Test form parameter(s) |
| [**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
| [**testFormOneofWithHttpInfo**](FormApi.md#testFormOneofWithHttpInfo) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
@@ -150,3 +152,157 @@ No authorization required
|-------------|-------------|------------------|
| **200** | Successful operation | - |
## testFormOneof
> String testFormOneof(form1, form2, form3, form4, id, name)
Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema
### 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.FormApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
FormApi apiInstance = new FormApi(defaultClient);
String form1 = "form1_example"; // String |
Integer form2 = 56; // Integer |
String form3 = "form3_example"; // String |
Boolean form4 = true; // Boolean |
Long id = 56L; // Long |
String name = "name_example"; // String |
try {
String result = apiInstance.testFormOneof(form1, form2, form3, form4, id, name);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FormApi#testFormOneof");
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 |
|------------- | ------------- | ------------- | -------------|
| **form1** | **String**| | [optional] |
| **form2** | **Integer**| | [optional] |
| **form3** | **String**| | [optional] |
| **form4** | **Boolean**| | [optional] |
| **id** | **Long**| | [optional] |
| **name** | **String**| | [optional] |
### Return type
**String**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
## testFormOneofWithHttpInfo
> ApiResponse<String> testFormOneof testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name)
Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FormApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
FormApi apiInstance = new FormApi(defaultClient);
String form1 = "form1_example"; // String |
Integer form2 = 56; // Integer |
String form3 = "form3_example"; // String |
Boolean form4 = true; // Boolean |
Long id = 56L; // Long |
String name = "name_example"; // String |
try {
ApiResponse<String> response = apiInstance.testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name);
System.out.println("Status code: " + response.getStatusCode());
System.out.println("Response headers: " + response.getHeaders());
System.out.println("Response body: " + response.getData());
} catch (ApiException e) {
System.err.println("Exception when calling FormApi#testFormOneof");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
System.err.println("Reason: " + e.getResponseBody());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **form1** | **String**| | [optional] |
| **form2** | **Integer**| | [optional] |
| **form3** | **String**| | [optional] |
| **form4** | **Boolean**| | [optional] |
| **id** | **Long**| | [optional] |
| **name** | **String**| | [optional] |
### Return type
ApiResponse<**String**>
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

View File

@@ -185,4 +185,118 @@ public class FormApi {
}
return localVarRequestBuilder;
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @return String
* @throws ApiException if fails to make API call
*/
public String testFormOneof(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws ApiException {
ApiResponse<String> localVarResponse = testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name);
return localVarResponse.getData();
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testFormOneofWithHttpInfo(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testFormOneofRequestBuilder(form1, form2, form3, form4, id, name);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("testFormOneof", localVarResponse);
}
// for plain text response
if (localVarResponse.headers().map().containsKey("Content-Type") &&
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
String responseBodyText = s.hasNext() ? s.next() : "";
return new ApiResponse<String>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBodyText
);
} else {
throw new RuntimeException("Error! The response Content-Type is supposed to be `text/plain` but it's not: " + localVarResponse);
}
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder testFormOneofRequestBuilder(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/form/oneof";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "text/plain");
List<NameValuePair> formValues = new ArrayList<>();
if (form1 != null) {
formValues.add(new BasicNameValuePair("form1", form1.toString()));
}
if (form2 != null) {
formValues.add(new BasicNameValuePair("form2", form2.toString()));
}
if (form3 != null) {
formValues.add(new BasicNameValuePair("form3", form3.toString()));
}
if (form4 != null) {
formValues.add(new BasicNameValuePair("form4", form4.toString()));
}
if (id != null) {
formValues.add(new BasicNameValuePair("id", id.toString()));
}
if (name != null) {
formValues.add(new BasicNameValuePair("name", name.toString()));
}
HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8);
ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream();
try {
entity.writeTo(formOutputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
localVarRequestBuilder
.header("Content-Type", entity.getContentType().getValue())
.method("POST", HttpRequest.BodyPublishers
.ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())));
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
}

View File

@@ -284,6 +284,18 @@ public class CustomTest {
Assert.assertEquals("3b\ninteger_form=1337&boolean_form=true&string_form=Hello+World\n0\n\n", p.body);
}
@Test
public void testFormOneOf() throws ApiException {
String form1 = "form1_example"; // String |
Integer form2 = 56; // Integer |
String form3 = "form3 example"; // String |
Boolean form4 = true;
String response = formApi.testFormOneof(form1, form2, form3, form4, null, null);
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
Assert.assertEquals("/form/oneof", p.path);
Assert.assertEquals("3c\nform1=form1_example&form2=56&form3=form3++example&form4=true\n0\n\n", p.body);
}
@Test
public void testBodyMultipartFormdataArrayOfBinary() throws ApiException {
File file1 = Objects.requireNonNull(getFile("Hello"));

View File

@@ -120,6 +120,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
*BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
*FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
*FormApi* | [**testFormOneof**](docs/FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
*HeaderApi* | [**testHeaderIntegerBooleanString**](docs/HeaderApi.md#testHeaderIntegerBooleanString) | **GET** /header/integer/boolean/string | Test header parameter(s)
*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
*QueryApi* | [**testEnumRefString**](docs/QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s)

View File

@@ -62,6 +62,27 @@ paths:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/form/oneof:
post:
description: Test form parameter(s) for oneOf schema
operationId: test/form/oneof
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/test_form_oneof_request'
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test form parameter(s) for oneOf schema
tags:
- form
x-content-type: application/x-www-form-urlencoded
x-accepts: text/plain
/header/integer/boolean/string:
get:
description: Test header parameter(s)
@@ -667,6 +688,26 @@ components:
string_form:
type: string
type: object
test_form_oneof_request_oneOf:
properties:
form1:
type: string
form2:
type: integer
type: object
test_form_oneof_request_oneOf_1:
properties:
form3:
type: string
form4:
type: boolean
type: object
test_form_oneof_request:
oneOf:
- $ref: '#/components/schemas/test_form_oneof_request_oneOf'
- $ref: '#/components/schemas/test_form_oneof_request_oneOf_1'
- $ref: '#/components/schemas/Tag'
type: object
test_query_style_form_explode_true_array_string_query_object_parameter:
properties:
values:

View File

@@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) |
| [**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
<a id="testFormIntegerBooleanString"></a>
@@ -73,3 +74,75 @@ No authorization required
|-------------|-------------|------------------|
| **200** | Successful operation | - |
<a id="testFormOneof"></a>
# **testFormOneof**
> String testFormOneof(form1, form2, form3, form4, id, name)
Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema
### 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.FormApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
FormApi apiInstance = new FormApi(defaultClient);
String form1 = "form1_example"; // String |
Integer form2 = 56; // Integer |
String form3 = "form3_example"; // String |
Boolean form4 = true; // Boolean |
Long id = 56L; // Long |
String name = "name_example"; // String |
try {
String result = apiInstance.testFormOneof(form1, form2, form3, form4, id, name);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FormApi#testFormOneof");
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 |
|------------- | ------------- | ------------- | -------------|
| **form1** | **String**| | [optional] |
| **form2** | **Integer**| | [optional] |
| **form3** | **String**| | [optional] |
| **form4** | **Boolean**| | [optional] |
| **id** | **Long**| | [optional] |
| **name** | **String**| | [optional] |
### Return type
**String**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

View File

@@ -209,4 +209,166 @@ public class FormApi {
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for testFormOneof
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
</table>
*/
public okhttp3.Call testFormOneofCall(String form1, Integer form2, String form3, Boolean form4, Long id, String name, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/form/oneof";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (form1 != null) {
localVarFormParams.put("form1", form1);
}
if (form2 != null) {
localVarFormParams.put("form2", form2);
}
if (form3 != null) {
localVarFormParams.put("form3", form3);
}
if (form4 != null) {
localVarFormParams.put("form4", form4);
}
if (id != null) {
localVarFormParams.put("id", id);
}
if (name != null) {
localVarFormParams.put("name", name);
}
final String[] localVarAccepts = {
"text/plain"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/x-www-form-urlencoded"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call testFormOneofValidateBeforeCall(String form1, Integer form2, String form3, Boolean form4, Long id, String name, final ApiCallback _callback) throws ApiException {
return testFormOneofCall(form1, form2, form3, form4, id, name, _callback);
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
</table>
*/
public String testFormOneof(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws ApiException {
ApiResponse<String> localVarResp = testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name);
return localVarResp.getData();
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @return ApiResponse&lt;String&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
</table>
*/
public ApiResponse<String> testFormOneofWithHttpInfo(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws ApiException {
okhttp3.Call localVarCall = testFormOneofValidateBeforeCall(form1, form2, form3, form4, id, name, null);
Type localVarReturnType = new TypeToken<String>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Test form parameter(s) for oneOf schema (asynchronously)
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> Successful operation </td><td> - </td></tr>
</table>
*/
public okhttp3.Call testFormOneofAsync(String form1, Integer form2, String form3, Boolean form4, Long id, String name, final ApiCallback<String> _callback) throws ApiException {
okhttp3.Call localVarCall = testFormOneofValidateBeforeCall(form1, form2, form3, form4, id, name, _callback);
Type localVarReturnType = new TypeToken<String>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
}