Skip to content

Commit

Permalink
[Python] Add echo_api test object serialization for multipart requests (
Browse files Browse the repository at this point in the history
#18176)

* [python] echo add test object serialization for multipart requests

* [echo api] update samples

* [echo api] update samples
  • Loading branch information
fa0311 authored Mar 23, 2024
1 parent 420e49f commit 5e95464
Show file tree
Hide file tree
Showing 137 changed files with 7,427 additions and 0 deletions.
27 changes: 27 additions & 0 deletions modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,33 @@ paths:
text/plain:
schema:
type: string
/form/object/multipart:
post:
tags:
- form
summary: Test form parameter(s) for multipart schema
description: Test form parameter(s) for multipart schema
operationId: test/form/object/multipart
requestBody:
content:
multipart/form-data:
schema:
type: object
required:
- marker
properties:
marker:
type: object
properties:
name:
type: string
responses:
'200':
description: Successful operation
content:
text/plain:
schema:
type: string
# header parameter tests
/header/integer/boolean/string/enums:
get:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ docs/Query.md
docs/QueryApi.md
docs/StringEnumRef.md
docs/Tag.md
docs/TestFormObjectMultipartRequestMarker.md
docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
git_push.sh
Expand Down Expand Up @@ -54,6 +55,7 @@ src/Org.OpenAPITools/Model/Pet.cs
src/Org.OpenAPITools/Model/Query.cs
src/Org.OpenAPITools/Model/StringEnumRef.cs
src/Org.OpenAPITools/Model/Tag.cs
src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs
src/Org.OpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.cs
src/Org.OpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.cs
src/Org.OpenAPITools/Org.OpenAPITools.csproj
2 changes: 2 additions & 0 deletions samples/client/echo_api/csharp-restsharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Class | Method | HTTP request | Description
*BodyApi* | [**TestEchoBodyStringEnum**](docs/BodyApi.md#testechobodystringenum) | **POST** /echo/body/string_enum | Test string enum response body
*BodyApi* | [**TestEchoBodyTagResponseString**](docs/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
*FormApi* | [**TestFormIntegerBooleanString**](docs/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s)
*FormApi* | [**TestFormObjectMultipart**](docs/FormApi.md#testformobjectmultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema
*FormApi* | [**TestFormOneof**](docs/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
*HeaderApi* | [**TestHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
*PathApi* | [**TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#testspathstringpathstringintegerpathintegerenumnonrefstringpathenumrefstringpath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
Expand Down Expand Up @@ -157,6 +158,7 @@ Class | Method | HTTP request | Description
- [Model.Query](docs/Query.md)
- [Model.StringEnumRef](docs/StringEnumRef.md)
- [Model.Tag](docs/Tag.md)
- [Model.TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md)
- [Model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
- [Model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)

Expand Down
31 changes: 31 additions & 0 deletions samples/client/echo_api/csharp-restsharp/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ paths:
summary: Test form parameter(s) for oneOf schema
tags:
- form
/form/object/multipart:
post:
description: Test form parameter(s) for multipart schema
operationId: test/form/object/multipart
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/test_form_object_multipart_request'
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test form parameter(s) for multipart schema
tags:
- form
/header/integer/boolean/string/enums:
get:
description: Test header parameter(s)
Expand Down Expand Up @@ -870,6 +889,18 @@ components:
- $ref: '#/components/schemas/test_form_oneof_request_oneOf_1'
- $ref: '#/components/schemas/Tag'
type: object
test_form_object_multipart_request_marker:
properties:
name:
type: string
type: object
test_form_object_multipart_request:
properties:
marker:
$ref: '#/components/schemas/test_form_object_multipart_request_marker'
required:
- marker
type: object
test_query_style_form_explode_true_array_string_query_object_parameter:
properties:
values:
Expand Down
92 changes: 92 additions & 0 deletions samples/client/echo_api/csharp-restsharp/docs/FormApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000*
| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**TestFormIntegerBooleanString**](FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s) |
| [**TestFormObjectMultipart**](FormApi.md#testformobjectmultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema |
| [**TestFormOneof**](FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |

<a id="testformintegerbooleanstring"></a>
Expand Down Expand Up @@ -95,6 +96,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="testformobjectmultipart"></a>
# **TestFormObjectMultipart**
> string TestFormObjectMultipart (TestFormObjectMultipartRequestMarker marker)
Test form parameter(s) for multipart schema

Test form parameter(s) for multipart schema

### 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 TestFormObjectMultipartExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost:3000";
var apiInstance = new FormApi(config);
var marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker |
try
{
// Test form parameter(s) for multipart schema
string result = apiInstance.TestFormObjectMultipart(marker);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling FormApi.TestFormObjectMultipart: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```

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

```csharp
try
{
// Test form parameter(s) for multipart schema
ApiResponse<string> response = apiInstance.TestFormObjectMultipartWithHttpInfo(marker);
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 FormApi.TestFormObjectMultipartWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```

### Parameters

| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **marker** | [**TestFormObjectMultipartRequestMarker**](TestFormObjectMultipartRequestMarker.md) | | |

### Return type

**string**

### Authorization

No authorization required

### HTTP request headers

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


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Org.OpenAPITools.Model.TestFormObjectMultipartRequestMarker

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Echo Server API
*
* Echo Server API
*
* The version of the OpenAPI document: 0.1.0
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/


using Xunit;

using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;

namespace Org.OpenAPITools.Test.Model
{
/// <summary>
/// Class for testing TestFormObjectMultipartRequestMarker
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
public class TestFormObjectMultipartRequestMarkerTests : IDisposable
{
// TODO uncomment below to declare an instance variable for TestFormObjectMultipartRequestMarker
//private TestFormObjectMultipartRequestMarker instance;

public TestFormObjectMultipartRequestMarkerTests()
{
// TODO uncomment below to create an instance of TestFormObjectMultipartRequestMarker
//instance = new TestFormObjectMultipartRequestMarker();
}

public void Dispose()
{
// Cleanup when everything is done.
}

/// <summary>
/// Test an instance of TestFormObjectMultipartRequestMarker
/// </summary>
[Fact]
public void TestFormObjectMultipartRequestMarkerInstanceTest()
{
// TODO uncomment below to test "IsType" TestFormObjectMultipartRequestMarker
//Assert.IsType<TestFormObjectMultipartRequestMarker>(instance);
}

/// <summary>
/// Test the property 'Name'
/// </summary>
[Fact]
public void NameTest()
{
// TODO unit test for the property 'Name'
}
}
}
Loading

0 comments on commit 5e95464

Please sign in to comment.