Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java RESTEasy client] updating test to use the Java RESTEasy echo api client (#17367) #17470

Merged
merged 3 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/configs/java-resteasy-echo.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
generatorName: java
outputDir: samples/client/petstore/java/resteasy-echo
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-echo.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-resteasy-echo
Expand Down
24 changes: 24 additions & 0 deletions modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,30 @@ paths:
schema:
type: string
format: binary
# Single binary in multipart mime test
/body/application/octetstream/single_binary:
post:
tags:
- body
summary: Test single binary in multipart mime
description: Test single binary in multipart mime
operationId: test/body/multipart/formdata/single_binary
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
my-file:
type: string
format: binary
responses:
'200':
description: Successful operation
content:
text/plain:
schema:
type: string
# Array of binary in multipart mime tests
/body/application/octetstream/array_of_binary:
post:
Expand Down
1 change: 1 addition & 0 deletions samples/client/echo_api/csharp-restsharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**TestBinaryGif**](docs/BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**TestBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*BodyApi* | [**TestBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*BodyApi* | [**TestBodyMultipartFormdataSingleBinary**](docs/BodyApi.md#testbodymultipartformdatasinglebinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
*BodyApi* | [**TestEchoBodyAllOfPet**](docs/BodyApi.md#testechobodyallofpet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*BodyApi* | [**TestEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
*BodyApi* | [**TestEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s)
Expand Down
25 changes: 25 additions & 0 deletions samples/client/echo_api/csharp-restsharp/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,25 @@ paths:
summary: Test binary (gif) response body
tags:
- body
/body/application/octetstream/single_binary:
post:
description: Test single binary in multipart mime
operationId: test/body/multipart/formdata/single_binary
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/test_body_multipart_formdata_single_binary_request'
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test single binary in multipart mime
tags:
- body
/body/application/octetstream/array_of_binary:
post:
description: Test array of binary in multipart mime
Expand Down Expand Up @@ -794,6 +813,12 @@ components:
allOf:
- $ref: '#/components/schemas/Bird'
- $ref: '#/components/schemas/Category'
test_body_multipart_formdata_single_binary_request:
properties:
my-file:
format: binary
type: string
type: object
test_body_multipart_formdata_array_of_binary_request:
properties:
files:
Expand Down
92 changes: 92 additions & 0 deletions samples/client/echo_api/csharp-restsharp/docs/BodyApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All URIs are relative to *http://localhost:3000*
| [**TestBinaryGif**](BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body |
| [**TestBodyApplicationOctetstreamBinary**](BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
| [**TestBodyMultipartFormdataArrayOfBinary**](BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
| [**TestBodyMultipartFormdataSingleBinary**](BodyApi.md#testbodymultipartformdatasinglebinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime |
| [**TestEchoBodyAllOfPet**](BodyApi.md#testechobodyallofpet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) |
| [**TestEchoBodyFreeFormObjectResponseString**](BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
| [**TestEchoBodyPet**](BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) |
Expand Down Expand Up @@ -274,6 +275,97 @@ No authorization required
- **Accept**: text/plain


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a id="testbodymultipartformdatasinglebinary"></a>
# **TestBodyMultipartFormdataSingleBinary**
> string TestBodyMultipartFormdataSingleBinary (System.IO.Stream? myFile = null)

Test single binary in multipart mime

Test single binary in multipart mime

### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
public class TestBodyMultipartFormdataSingleBinaryExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost:3000";
var apiInstance = new BodyApi(config);
var myFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream? | (optional)

try
{
// Test single binary in multipart mime
string result = apiInstance.TestBodyMultipartFormdataSingleBinary(myFile);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling BodyApi.TestBodyMultipartFormdataSingleBinary: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```

#### Using the TestBodyMultipartFormdataSingleBinaryWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.

```csharp
try
{
// Test single binary in multipart mime
ApiResponse<string> response = apiInstance.TestBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling BodyApi.TestBodyMultipartFormdataSingleBinaryWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```

### Parameters

| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **myFile** | **System.IO.Stream?****System.IO.Stream?** | | [optional] |

### Return type

**string**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: multipart/form-data
- **Accept**: text/plain


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
Expand Down
Loading
Loading