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

* updating test to use the Java RESTEasy echo api client (#17367)

* regenerated samples

* set source and target to 1.8 to fix workflow failure, adapted parser
This commit is contained in:
Milad
2023-12-26 02:32:51 +01:00
committed by GitHub
parent a67e07e132
commit 8c014372aa
275 changed files with 9144 additions and 19842 deletions

View File

@@ -82,6 +82,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)

View File

@@ -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
@@ -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:

View File

@@ -356,6 +356,126 @@ func (a *BodyAPIService) TestBodyMultipartFormdataArrayOfBinaryExecute(r ApiTest
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiTestBodyMultipartFormdataSingleBinaryRequest struct {
ctx context.Context
ApiService *BodyAPIService
myFile *os.File
}
func (r ApiTestBodyMultipartFormdataSingleBinaryRequest) MyFile(myFile *os.File) ApiTestBodyMultipartFormdataSingleBinaryRequest {
r.myFile = myFile
return r
}
func (r ApiTestBodyMultipartFormdataSingleBinaryRequest) Execute() (string, *http.Response, error) {
return r.ApiService.TestBodyMultipartFormdataSingleBinaryExecute(r)
}
/*
TestBodyMultipartFormdataSingleBinary Test single binary in multipart mime
Test single binary in multipart mime
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiTestBodyMultipartFormdataSingleBinaryRequest
*/
func (a *BodyAPIService) TestBodyMultipartFormdataSingleBinary(ctx context.Context) ApiTestBodyMultipartFormdataSingleBinaryRequest {
return ApiTestBodyMultipartFormdataSingleBinaryRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return string
func (a *BodyAPIService) TestBodyMultipartFormdataSingleBinaryExecute(r ApiTestBodyMultipartFormdataSingleBinaryRequest) (string, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue string
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBodyMultipartFormdataSingleBinary")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/body/application/octetstream/single_binary"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"multipart/form-data"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"text/plain"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
var myFileLocalVarFormFileName string
var myFileLocalVarFileName string
var myFileLocalVarFileBytes []byte
myFileLocalVarFormFileName = "my-file"
myFileLocalVarFile := r.myFile
if myFileLocalVarFile != nil {
fbs, _ := io.ReadAll(myFileLocalVarFile)
myFileLocalVarFileBytes = fbs
myFileLocalVarFileName = myFileLocalVarFile.Name()
myFileLocalVarFile.Close()
formFiles = append(formFiles, formFile{fileBytes: myFileLocalVarFileBytes, fileName: myFileLocalVarFileName, formFileName: myFileLocalVarFormFileName})
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiTestEchoBodyAllOfPetRequest struct {
ctx context.Context
ApiService *BodyAPIService

View File

@@ -7,6 +7,7 @@ Method | HTTP request | Description
[**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)
@@ -208,6 +209,72 @@ No authorization required
[[Back to README]](../README.md)
## TestBodyMultipartFormdataSingleBinary
> string TestBodyMultipartFormdataSingleBinary(ctx).MyFile(myFile).Execute()
Test single binary in multipart mime
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)
func main() {
myFile := os.NewFile(1234, "some_file") // *os.File | (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.BodyAPI.TestBodyMultipartFormdataSingleBinary(context.Background()).MyFile(myFile).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBodyMultipartFormdataSingleBinary``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `TestBodyMultipartFormdataSingleBinary`: string
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBodyMultipartFormdataSingleBinary`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestBodyMultipartFormdataSingleBinaryRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**myFile** | ***os.File** | |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: text/plain
[[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)
## TestEchoBodyAllOfPet
> Pet TestEchoBodyAllOfPet(ctx).Pet(pet).Execute()