Better handling of allOf in request body (#16991)

* better handling of allOf in request body, add tests

* additional checks

* fix description
This commit is contained in:
William Cheng 2023-11-05 22:43:45 +08:00 committed by GitHub
parent 339596aeec
commit 49208144e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 2682 additions and 1 deletions

View File

@ -7581,8 +7581,19 @@ public class DefaultCodegen implements CodegenConfig {
String name = null;
LOGGER.debug("Request body = {}", body);
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
Schema original = null;
// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
if (ModelUtils.isAllOf(schema) && schema.getAllOf().size() == 1 &&
schema.getType() == null && schema.getTypes() == null) {
if (schema.getAllOf().get(0) instanceof Schema) {
original = schema;
schema = (Schema) schema.getAllOf().get(0);
} else {
LOGGER.error("Unknown type in allOf schema. Please report the issue via openapi-generator's Github issue tracker.");
}
}
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
if (StringUtils.isNotBlank(schema.get$ref())) {
name = ModelUtils.getSimpleRef(schema.get$ref());
}
@ -7651,6 +7662,20 @@ public class DefaultCodegen implements CodegenConfig {
// should be overridden by lang codegen
setParameterExampleValue(codegenParameter, body);
// restore original schema with description, extensions etc
if (original != null) {
schema = original;
// evaluate common attributes such as description if defined in the top level
if (schema.getDescription() != null) {
codegenParameter.description = escapeText(schema.getDescription());
codegenParameter.unescapedDescription = schema.getDescription();
}
if (original.getExtensions() != null) {
codegenParameter.vendorExtensions.putAll(original.getExtensions());
}
}
return codegenParameter;
}

View File

@ -430,6 +430,22 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Pet'
/echo/body/allOf/Pet:
post:
tags:
- body
summary: Test body parameter(s)
description: Test body parameter(s)
operationId: test/echo/body/allOf/Pet
requestBody:
$ref: '#/components/requestBodies/AllOfPet'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
/echo/body/Pet/response_string:
post:
tags:
@ -554,6 +570,13 @@ components:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
AllOfPet:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
Tag:
content:
application/json:

View File

@ -120,6 +120,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* | [**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)
*BodyApi* | [**TestEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -403,6 +403,22 @@ paths:
summary: Test body parameter(s)
tags:
- body
/echo/body/allOf/Pet:
post:
description: Test body parameter(s)
operationId: test/echo/body/allOf/Pet
requestBody:
$ref: '#/components/requestBodies/AllOfPet'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Successful operation
summary: Test body parameter(s)
tags:
- body
/echo/body/Pet/response_string:
post:
description: Test empty response body
@ -513,6 +529,13 @@ components:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
AllOfPet:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
Tag:
content:
application/json:

View File

@ -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 |
| [**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) |
| [**TestEchoBodyPetResponseString**](BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body |
@ -273,6 +274,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="testechobodyallofpet"></a>
# **TestEchoBodyAllOfPet**
> Pet TestEchoBodyAllOfPet (Pet? pet = null)
Test body parameter(s)
Test body parameter(s)
### 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 TestEchoBodyAllOfPetExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost:3000";
var apiInstance = new BodyApi(config);
var pet = new Pet?(); // Pet? | Pet object that needs to be added to the store (optional)
try
{
// Test body parameter(s)
Pet result = apiInstance.TestEchoBodyAllOfPet(pet);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling BodyApi.TestEchoBodyAllOfPet: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```
#### Using the TestEchoBodyAllOfPetWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
```csharp
try
{
// Test body parameter(s)
ApiResponse<Pet> response = apiInstance.TestEchoBodyAllOfPetWithHttpInfo(pet);
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.TestEchoBodyAllOfPetWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```
### Parameters
| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **pet** | [**Pet?**](Pet?.md) | Pet object that needs to be added to the store | [optional] |
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|

View File

@ -95,6 +95,29 @@ namespace Org.OpenAPITools.Api
/// <returns>ApiResponse of string</returns>
ApiResponse<string> TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo(List<System.IO.Stream> files, int operationIndex = 0);
/// <summary>
/// Test body parameter(s)
/// </summary>
/// <remarks>
/// Test body parameter(s)
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Pet</returns>
Pet TestEchoBodyAllOfPet(Pet? pet = default(Pet?), int operationIndex = 0);
/// <summary>
/// Test body parameter(s)
/// </summary>
/// <remarks>
/// Test body parameter(s)
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Pet</returns>
ApiResponse<Pet> TestEchoBodyAllOfPetWithHttpInfo(Pet? pet = default(Pet?), int operationIndex = 0);
/// <summary>
/// Test free form object
/// </summary>
/// <remarks>
@ -269,6 +292,31 @@ namespace Org.OpenAPITools.Api
/// <returns>Task of ApiResponse (string)</returns>
System.Threading.Tasks.Task<ApiResponse<string>> TestBodyMultipartFormdataArrayOfBinaryWithHttpInfoAsync(List<System.IO.Stream> files, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test body parameter(s)
/// </summary>
/// <remarks>
/// Test body parameter(s)
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of Pet</returns>
System.Threading.Tasks.Task<Pet> TestEchoBodyAllOfPetAsync(Pet? pet = default(Pet?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test body parameter(s)
/// </summary>
/// <remarks>
/// Test body parameter(s)
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (Pet)</returns>
System.Threading.Tasks.Task<ApiResponse<Pet>> TestEchoBodyAllOfPetWithHttpInfoAsync(Pet? pet = default(Pet?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Test free form object
/// </summary>
/// <remarks>
@ -900,6 +948,140 @@ namespace Org.OpenAPITools.Api
return localVarResponse;
}
/// <summary>
/// Test body parameter(s) Test body parameter(s)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Pet</returns>
public Pet TestEchoBodyAllOfPet(Pet? pet = default(Pet?), int operationIndex = 0)
{
Org.OpenAPITools.Client.ApiResponse<Pet> localVarResponse = TestEchoBodyAllOfPetWithHttpInfo(pet);
return localVarResponse.Data;
}
/// <summary>
/// Test body parameter(s) Test body parameter(s)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Pet</returns>
public Org.OpenAPITools.Client.ApiResponse<Pet> TestEchoBodyAllOfPetWithHttpInfo(Pet? pet = default(Pet?), int operationIndex = 0)
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = pet;
localVarRequestOptions.Operation = "BodyApi.TestEchoBodyAllOfPet";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = this.Client.Post<Pet>("/echo/body/allOf/Pet", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("TestEchoBodyAllOfPet", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// Test body parameter(s) Test body parameter(s)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of Pet</returns>
public async System.Threading.Tasks.Task<Pet> TestEchoBodyAllOfPetAsync(Pet? pet = default(Pet?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.ApiResponse<Pet> localVarResponse = await TestEchoBodyAllOfPetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
/// <summary>
/// Test body parameter(s) Test body parameter(s)
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pet">Pet object that needs to be added to the store (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (Pet)</returns>
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<Pet>> TestEchoBodyAllOfPetWithHttpInfoAsync(Pet? pet = default(Pet?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = pet;
localVarRequestOptions.Operation = "BodyApi.TestEchoBodyAllOfPet";
localVarRequestOptions.OperationIndex = operationIndex;
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.PostAsync<Pet>("/echo/body/allOf/Pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("TestEchoBodyAllOfPet", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// Test free form object Test free form object
/// </summary>

View File

@ -81,6 +81,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* | [**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)
*BodyAPI* | [**TestEchoBodyPetResponseString**](docs/BodyAPI.md#testechobodypetresponsestring) | **Post** /echo/body/Pet/response_string | Test empty response body

View File

@ -403,6 +403,22 @@ paths:
summary: Test body parameter(s)
tags:
- body
/echo/body/allOf/Pet:
post:
description: Test body parameter(s)
operationId: test/echo/body/allOf/Pet
requestBody:
$ref: '#/components/requestBodies/AllOfPet'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Successful operation
summary: Test body parameter(s)
tags:
- body
/echo/body/Pet/response_string:
post:
description: Test empty response body
@ -513,6 +529,13 @@ components:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
AllOfPet:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
Tag:
content:
application/json:

View File

@ -356,6 +356,114 @@ func (a *BodyAPIService) TestBodyMultipartFormdataArrayOfBinaryExecute(r ApiTest
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiTestEchoBodyAllOfPetRequest struct {
ctx context.Context
ApiService *BodyAPIService
pet *Pet
}
// Pet object that needs to be added to the store
func (r ApiTestEchoBodyAllOfPetRequest) Pet(pet Pet) ApiTestEchoBodyAllOfPetRequest {
r.pet = &pet
return r
}
func (r ApiTestEchoBodyAllOfPetRequest) Execute() (*Pet, *http.Response, error) {
return r.ApiService.TestEchoBodyAllOfPetExecute(r)
}
/*
TestEchoBodyAllOfPet Test body parameter(s)
Test body parameter(s)
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiTestEchoBodyAllOfPetRequest
*/
func (a *BodyAPIService) TestEchoBodyAllOfPet(ctx context.Context) ApiTestEchoBodyAllOfPetRequest {
return ApiTestEchoBodyAllOfPetRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return Pet
func (a *BodyAPIService) TestEchoBodyAllOfPetExecute(r ApiTestEchoBodyAllOfPetRequest) (*Pet, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *Pet
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyAllOfPet")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/echo/body/allOf/Pet"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.pet
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 ApiTestEchoBodyFreeFormObjectResponseStringRequest 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
[**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)
[**TestEchoBodyPetResponseString**](BodyAPI.md#TestEchoBodyPetResponseString) | **Post** /echo/body/Pet/response_string | Test empty response body
@ -207,6 +208,72 @@ No authorization required
[[Back to README]](../README.md)
## TestEchoBodyAllOfPet
> Pet TestEchoBodyAllOfPet(ctx).Pet(pet).Execute()
Test body parameter(s)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)
func main() {
pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.BodyAPI.TestEchoBodyAllOfPet(context.Background()).Pet(pet).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyAllOfPet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `TestEchoBodyAllOfPet`: Pet
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyAllOfPet`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestEchoBodyAllOfPetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[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)
## TestEchoBodyFreeFormObjectResponseString
> string TestEchoBodyFreeFormObjectResponseString(ctx).Body(body).Execute()

View File

@ -114,6 +114,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* | [**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)
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -421,6 +421,24 @@ paths:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/allOf/Pet:
post:
description: Test body parameter(s)
operationId: test/echo/body/allOf/Pet
requestBody:
$ref: '#/components/requestBodies/AllOfPet'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Successful operation
summary: Test body parameter(s)
tags:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/Pet/response_string:
post:
description: Test empty response body
@ -541,6 +559,13 @@ components:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
AllOfPet:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
Tag:
content:
application/json:

View File

@ -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 |
| [**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) |
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
@ -208,6 +209,72 @@ No authorization required
| **200** | Successful operation | - |
## testEchoBodyAllOfPet
> Pet testEchoBodyAllOfPet(pet)
Test body parameter(s)
Test body parameter(s)
### 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.BodyApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
BodyApi apiInstance = new BodyApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Pet result = apiInstance.testEchoBodyAllOfPet(pet);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BodyApi#testEchoBodyAllOfPet");
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 |
|------------- | ------------- | ------------- | -------------|
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
## testEchoBodyFreeFormObjectResponseString
> String testEchoBodyFreeFormObjectResponseString(body)

View File

@ -265,6 +265,75 @@ public class BodyApi {
);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet testEchoBodyAllOfPet(Pet pet) throws ApiException {
return this.testEchoBodyAllOfPet(pet, Collections.emptyMap());
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @param additionalHeaders additionalHeaders for this call
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet testEchoBodyAllOfPet(Pet pet, Map<String, String> additionalHeaders) throws ApiException {
Object localVarPostBody = pet;
// create path and map variables
String localVarPath = "/echo/body/allOf/Pet";
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);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
TypeReference<Pet> localVarReturnType = new TypeReference<Pet>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(),
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Test free form object
* Test free form object

View File

@ -421,6 +421,24 @@ paths:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/allOf/Pet:
post:
description: Test body parameter(s)
operationId: test/echo/body/allOf/Pet
requestBody:
$ref: '#/components/requestBodies/AllOfPet'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Successful operation
summary: Test body parameter(s)
tags:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/Pet/response_string:
post:
description: Test empty response body
@ -541,6 +559,13 @@ components:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
AllOfPet:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
Tag:
content:
application/json:

View File

@ -101,6 +101,35 @@ public interface BodyApi extends ApiClient.Api {
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @return Pet
*/
@RequestLine("POST /echo/body/allOf/Pet")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
Pet testEchoBodyAllOfPet(Pet pet);
/**
* Test body parameter(s)
* Similar to <code>testEchoBodyAllOfPet</code> but it also returns the http response headers .
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /echo/body/allOf/Pet")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
ApiResponse<Pet> testEchoBodyAllOfPetWithHttpInfo(Pet pet);
/**
* Test free form object
* Test free form object

View File

@ -112,6 +112,8 @@ Class | Method | HTTP request | Description
*BodyApi* | [**testBodyApplicationOctetstreamBinaryWithHttpInfo**](docs/BodyApi.md#testBodyApplicationOctetstreamBinaryWithHttpInfo) | **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* | [**testBodyMultipartFormdataArrayOfBinaryWithHttpInfo**](docs/BodyApi.md#testBodyMultipartFormdataArrayOfBinaryWithHttpInfo) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*BodyApi* | [**testEchoBodyAllOfPet**](docs/BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*BodyApi* | [**testEchoBodyAllOfPetWithHttpInfo**](docs/BodyApi.md#testEchoBodyAllOfPetWithHttpInfo) | **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* | [**testEchoBodyFreeFormObjectResponseStringWithHttpInfo**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseStringWithHttpInfo) | **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

@ -421,6 +421,24 @@ paths:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/allOf/Pet:
post:
description: Test body parameter(s)
operationId: test/echo/body/allOf/Pet
requestBody:
$ref: '#/components/requestBodies/AllOfPet'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Successful operation
summary: Test body parameter(s)
tags:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/Pet/response_string:
post:
description: Test empty response body
@ -541,6 +559,13 @@ components:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
AllOfPet:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
Tag:
content:
application/json:

View File

@ -10,6 +10,8 @@ All URIs are relative to *http://localhost:3000*
| [**testBodyApplicationOctetstreamBinaryWithHttpInfo**](BodyApi.md#testBodyApplicationOctetstreamBinaryWithHttpInfo) | **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 |
| [**testBodyMultipartFormdataArrayOfBinaryWithHttpInfo**](BodyApi.md#testBodyMultipartFormdataArrayOfBinaryWithHttpInfo) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
| [**testEchoBodyAllOfPet**](BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) |
| [**testEchoBodyAllOfPetWithHttpInfo**](BodyApi.md#testEchoBodyAllOfPetWithHttpInfo) | **POST** /echo/body/allOf/Pet | Test body parameter(s) |
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
| [**testEchoBodyFreeFormObjectResponseStringWithHttpInfo**](BodyApi.md#testEchoBodyFreeFormObjectResponseStringWithHttpInfo) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
@ -415,6 +417,140 @@ No authorization required
| **200** | Successful operation | - |
## testEchoBodyAllOfPet
> Pet testEchoBodyAllOfPet(pet)
Test body parameter(s)
Test body parameter(s)
### 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.BodyApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
BodyApi apiInstance = new BodyApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Pet result = apiInstance.testEchoBodyAllOfPet(pet);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BodyApi#testEchoBodyAllOfPet");
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 |
|------------- | ------------- | ------------- | -------------|
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
## testEchoBodyAllOfPetWithHttpInfo
> ApiResponse<Pet> testEchoBodyAllOfPet testEchoBodyAllOfPetWithHttpInfo(pet)
Test body parameter(s)
Test body parameter(s)
### 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.BodyApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
BodyApi apiInstance = new BodyApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
ApiResponse<Pet> response = apiInstance.testEchoBodyAllOfPetWithHttpInfo(pet);
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 BodyApi#testEchoBodyAllOfPet");
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 |
|------------- | ------------- | ------------- | -------------|
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
### Return type
ApiResponse<[**Pet**](Pet.md)>
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
## testEchoBodyFreeFormObjectResponseString
> String testEchoBodyFreeFormObjectResponseString(body)

View File

@ -349,6 +349,79 @@ public class BodyApi {
}
return localVarRequestBuilder;
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet testEchoBodyAllOfPet(Pet pet) throws ApiException {
ApiResponse<Pet> localVarResponse = testEchoBodyAllOfPetWithHttpInfo(pet);
return localVarResponse.getData();
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @return ApiResponse&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Pet> testEchoBodyAllOfPetWithHttpInfo(Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyAllOfPetRequestBuilder(pet);
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("testEchoBodyAllOfPet", localVarResponse);
}
return new ApiResponse<Pet>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Pet>() {}) // closes the InputStream
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/echo/body/allOf/Pet";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Test free form object
* Test free form object

View File

@ -60,6 +60,28 @@ public class CustomTest {
Assert.assertNull(p2);
}
/**
* Test allOf body parameter(s)
* <p>
* Test allOf body parameter(s)
*
* @throws ApiException if the Api call fails
*/
@Test
public void testEchoBodyAllOfPet() throws ApiException {
Pet queryObject = new Pet().id(12345L).name("Hello World").
photoUrls(Arrays.asList(new String[]{"http://a.com", "http://b.com"})).category(new Category().id(987L).name("new category"));
Pet p = bodyApi.testEchoBodyAllOfPet(queryObject);
Assert.assertNotNull(p);
Assert.assertEquals("Hello World", p.getName());
Assert.assertEquals(Long.valueOf(12345L), p.getId());
// response is empty body
Pet p2 = bodyApi.testEchoBodyPet(null);
Assert.assertNull(p2);
}
/**
* Test query parameter(s)
* <p>

View File

@ -122,6 +122,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* | [**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)
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -421,6 +421,24 @@ paths:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/allOf/Pet:
post:
description: Test body parameter(s)
operationId: test/echo/body/allOf/Pet
requestBody:
$ref: '#/components/requestBodies/AllOfPet'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Successful operation
summary: Test body parameter(s)
tags:
- body
x-content-type: application/json
x-accepts: application/json
/echo/body/Pet/response_string:
post:
description: Test empty response body
@ -541,6 +559,13 @@ components:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
AllOfPet:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
Tag:
content:
application/json:

View File

@ -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 |
| [**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) |
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
@ -195,6 +196,68 @@ No authorization required
|-------------|-------------|------------------|
| **200** | Successful operation | - |
<a id="testEchoBodyAllOfPet"></a>
# **testEchoBodyAllOfPet**
> Pet testEchoBodyAllOfPet(pet)
Test body parameter(s)
Test body parameter(s)
### 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.BodyApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
BodyApi apiInstance = new BodyApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Pet result = apiInstance.testEchoBodyAllOfPet(pet);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BodyApi#testEchoBodyAllOfPet");
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 |
|------------- | ------------- | ------------- | -------------|
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
<a id="testEchoBodyFreeFormObjectResponseString"></a>
# **testEchoBodyFreeFormObjectResponseString**
> String testEchoBodyFreeFormObjectResponseString(body)

View File

@ -432,6 +432,124 @@ public class BodyApi {
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for testEchoBodyAllOfPet
* @param pet Pet object that needs to be added to the store (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 testEchoBodyAllOfPetCall(Pet pet, 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 = pet;
// create path and map variables
String localVarPath = "/echo/body/allOf/Pet";
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>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json"
};
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 testEchoBodyAllOfPetValidateBeforeCall(Pet pet, final ApiCallback _callback) throws ApiException {
return testEchoBodyAllOfPetCall(pet, _callback);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @return Pet
* @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 Pet testEchoBodyAllOfPet(Pet pet) throws ApiException {
ApiResponse<Pet> localVarResp = testEchoBodyAllOfPetWithHttpInfo(pet);
return localVarResp.getData();
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @return ApiResponse&lt;Pet&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<Pet> testEchoBodyAllOfPetWithHttpInfo(Pet pet) throws ApiException {
okhttp3.Call localVarCall = testEchoBodyAllOfPetValidateBeforeCall(pet, null);
Type localVarReturnType = new TypeToken<Pet>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Test body parameter(s) (asynchronously)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (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 testEchoBodyAllOfPetAsync(Pet pet, final ApiCallback<Pet> _callback) throws ApiException {
okhttp3.Call localVarCall = testEchoBodyAllOfPetValidateBeforeCall(pet, _callback);
Type localVarReturnType = new TypeToken<Pet>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for testEchoBodyFreeFormObjectResponseString
* @param body Free form object (optional)

View File

@ -80,6 +80,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**testBinaryGif**](docs/Api/BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/Api/BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/Api/BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*BodyApi* | [**testEchoBodyAllOfPet**](docs/Api/BodyApi.md#testechobodyallofpet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/Api/BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
*BodyApi* | [**testEchoBodyPet**](docs/Api/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s)
*BodyApi* | [**testEchoBodyPetResponseString**](docs/Api/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -7,6 +7,7 @@ All URIs are relative to http://localhost:3000, except if the operation defines
| [**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 |
| [**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) |
| [**testEchoBodyPetResponseString()**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
@ -178,6 +179,62 @@ No authorization required
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `testEchoBodyAllOfPet()`
```php
testEchoBodyAllOfPet($pet): \OpenAPI\Client\Model\Pet
```
Test body parameter(s)
Test body parameter(s)
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new OpenAPI\Client\Api\BodyApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store
try {
$result = $apiInstance->testEchoBodyAllOfPet($pet);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BodyApi->testEchoBodyAllOfPet: ', $e->getMessage(), PHP_EOL;
}
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | [optional] |
### Return type
[**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`
- **Accept**: `application/json`
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
## `testEchoBodyFreeFormObjectResponseString()`
```php

View File

@ -81,6 +81,9 @@ class BodyApi
'testBodyMultipartFormdataArrayOfBinary' => [
'multipart/form-data',
],
'testEchoBodyAllOfPet' => [
'application/json',
],
'testEchoBodyFreeFormObjectResponseString' => [
'application/json',
],
@ -1007,6 +1010,297 @@ class BodyApi
);
}
/**
* Operation testEchoBodyAllOfPet
*
* Test body parameter(s)
*
* @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return \OpenAPI\Client\Model\Pet
*/
public function testEchoBodyAllOfPet(
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
): \OpenAPI\Client\Model\Pet
{
list($response) = $this->testEchoBodyAllOfPetWithHttpInfo($pet, $contentType);
return $response;
}
/**
* Operation testEchoBodyAllOfPetWithHttpInfo
*
* Test body parameter(s)
*
* @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings)
*/
public function testEchoBodyAllOfPetWithHttpInfo(
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
): array
{
$request = $this->testEchoBodyAllOfPetRequest($pet, $contentType);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
} catch (ConnectException $e) {
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
(int) $e->getCode(),
null,
null
);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\OpenAPI\Client\Model\Pet' !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
$returnType = '\OpenAPI\Client\Model\Pet';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\OpenAPI\Client\Model\Pet',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation testEchoBodyAllOfPetAsync
*
* Test body parameter(s)
*
* @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
*
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function testEchoBodyAllOfPetAsync(
?\OpenAPI\Client\Model\Pet $pet = null,
string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
): PromiseInterface
{
return $this->testEchoBodyAllOfPetAsyncWithHttpInfo($pet, $contentType)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation testEchoBodyAllOfPetAsyncWithHttpInfo
*
* Test body parameter(s)
*
* @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
*
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function testEchoBodyAllOfPetAsyncWithHttpInfo(
$pet = null,
string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
): PromiseInterface
{
$returnType = '\OpenAPI\Client\Model\Pet';
$request = $this->testEchoBodyAllOfPetRequest($pet, $contentType);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ($returnType !== 'string') {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders()
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
$exception->getRequest()->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
);
}
/**
* Create request for operation 'testEchoBodyAllOfPet'
*
* @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyAllOfPet'] to see the possible values for this operation
*
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testEchoBodyAllOfPetRequest(
$pet = null,
string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0]
): Request
{
$resourcePath = '/echo/body/allOf/Pet';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
$headers = $this->headerSelector->selectHeaders(
['application/json', ],
$contentType,
$multipart
);
// for model (json/xml)
if (isset($pet)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
$httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pet));
} else {
$httpBody = $pet;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the form parameters
$httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
} else {
// for HTTP post (form)
$httpBody = ObjectSerializer::buildQuery($formParams);
}
}
$defaultHeaders = [];
if ($this->config->getUserAgent()) {
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
}
$headers = array_merge(
$defaultHeaders,
$headerParams,
$headers
);
$operationHost = $this->config->getHost();
$query = ObjectSerializer::buildQuery($queryParams);
return new Request(
'POST',
$operationHost . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* Operation testEchoBodyFreeFormObjectResponseString
*

View File

@ -98,6 +98,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*BodyApi* | [**test_body_multipart_formdata_array_of_binary**](docs/BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*BodyApi* | [**test_echo_body_all_of_pet**](docs/BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -7,6 +7,7 @@ Method | HTTP request | Description
[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
[**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
[**test_body_multipart_formdata_array_of_binary**](BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
[**test_echo_body_all_of_pet**](BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
@ -207,6 +208,73 @@ No authorization required
[[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)
# **test_echo_body_all_of_pet**
> Pet test_echo_body_all_of_pet(pet=pet)
Test body parameter(s)
Test body parameter(s)
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.pet import Pet
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost:3000"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
try:
# Test body parameter(s)
api_response = api_instance.test_echo_body_all_of_pet(pet=pet)
print("The response of BodyApi->test_echo_body_all_of_pet:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BodyApi->test_echo_body_all_of_pet: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### 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)
# **test_echo_body_free_form_object_response_string**
> str test_echo_body_free_form_object_response_string(body=body)

View File

@ -851,6 +851,280 @@ class BodyApi:
@validate_call
def test_echo_body_all_of_pet(
self,
pet: Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> Pet:
"""Test body parameter(s)
Test body parameter(s)
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_echo_body_all_of_pet_serialize(
pet=pet,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Pet"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def test_echo_body_all_of_pet_with_http_info(
self,
pet: Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[Pet]:
"""Test body parameter(s)
Test body parameter(s)
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_echo_body_all_of_pet_serialize(
pet=pet,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Pet"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def test_echo_body_all_of_pet_without_preload_content(
self,
pet: Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Test body parameter(s)
Test body parameter(s)
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_echo_body_all_of_pet_serialize(
pet=pet,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Pet"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _test_echo_body_all_of_pet_serialize(
self,
pet,
_request_auth,
_content_type,
_headers,
_host_index,
) -> Tuple:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if pet is not None:
_body_params = pet
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='POST',
resource_path='/echo/body/allOf/Pet',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def test_echo_body_free_form_object_response_string(
self,

View File

@ -98,6 +98,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*BodyApi* | [**test_body_multipart_formdata_array_of_binary**](docs/BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*BodyApi* | [**test_echo_body_all_of_pet**](docs/BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -7,6 +7,7 @@ Method | HTTP request | Description
[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
[**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
[**test_body_multipart_formdata_array_of_binary**](BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
[**test_echo_body_all_of_pet**](BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
@ -207,6 +208,73 @@ No authorization required
[[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)
# **test_echo_body_all_of_pet**
> Pet test_echo_body_all_of_pet(pet=pet)
Test body parameter(s)
Test body parameter(s)
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.pet import Pet
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost:3000"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
try:
# Test body parameter(s)
api_response = api_instance.test_echo_body_all_of_pet(pet=pet)
print("The response of BodyApi->test_echo_body_all_of_pet:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BodyApi->test_echo_body_all_of_pet: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### 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)
# **test_echo_body_free_form_object_response_string**
> str test_echo_body_free_form_object_response_string(body=body)

View File

@ -479,6 +479,153 @@ class BodyApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_echo_body_all_of_pet(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> Pet: # noqa: E501
"""Test body parameter(s) # noqa: E501
Test body parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_echo_body_all_of_pet(pet, async_req=True)
>>> result = thread.get()
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: Pet
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the test_echo_body_all_of_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_echo_body_all_of_pet_with_http_info(pet, **kwargs) # noqa: E501
@validate_arguments
def test_echo_body_all_of_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test body parameter(s) # noqa: E501
Test body parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_echo_body_all_of_pet_with_http_info(pet, async_req=True)
>>> result = thread.get()
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
:param _return_http_data_only: response data instead of ApiResponse
object with status code, headers, etc
:type _return_http_data_only: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(Pet, status_code(int), headers(HTTPHeaderDict))
"""
_params = locals()
_all_params = [
'pet'
]
_all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
]
)
# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_echo_body_all_of_pet" % _key
)
_params[_key] = _val
del _params['kwargs']
_collection_formats = {}
# process the path parameters
_path_params = {}
# process the query parameters
_query_params = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
# process the form parameters
_form_params = []
_files = {}
# process the body parameter
_body_params = None
if _params['pet'] is not None:
_body_params = _params['pet']
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# set the HTTP header `Content-Type`
_content_types_list = _params.get('_content_type',
self.api_client.select_header_content_type(
['application/json']))
if _content_types_list:
_header_params['Content-Type'] = _content_types_list
# authentication setting
_auth_settings = [] # noqa: E501
_response_types_map = {
'200': "Pet",
}
return self.api_client.call_api(
'/echo/body/allOf/Pet', 'POST',
_path_params,
_query_params,
_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501
"""Test free form object # noqa: E501

View File

@ -98,6 +98,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*BodyApi* | [**test_body_multipart_formdata_array_of_binary**](docs/BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*BodyApi* | [**test_echo_body_all_of_pet**](docs/BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -7,6 +7,7 @@ Method | HTTP request | Description
[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
[**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
[**test_body_multipart_formdata_array_of_binary**](BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
[**test_echo_body_all_of_pet**](BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
@ -207,6 +208,73 @@ No authorization required
[[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)
# **test_echo_body_all_of_pet**
> Pet test_echo_body_all_of_pet(pet=pet)
Test body parameter(s)
Test body parameter(s)
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.pet import Pet
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost:3000"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
try:
# Test body parameter(s)
api_response = api_instance.test_echo_body_all_of_pet(pet=pet)
print("The response of BodyApi->test_echo_body_all_of_pet:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling BodyApi->test_echo_body_all_of_pet: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### 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)
# **test_echo_body_free_form_object_response_string**
> str test_echo_body_free_form_object_response_string(body=body)

View File

@ -851,6 +851,280 @@ class BodyApi:
@validate_call
def test_echo_body_all_of_pet(
self,
pet: Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> Pet:
"""Test body parameter(s)
Test body parameter(s)
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_echo_body_all_of_pet_serialize(
pet=pet,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Pet"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def test_echo_body_all_of_pet_with_http_info(
self,
pet: Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[Pet]:
"""Test body parameter(s)
Test body parameter(s)
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_echo_body_all_of_pet_serialize(
pet=pet,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Pet"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def test_echo_body_all_of_pet_without_preload_content(
self,
pet: Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Test body parameter(s)
Test body parameter(s)
:param pet: Pet object that needs to be added to the store
:type pet: Pet
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_echo_body_all_of_pet_serialize(
pet=pet,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "Pet"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _test_echo_body_all_of_pet_serialize(
self,
pet,
_request_auth,
_content_type,
_headers,
_host_index,
) -> Tuple:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
if pet is not None:
_body_params = pet
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/json'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='POST',
resource_path='/echo/body/allOf/Pet',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
def test_echo_body_free_form_object_response_string(
self,

View File

@ -87,6 +87,7 @@ Class | Method | HTTP request | Description
*OpenapiClient::BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body
*OpenapiClient::BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*OpenapiClient::BodyApi* | [**test_body_multipart_formdata_array_of_binary**](docs/BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*OpenapiClient::BodyApi* | [**test_echo_body_all_of_pet**](docs/BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*OpenapiClient::BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
*OpenapiClient::BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
*OpenapiClient::BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body

View File

@ -7,6 +7,7 @@ All URIs are relative to *http://localhost:3000*
| [**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body |
| [**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
| [**test_body_multipart_formdata_array_of_binary**](BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
| [**test_echo_body_all_of_pet**](BodyApi.md#test_echo_body_all_of_pet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) |
| [**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
| [**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s) |
| [**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body |
@ -204,6 +205,72 @@ No authorization required
- **Accept**: text/plain
## test_echo_body_all_of_pet
> <Pet> test_echo_body_all_of_pet(opts)
Test body parameter(s)
Test body parameter(s)
### Examples
```ruby
require 'time'
require 'openapi_client'
api_instance = OpenapiClient::BodyApi.new
opts = {
pet: OpenapiClient::Pet.new({name: 'doggie', photo_urls: ['photo_urls_example']}) # Pet | Pet object that needs to be added to the store
}
begin
# Test body parameter(s)
result = api_instance.test_echo_body_all_of_pet(opts)
p result
rescue OpenapiClient::ApiError => e
puts "Error when calling BodyApi->test_echo_body_all_of_pet: #{e}"
end
```
#### Using the test_echo_body_all_of_pet_with_http_info variant
This returns an Array which contains the response data, status code and headers.
> <Array(<Pet>, Integer, Hash)> test_echo_body_all_of_pet_with_http_info(opts)
```ruby
begin
# Test body parameter(s)
data, status_code, headers = api_instance.test_echo_body_all_of_pet_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Pet>
rescue OpenapiClient::ApiError => e
puts "Error when calling BodyApi->test_echo_body_all_of_pet_with_http_info: #{e}"
end
```
### Parameters
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [optional] |
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## test_echo_body_free_form_object_response_string
> String test_echo_body_free_form_object_response_string(opts)

View File

@ -209,6 +209,70 @@ module OpenapiClient
return data, status_code, headers
end
# Test body parameter(s)
# Test body parameter(s)
# @param [Hash] opts the optional parameters
# @option opts [Pet] :pet Pet object that needs to be added to the store
# @return [Pet]
def test_echo_body_all_of_pet(opts = {})
data, _status_code, _headers = test_echo_body_all_of_pet_with_http_info(opts)
data
end
# Test body parameter(s)
# Test body parameter(s)
# @param [Hash] opts the optional parameters
# @option opts [Pet] :pet Pet object that needs to be added to the store
# @return [Array<(Pet, Integer, Hash)>] Pet data, response status code and response headers
def test_echo_body_all_of_pet_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: BodyApi.test_echo_body_all_of_pet ...'
end
# resource path
local_var_path = '/echo/body/allOf/Pet'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'pet'])
# return_type
return_type = opts[:debug_return_type] || 'Pet'
# auth_names
auth_names = opts[:debug_auth_names] || []
new_options = opts.merge(
:operation => :"BodyApi.test_echo_body_all_of_pet",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: BodyApi#test_echo_body_all_of_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Test free form object
# Test free form object
# @param [Hash] opts the optional parameters

View File

@ -554,6 +554,40 @@ export const BodyApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
/**
* Test body parameter(s)
* @summary Test body parameter(s)
* @param {Pet} [pet] Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
testEchoBodyAllOfPet: async (pet?: Pet, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/echo/body/allOf/Pet`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(pet, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Test free form object
* @summary Test free form object
@ -738,6 +772,19 @@ export const BodyApiFp = function(configuration?: Configuration) {
const operationBasePath = operationServerMap['BodyApi.testBodyMultipartFormdataArrayOfBinary']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* Test body parameter(s)
* @summary Test body parameter(s)
* @param {Pet} [pet] Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async testEchoBodyAllOfPet(pet?: Pet, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Pet>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.testEchoBodyAllOfPet(pet, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['BodyApi.testEchoBodyAllOfPet']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* Test free form object
* @summary Test free form object
@ -829,6 +876,16 @@ export const BodyApiFactory = function (configuration?: Configuration, basePath?
testBodyMultipartFormdataArrayOfBinary(files: Array<File>, options?: any): AxiosPromise<string> {
return localVarFp.testBodyMultipartFormdataArrayOfBinary(files, options).then((request) => request(axios, basePath));
},
/**
* Test body parameter(s)
* @summary Test body parameter(s)
* @param {Pet} [pet] Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
testEchoBodyAllOfPet(pet?: Pet, options?: any): AxiosPromise<Pet> {
return localVarFp.testEchoBodyAllOfPet(pet, options).then((request) => request(axios, basePath));
},
/**
* Test free form object
* @summary Test free form object
@ -914,6 +971,18 @@ export class BodyApi extends BaseAPI {
return BodyApiFp(this.configuration).testBodyMultipartFormdataArrayOfBinary(files, options).then((request) => request(this.axios, this.basePath));
}
/**
* Test body parameter(s)
* @summary Test body parameter(s)
* @param {Pet} [pet] Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BodyApi
*/
public testEchoBodyAllOfPet(pet?: Pet, options?: AxiosRequestConfig) {
return BodyApiFp(this.configuration).testEchoBodyAllOfPet(pet, options).then((request) => request(this.axios, this.basePath));
}
/**
* Test free form object
* @summary Test free form object