From b03cdaee8549e52d562290cd48ea1355b07fbefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Wed, 20 Mar 2024 11:05:45 +0000 Subject: [PATCH 1/3] [python] echo add test object serialization for multipart requests --- .../src/test/resources/3_0/echo_api.yaml | 27 +++++++++++++++++++ .../echo_api/python/tests/test_manual.py | 13 +++++++++ 2 files changed, 40 insertions(+) diff --git a/modules/openapi-generator/src/test/resources/3_0/echo_api.yaml b/modules/openapi-generator/src/test/resources/3_0/echo_api.yaml index 1a386d676d7a..9a1399b5b7bc 100644 --- a/modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/echo_api.yaml @@ -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: diff --git a/samples/client/echo_api/python/tests/test_manual.py b/samples/client/echo_api/python/tests/test_manual.py index 02737e95784a..42ae3aafd85e 100644 --- a/samples/client/echo_api/python/tests/test_manual.py +++ b/samples/client/echo_api/python/tests/test_manual.py @@ -265,6 +265,19 @@ def echoServerResponseParaserTest(self): self.assertEqual(e.headers["Accept"], 'text/plain') self.assertEqual(e.method, 'POST') + def test_form_object_multipart(self): + api_instance = openapi_client.FormApi() + marker = openapi_client.TestFormObjectMultipartRequestMarker( + name="name", + ) + api_response = api_instance.test_form_object_multipart( + marker=marker, + ) + e = EchoServerResponseParser(api_response) + self.assertEqual(e.path, "/form/object/multipart") + self.assertTrue(e.headers["Content-Type"].startswith("multipart/form-data")) + self.assertTrue("boundary=" in e.headers["Content-Type"]) + class EchoServerResponseParser(): def __init__(self, http_response): if http_response is None: From a6f8318c15be93ef87621d683960cb24bc423e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Wed, 20 Mar 2024 11:09:12 +0000 Subject: [PATCH 2/3] [echo api] update samples --- .../csharp-restsharp/.openapi-generator/FILES | 3 + .../echo_api/csharp-restsharp/README.md | 2 + .../csharp-restsharp/api/openapi.yaml | 31 ++ .../echo_api/csharp-restsharp/docs/FormApi.md | 92 ++++ .../TestFormObjectMultipartRequestMarker.md | 10 + ...stFormObjectMultipartRequestMarkerTests.cs | 67 +++ .../src/Org.OpenAPITools/Api/FormApi.cs | 195 +++++++++ .../TestFormObjectMultipartRequestMarker.cs | 129 ++++++ .../echo_api/go/.openapi-generator/FILES | 2 + samples/client/echo_api/go/README.md | 2 + samples/client/echo_api/go/api/openapi.yaml | 31 ++ samples/client/echo_api/go/api_form.go | 109 +++++ samples/client/echo_api/go/docs/FormAPI.md | 67 +++ .../TestFormObjectMultipartRequestMarker.md | 56 +++ ...st_form_object_multipart_request_marker.go | 127 ++++++ .../.openapi-generator/FILES | 3 + .../echo_api/java/apache-httpclient/README.md | 2 + .../java/apache-httpclient/api/openapi.yaml | 33 ++ .../java/apache-httpclient/docs/FormApi.md | 67 +++ .../TestFormObjectMultipartRequestMarker.md | 13 + .../org/openapitools/client/api/FormApi.java | 77 ++++ .../TestFormObjectMultipartRequestMarker.java | 152 +++++++ ...tFormObjectMultipartRequestMarkerTest.java | 47 ++ .../java/feign-gson/.openapi-generator/FILES | 2 + .../echo_api/java/feign-gson/api/openapi.yaml | 33 ++ .../org/openapitools/client/api/FormApi.java | 30 ++ .../TestFormObjectMultipartRequestMarker.java | 97 +++++ ...tFormObjectMultipartRequestMarkerTest.java | 46 ++ .../java/native/.openapi-generator/FILES | 3 + samples/client/echo_api/java/native/README.md | 3 + .../echo_api/java/native/api/openapi.yaml | 33 ++ .../echo_api/java/native/docs/FormApi.md | 136 ++++++ .../TestFormObjectMultipartRequestMarker.md | 13 + .../org/openapitools/client/api/FormApi.java | 112 +++++ .../TestFormObjectMultipartRequestMarker.java | 150 +++++++ ...tFormObjectMultipartRequestMarkerTest.java | 48 +++ .../java/okhttp-gson/.openapi-generator/FILES | 3 + .../echo_api/java/okhttp-gson/README.md | 2 + .../java/okhttp-gson/api/openapi.yaml | 33 ++ .../echo_api/java/okhttp-gson/docs/FormApi.md | 63 +++ .../TestFormObjectMultipartRequestMarker.md | 13 + .../java/org/openapitools/client/JSON.java | 1 + .../org/openapitools/client/api/FormApi.java | 128 ++++++ .../TestFormObjectMultipartRequestMarker.java | 206 +++++++++ ...tFormObjectMultipartRequestMarkerTest.java | 48 +++ .../java/resteasy/.openapi-generator/FILES | 3 + .../client/echo_api/java/resteasy/README.md | 2 + .../echo_api/java/resteasy/api/openapi.yaml | 33 ++ .../echo_api/java/resteasy/docs/FormApi.md | 67 +++ .../TestFormObjectMultipartRequestMarker.md | 13 + .../org/openapitools/client/api/FormApi.java | 46 ++ .../TestFormObjectMultipartRequestMarker.java | 104 +++++ ...tFormObjectMultipartRequestMarkerTest.java | 47 ++ .../resttemplate/.openapi-generator/FILES | 3 + .../echo_api/java/resttemplate/README.md | 2 + .../java/resttemplate/api/openapi.yaml | 33 ++ .../java/resttemplate/docs/FormApi.md | 67 +++ .../TestFormObjectMultipartRequestMarker.md | 13 + .../org/openapitools/client/api/FormApi.java | 52 +++ .../TestFormObjectMultipartRequestMarker.java | 104 +++++ ...tFormObjectMultipartRequestMarkerTest.java | 47 ++ .../php-nextgen/.openapi-generator/FILES | 3 + samples/client/echo_api/php-nextgen/README.md | 2 + .../echo_api/php-nextgen/docs/Api/FormApi.md | 57 +++ .../TestFormObjectMultipartRequestMarker.md | 9 + .../echo_api/php-nextgen/src/Api/FormApi.php | 321 ++++++++++++++ .../TestFormObjectMultipartRequestMarker.php | 408 ++++++++++++++++++ ...stFormObjectMultipartRequestMarkerTest.php | 89 ++++ .../powershell/.openapi-generator/FILES | 3 + samples/client/echo_api/powershell/README.md | 2 + .../echo_api/powershell/docs/FormApi.md | 44 ++ .../TestFormObjectMultipartRequestMarker.md | 21 + .../src/PSOpenAPITools/Api/FormApi.ps1 | 77 ++++ .../TestFormObjectMultipartRequestMarker.ps1 | 98 +++++ ...FormObjectMultipartRequestMarker.Tests.ps1 | 18 + .../.openapi-generator/FILES | 3 + .../README.md | 2 + .../docs/FormApi.md | 69 +++ .../TestFormObjectMultipartRequestMarker.md | 29 ++ .../openapi_client/__init__.py | 1 + .../openapi_client/api/form_api.py | 271 ++++++++++++ .../openapi_client/models/__init__.py | 1 + ...st_form_object_multipart_request_marker.py | 93 ++++ ...st_form_object_multipart_request_marker.py | 52 +++ .../.openapi-generator/FILES | 3 + .../echo_api/python-pydantic-v1/README.md | 2 + .../python-pydantic-v1/docs/FormApi.md | 68 +++ .../TestFormObjectMultipartRequestMarker.md | 28 ++ .../openapi_client/__init__.py | 1 + .../openapi_client/api/form_api.py | 148 +++++++ .../openapi_client/models/__init__.py | 1 + ...st_form_object_multipart_request_marker.py | 72 ++++ ...st_form_object_multipart_request_marker.py | 53 +++ .../echo_api/python/.openapi-generator/FILES | 3 + samples/client/echo_api/python/README.md | 2 + .../client/echo_api/python/docs/FormApi.md | 69 +++ .../TestFormObjectMultipartRequestMarker.md | 29 ++ .../python/openapi_client/__init__.py | 1 + .../python/openapi_client/api/form_api.py | 271 ++++++++++++ .../python/openapi_client/models/__init__.py | 1 + ...st_form_object_multipart_request_marker.py | 88 ++++ ...st_form_object_multipart_request_marker.py | 52 +++ .../echo_api/r/.openapi-generator/FILES | 3 + samples/client/echo_api/r/NAMESPACE | 1 + samples/client/echo_api/r/R/form_api.R | 124 ++++++ ...est_form_object_multipart_request_marker.R | 163 +++++++ samples/client/echo_api/r/README.md | 2 + samples/client/echo_api/r/docs/FormApi.md | 48 +++ .../TestFormObjectMultipartRequestMarker.md | 9 + ...est_form_object_multipart_request_marker.R | 13 + .../ruby-faraday/.openapi-generator/FILES | 3 + .../client/echo_api/ruby-faraday/README.md | 2 + .../echo_api/ruby-faraday/docs/FormApi.md | 65 +++ .../TestFormObjectMultipartRequestMarker.md | 18 + .../ruby-faraday/lib/openapi_client.rb | 1 + .../lib/openapi_client/api/form_api.rb | 69 +++ ...st_form_object_multipart_request_marker.rb | 214 +++++++++ ...rm_object_multipart_request_marker_spec.rb | 36 ++ .../ruby-httpx/.openapi-generator/FILES | 3 + samples/client/echo_api/ruby-httpx/README.md | 2 + .../echo_api/ruby-httpx/docs/FormApi.md | 65 +++ .../TestFormObjectMultipartRequestMarker.md | 18 + .../echo_api/ruby-httpx/lib/openapi_client.rb | 1 + .../lib/openapi_client/api/form_api.rb | 69 +++ ...st_form_object_multipart_request_marker.rb | 214 +++++++++ ...rm_object_multipart_request_marker_spec.rb | 36 ++ .../ruby-typhoeus/.openapi-generator/FILES | 3 + .../client/echo_api/ruby-typhoeus/README.md | 2 + .../echo_api/ruby-typhoeus/docs/FormApi.md | 65 +++ .../TestFormObjectMultipartRequestMarker.md | 18 + .../ruby-typhoeus/lib/openapi_client.rb | 1 + .../lib/openapi_client/api/form_api.rb | 69 +++ ...st_form_object_multipart_request_marker.rb | 214 +++++++++ ...rm_object_multipart_request_marker_spec.rb | 36 ++ .../echo_api/typescript-axios/build/api.ts | 89 ++++ 135 files changed, 7397 insertions(+) create mode 100644 samples/client/echo_api/csharp-restsharp/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs create mode 100644 samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs create mode 100644 samples/client/echo_api/go/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/go/model_test_form_object_multipart_request_marker.go create mode 100644 samples/client/echo_api/java/apache-httpclient/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java create mode 100644 samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java create mode 100644 samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java create mode 100644 samples/client/echo_api/java/feign-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java create mode 100644 samples/client/echo_api/java/native/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java create mode 100644 samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java create mode 100644 samples/client/echo_api/java/okhttp-gson/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java create mode 100644 samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java create mode 100644 samples/client/echo_api/java/resteasy/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java create mode 100644 samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java create mode 100644 samples/client/echo_api/java/resttemplate/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java create mode 100644 samples/client/echo_api/java/resttemplate/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java create mode 100644 samples/client/echo_api/php-nextgen/docs/Model/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/php-nextgen/src/Model/TestFormObjectMultipartRequestMarker.php create mode 100644 samples/client/echo_api/php-nextgen/tests/Model/TestFormObjectMultipartRequestMarkerTest.php create mode 100644 samples/client/echo_api/powershell/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestFormObjectMultipartRequestMarker.ps1 create mode 100644 samples/client/echo_api/powershell/tests/Model/TestFormObjectMultipartRequestMarker.Tests.ps1 create mode 100644 samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/test_form_object_multipart_request_marker.py create mode 100644 samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_form_object_multipart_request_marker.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_test_form_object_multipart_request_marker.py create mode 100644 samples/client/echo_api/python/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/python/openapi_client/models/test_form_object_multipart_request_marker.py create mode 100644 samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py create mode 100644 samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R create mode 100644 samples/client/echo_api/r/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/r/tests/testthat/test_test_form_object_multipart_request_marker.R create mode 100644 samples/client/echo_api/ruby-faraday/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb create mode 100644 samples/client/echo_api/ruby-faraday/spec/models/test_form_object_multipart_request_marker_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/test_form_object_multipart_request_marker_spec.rb create mode 100644 samples/client/echo_api/ruby-typhoeus/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb create mode 100644 samples/client/echo_api/ruby-typhoeus/spec/models/test_form_object_multipart_request_marker_spec.rb diff --git a/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES b/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES index b311c4be4b3a..79b5f3ca21cb 100644 --- a/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES +++ b/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES @@ -18,9 +18,11 @@ docs/Query.md docs/QueryApi.md docs/StringEnumRef.md docs/Tag.md +docs/TestFormObjectMultipartRequestMarker.md docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md git_push.sh +src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools/Api/AuthApi.cs src/Org.OpenAPITools/Api/BodyApi.cs @@ -54,6 +56,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 diff --git a/samples/client/echo_api/csharp-restsharp/README.md b/samples/client/echo_api/csharp-restsharp/README.md index aa87c1314cea..3871b6487200 100644 --- a/samples/client/echo_api/csharp-restsharp/README.md +++ b/samples/client/echo_api/csharp-restsharp/README.md @@ -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) @@ -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) diff --git a/samples/client/echo_api/csharp-restsharp/api/openapi.yaml b/samples/client/echo_api/csharp-restsharp/api/openapi.yaml index 95da606c8239..ecb97968d57a 100644 --- a/samples/client/echo_api/csharp-restsharp/api/openapi.yaml +++ b/samples/client/echo_api/csharp-restsharp/api/openapi.yaml @@ -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) @@ -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: diff --git a/samples/client/echo_api/csharp-restsharp/docs/FormApi.md b/samples/client/echo_api/csharp-restsharp/docs/FormApi.md index 2e133fd42fbd..34f1f1d017f8 100644 --- a/samples/client/echo_api/csharp-restsharp/docs/FormApi.md +++ b/samples/client/echo_api/csharp-restsharp/docs/FormApi.md @@ -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 | @@ -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) + + +# **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 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 | |-------------|-------------|------------------| diff --git a/samples/client/echo_api/csharp-restsharp/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/csharp-restsharp/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..6de6ca6f5f0d --- /dev/null +++ b/samples/client/echo_api/csharp-restsharp/docs/TestFormObjectMultipartRequestMarker.md @@ -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) + diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs new file mode 100644 index 000000000000..7488a030df44 --- /dev/null +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs @@ -0,0 +1,67 @@ +/* + * Echo Server API + * + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * 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 +{ + /// + /// Class for testing TestFormObjectMultipartRequestMarker + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + 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. + } + + /// + /// Test an instance of TestFormObjectMultipartRequestMarker + /// + [Fact] + public void TestFormObjectMultipartRequestMarkerInstanceTest() + { + // TODO uncomment below to test "IsType" TestFormObjectMultipartRequestMarker + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/FormApi.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/FormApi.cs index b0ead55b2d1c..fdd57f84f989 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/FormApi.cs +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/FormApi.cs @@ -16,6 +16,7 @@ using System.Net; using System.Net.Mime; using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; namespace Org.OpenAPITools.Api { @@ -54,6 +55,29 @@ public interface IFormApiSync : IApiAccessor /// ApiResponse of string ApiResponse TestFormIntegerBooleanStringWithHttpInfo(int? integerForm = default(int?), bool? booleanForm = default(bool?), string? stringForm = default(string?), int operationIndex = 0); /// + /// Test form parameter(s) for multipart schema + /// + /// + /// Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// string + string TestFormObjectMultipart(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0); + + /// + /// Test form parameter(s) for multipart schema + /// + /// + /// Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of string + ApiResponse TestFormObjectMultipartWithHttpInfo(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0); + /// /// Test form parameter(s) for oneOf schema /// /// @@ -125,6 +149,31 @@ public interface IFormApiAsync : IApiAccessor /// Task of ApiResponse (string) System.Threading.Tasks.Task> TestFormIntegerBooleanStringWithHttpInfoAsync(int? integerForm = default(int?), bool? booleanForm = default(bool?), string? stringForm = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// Test form parameter(s) for multipart schema + /// + /// + /// Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + System.Threading.Tasks.Task TestFormObjectMultipartAsync(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Test form parameter(s) for multipart schema + /// + /// + /// Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> TestFormObjectMultipartWithHttpInfoAsync(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Test form parameter(s) for oneOf schema /// /// @@ -443,6 +492,152 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory return localVarResponse; } + /// + /// Test form parameter(s) for multipart schema Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// string + public string TestFormObjectMultipart(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestFormObjectMultipartWithHttpInfo(marker); + return localVarResponse.Data; + } + + /// + /// Test form parameter(s) for multipart schema Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse TestFormObjectMultipartWithHttpInfo(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0) + { + // verify the required parameter 'marker' is set + if (marker == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'marker' when calling FormApi->TestFormObjectMultipart"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "text/plain" + }; + + 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.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter + + localVarRequestOptions.Operation = "FormApi.TestFormObjectMultipart"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/form/object/multipart", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestFormObjectMultipart", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test form parameter(s) for multipart schema Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + public async System.Threading.Tasks.Task TestFormObjectMultipartAsync(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestFormObjectMultipartWithHttpInfoAsync(marker, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test form parameter(s) for multipart schema Test form parameter(s) for multipart schema + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> TestFormObjectMultipartWithHttpInfoAsync(TestFormObjectMultipartRequestMarker marker, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'marker' is set + if (marker == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'marker' when calling FormApi->TestFormObjectMultipart"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "text/plain" + }; + + 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.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter + + localVarRequestOptions.Operation = "FormApi.TestFormObjectMultipart"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/form/object/multipart", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestFormObjectMultipart", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// Test form parameter(s) for oneOf schema Test form parameter(s) for oneOf schema /// diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs new file mode 100644 index 000000000000..dddd99a1788a --- /dev/null +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs @@ -0,0 +1,129 @@ +/* + * Echo Server API + * + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestFormObjectMultipartRequestMarker + /// + [DataContract(Name = "test_form_object_multipart_request_marker")] + public partial class TestFormObjectMultipartRequestMarker : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name. + public TestFormObjectMultipartRequestMarker(string name = default(string)) + { + this.Name = name; + } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestFormObjectMultipartRequestMarker {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TestFormObjectMultipartRequestMarker); + } + + /// + /// Returns true if TestFormObjectMultipartRequestMarker instances are equal + /// + /// Instance of TestFormObjectMultipartRequestMarker to be compared + /// Boolean + public bool Equals(TestFormObjectMultipartRequestMarker input) + { + if (input == null) + { + return false; + } + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/echo_api/go/.openapi-generator/FILES b/samples/client/echo_api/go/.openapi-generator/FILES index f1b5917aafdb..d72465c44e0b 100644 --- a/samples/client/echo_api/go/.openapi-generator/FILES +++ b/samples/client/echo_api/go/.openapi-generator/FILES @@ -25,6 +25,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 @@ -39,6 +40,7 @@ model_pet.go model_query.go model_string_enum_ref.go model_tag.go +model_test_form_object_multipart_request_marker.go model_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.go model_test_query_style_form_explode_true_array_string_query_object_parameter.go response.go diff --git a/samples/client/echo_api/go/README.md b/samples/client/echo_api/go/README.md index 53af19f901d7..f43c18cad895 100644 --- a/samples/client/echo_api/go/README.md +++ b/samples/client/echo_api/go/README.md @@ -91,6 +91,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) @@ -117,6 +118,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/go/api/openapi.yaml b/samples/client/echo_api/go/api/openapi.yaml index 0a78af3993e6..1c8dcecffc8c 100644 --- a/samples/client/echo_api/go/api/openapi.yaml +++ b/samples/client/echo_api/go/api/openapi.yaml @@ -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) @@ -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: diff --git a/samples/client/echo_api/go/api_form.go b/samples/client/echo_api/go/api_form.go index 4aa3386dc974..9ad984cb6637 100644 --- a/samples/client/echo_api/go/api_form.go +++ b/samples/client/echo_api/go/api_form.go @@ -149,6 +149,115 @@ func (a *FormAPIService) TestFormIntegerBooleanStringExecute(r ApiTestFormIntege return localVarReturnValue, localVarHTTPResponse, nil } +type ApiTestFormObjectMultipartRequest struct { + ctx context.Context + ApiService *FormAPIService + marker *TestFormObjectMultipartRequestMarker +} + +func (r ApiTestFormObjectMultipartRequest) Marker(marker TestFormObjectMultipartRequestMarker) ApiTestFormObjectMultipartRequest { + r.marker = &marker + return r +} + +func (r ApiTestFormObjectMultipartRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestFormObjectMultipartExecute(r) +} + +/* +TestFormObjectMultipart Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestFormObjectMultipartRequest +*/ +func (a *FormAPIService) TestFormObjectMultipart(ctx context.Context) ApiTestFormObjectMultipartRequest { + return ApiTestFormObjectMultipartRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *FormAPIService) TestFormObjectMultipartExecute(r ApiTestFormObjectMultipartRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FormAPIService.TestFormObjectMultipart") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/form/object/multipart" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.marker == nil { + return localVarReturnValue, nil, reportError("marker is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarFormParams, "marker", r.marker, "") + 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 ApiTestFormOneofRequest struct { ctx context.Context ApiService *FormAPIService diff --git a/samples/client/echo_api/go/docs/FormAPI.md b/samples/client/echo_api/go/docs/FormAPI.md index 56d7d9921db0..11ce8193a0a2 100644 --- a/samples/client/echo_api/go/docs/FormAPI.md +++ b/samples/client/echo_api/go/docs/FormAPI.md @@ -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 @@ -79,6 +80,72 @@ No authorization required [[Back to README]](../README.md) +## TestFormObjectMultipart + +> string TestFormObjectMultipart(ctx).Marker(marker).Execute() + +Test form parameter(s) for multipart schema + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + marker := *openapiclient.NewTestFormObjectMultipartRequestMarker() // TestFormObjectMultipartRequestMarker | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FormAPI.TestFormObjectMultipart(context.Background()).Marker(marker).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FormAPI.TestFormObjectMultipart``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestFormObjectMultipart`: string + fmt.Fprintf(os.Stdout, "Response from `FormAPI.TestFormObjectMultipart`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestFormObjectMultipartRequest struct via the builder pattern + + +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 + +[[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) + + ## TestFormOneof > string TestFormOneof(ctx).Form1(form1).Form2(form2).Form3(form3).Form4(form4).Id(id).Name(name).Execute() diff --git a/samples/client/echo_api/go/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/go/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..b30a9954908a --- /dev/null +++ b/samples/client/echo_api/go/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,56 @@ +# TestFormObjectMultipartRequestMarker + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewTestFormObjectMultipartRequestMarker + +`func NewTestFormObjectMultipartRequestMarker() *TestFormObjectMultipartRequestMarker` + +NewTestFormObjectMultipartRequestMarker instantiates a new TestFormObjectMultipartRequestMarker object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTestFormObjectMultipartRequestMarkerWithDefaults + +`func NewTestFormObjectMultipartRequestMarkerWithDefaults() *TestFormObjectMultipartRequestMarker` + +NewTestFormObjectMultipartRequestMarkerWithDefaults instantiates a new TestFormObjectMultipartRequestMarker object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *TestFormObjectMultipartRequestMarker) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TestFormObjectMultipartRequestMarker) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *TestFormObjectMultipartRequestMarker) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *TestFormObjectMultipartRequestMarker) HasName() bool` + +HasName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go/model_test_form_object_multipart_request_marker.go b/samples/client/echo_api/go/model_test_form_object_multipart_request_marker.go new file mode 100644 index 000000000000..d25366f75c12 --- /dev/null +++ b/samples/client/echo_api/go/model_test_form_object_multipart_request_marker.go @@ -0,0 +1,127 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the TestFormObjectMultipartRequestMarker type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TestFormObjectMultipartRequestMarker{} + +// TestFormObjectMultipartRequestMarker struct for TestFormObjectMultipartRequestMarker +type TestFormObjectMultipartRequestMarker struct { + Name *string `json:"name,omitempty"` +} + +// NewTestFormObjectMultipartRequestMarker instantiates a new TestFormObjectMultipartRequestMarker object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTestFormObjectMultipartRequestMarker() *TestFormObjectMultipartRequestMarker { + this := TestFormObjectMultipartRequestMarker{} + return &this +} + +// NewTestFormObjectMultipartRequestMarkerWithDefaults instantiates a new TestFormObjectMultipartRequestMarker object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTestFormObjectMultipartRequestMarkerWithDefaults() *TestFormObjectMultipartRequestMarker { + this := TestFormObjectMultipartRequestMarker{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TestFormObjectMultipartRequestMarker) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestFormObjectMultipartRequestMarker) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TestFormObjectMultipartRequestMarker) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TestFormObjectMultipartRequestMarker) SetName(v string) { + o.Name = &v +} + +func (o TestFormObjectMultipartRequestMarker) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TestFormObjectMultipartRequestMarker) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableTestFormObjectMultipartRequestMarker struct { + value *TestFormObjectMultipartRequestMarker + isSet bool +} + +func (v NullableTestFormObjectMultipartRequestMarker) Get() *TestFormObjectMultipartRequestMarker { + return v.value +} + +func (v *NullableTestFormObjectMultipartRequestMarker) Set(val *TestFormObjectMultipartRequestMarker) { + v.value = val + v.isSet = true +} + +func (v NullableTestFormObjectMultipartRequestMarker) IsSet() bool { + return v.isSet +} + +func (v *NullableTestFormObjectMultipartRequestMarker) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTestFormObjectMultipartRequestMarker(val *TestFormObjectMultipartRequestMarker) *NullableTestFormObjectMultipartRequestMarker { + return &NullableTestFormObjectMultipartRequestMarker{value: val, isSet: true} +} + +func (v NullableTestFormObjectMultipartRequestMarker) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTestFormObjectMultipartRequestMarker) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES b/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES index fbeea06c3830..b2dbde8f6b19 100644 --- a/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES +++ b/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES @@ -20,6 +20,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 @@ -60,5 +61,7 @@ src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Query.java src/main/java/org/openapitools/client/model/StringEnumRef.java src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/apache-httpclient/README.md b/samples/client/echo_api/java/apache-httpclient/README.md index ea6b192ddcb5..14639af67d40 100644 --- a/samples/client/echo_api/java/apache-httpclient/README.md +++ b/samples/client/echo_api/java/apache-httpclient/README.md @@ -125,6 +125,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) @@ -151,6 +152,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/java/apache-httpclient/api/openapi.yaml b/samples/client/echo_api/java/apache-httpclient/api/openapi.yaml index fc7f3a922369..872fbe58b60b 100644 --- a/samples/client/echo_api/java/apache-httpclient/api/openapi.yaml +++ b/samples/client/echo_api/java/apache-httpclient/api/openapi.yaml @@ -101,6 +101,27 @@ paths: - form x-content-type: application/x-www-form-urlencoded x-accepts: text/plain + /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 + x-content-type: multipart/form-data + x-accepts: text/plain /header/integer/boolean/string/enums: get: description: Test header parameter(s) @@ -907,6 +928,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: diff --git a/samples/client/echo_api/java/apache-httpclient/docs/FormApi.md b/samples/client/echo_api/java/apache-httpclient/docs/FormApi.md index 1f3ad73e9384..a9b7132b732c 100644 --- a/samples/client/echo_api/java/apache-httpclient/docs/FormApi.md +++ b/samples/client/echo_api/java/apache-httpclient/docs/FormApi.md @@ -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 | @@ -79,6 +80,72 @@ No authorization required | **200** | Successful operation | - | +## testFormObjectMultipart + +> String testFormObjectMultipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker | + try { + String result = apiInstance.testFormObjectMultipart(marker); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormObjectMultipart"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **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 | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + ## testFormOneof > String testFormOneof(form1, form2, form3, form4, id, name) diff --git a/samples/client/echo_api/java/apache-httpclient/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/java/apache-httpclient/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..3e67574f36d3 --- /dev/null +++ b/samples/client/echo_api/java/apache-httpclient/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,13 @@ + + +# TestFormObjectMultipartRequestMarker + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java index e6a15f3b12ed..571e63678bb9 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java @@ -20,6 +20,7 @@ import org.openapitools.client.Configuration; import org.openapitools.client.Pair; +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; import java.util.ArrayList; @@ -119,6 +120,82 @@ public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanF ); } + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return String + * @throws ApiException if fails to make API call + */ + public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker) throws ApiException { + return this.testFormObjectMultipart(marker, Collections.emptyMap()); + } + + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @param additionalHeaders additionalHeaders for this call + * @return String + * @throws ApiException if fails to make API call + */ + public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker, Map additionalHeaders) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'marker' is set + if (marker == null) { + throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); + } + + // create path and map variables + String localVarPath = "/form/object/multipart"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + localVarHeaderParams.putAll(additionalHeaders); + + + if (marker != null) + localVarFormParams.put("marker", marker); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } + /** * Test form parameter(s) for oneOf schema * Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java new file mode 100644 index 000000000000..ed76a3ac7c79 --- /dev/null +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -0,0 +1,152 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.StringJoiner; + +/** + * TestFormObjectMultipartRequestMarker + */ +@JsonPropertyOrder({ + TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME +}) +@JsonTypeName("test_form_object_multipart_request_marker") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +public class TestFormObjectMultipartRequestMarker { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public TestFormObjectMultipartRequestMarker() { + } + + public TestFormObjectMultipartRequestMarker name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestFormObjectMultipartRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + try { + joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + return joiner.toString(); + } + +} + diff --git a/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java new file mode 100644 index 000000000000..cdb7c02c0fd8 --- /dev/null +++ b/samples/client/echo_api/java/apache-httpclient/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java @@ -0,0 +1,47 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for TestFormObjectMultipartRequestMarker + */ +public class TestFormObjectMultipartRequestMarkerTest { + private final TestFormObjectMultipartRequestMarker model = new TestFormObjectMultipartRequestMarker(); + + /** + * Model tests for TestFormObjectMultipartRequestMarker + */ + @Test + public void testTestFormObjectMultipartRequestMarker() { + // TODO: test TestFormObjectMultipartRequestMarker + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES b/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES index d47a3b59b233..fac2028d5aa8 100644 --- a/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES +++ b/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES @@ -38,5 +38,7 @@ src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Query.java src/main/java/org/openapitools/client/model/StringEnumRef.java src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/feign-gson/api/openapi.yaml b/samples/client/echo_api/java/feign-gson/api/openapi.yaml index fc7f3a922369..872fbe58b60b 100644 --- a/samples/client/echo_api/java/feign-gson/api/openapi.yaml +++ b/samples/client/echo_api/java/feign-gson/api/openapi.yaml @@ -101,6 +101,27 @@ paths: - form x-content-type: application/x-www-form-urlencoded x-accepts: text/plain + /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 + x-content-type: multipart/form-data + x-accepts: text/plain /header/integer/boolean/string/enums: get: description: Test header parameter(s) @@ -907,6 +928,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: diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java index 9c3775be59c3..45e0360081ba 100644 --- a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/api/FormApi.java @@ -4,6 +4,7 @@ import org.openapitools.client.EncodingUtils; import org.openapitools.client.model.ApiResponse; +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; import java.util.ArrayList; import java.util.HashMap; @@ -48,6 +49,35 @@ public interface FormApi extends ApiClient.Api { + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return String + */ + @RequestLine("POST /form/object/multipart") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: text/plain", + }) + String testFormObjectMultipart(@Param("marker") TestFormObjectMultipartRequestMarker marker); + + /** + * Test form parameter(s) for multipart schema + * Similar to testFormObjectMultipart but it also returns the http response headers . + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /form/object/multipart") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: text/plain", + }) + ApiResponse testFormObjectMultipartWithHttpInfo(@Param("marker") TestFormObjectMultipartRequestMarker marker); + + + /** * Test form parameter(s) for oneOf schema * Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java new file mode 100644 index 000000000000..96f0b78cfa85 --- /dev/null +++ b/samples/client/echo_api/java/feign-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -0,0 +1,97 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** + * TestFormObjectMultipartRequestMarker + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +public class TestFormObjectMultipartRequestMarker { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public TestFormObjectMultipartRequestMarker() { + } + + public TestFormObjectMultipartRequestMarker name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestFormObjectMultipartRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/echo_api/java/feign-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/feign-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java new file mode 100644 index 000000000000..691d9cab56a9 --- /dev/null +++ b/samples/client/echo_api/java/feign-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java @@ -0,0 +1,46 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestFormObjectMultipartRequestMarker + */ +class TestFormObjectMultipartRequestMarkerTest { + private final TestFormObjectMultipartRequestMarker model = new TestFormObjectMultipartRequestMarker(); + + /** + * Model tests for TestFormObjectMultipartRequestMarker + */ + @Test + void testTestFormObjectMultipartRequestMarker() { + // TODO: test TestFormObjectMultipartRequestMarker + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/native/.openapi-generator/FILES b/samples/client/echo_api/java/native/.openapi-generator/FILES index a8e8a3b8cc8c..0ea6f9c88927 100644 --- a/samples/client/echo_api/java/native/.openapi-generator/FILES +++ b/samples/client/echo_api/java/native/.openapi-generator/FILES @@ -20,6 +20,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 @@ -56,5 +57,7 @@ src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Query.java src/main/java/org/openapitools/client/model/StringEnumRef.java src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/native/README.md b/samples/client/echo_api/java/native/README.md index a2c8cf10d2f3..d14399b78a7d 100644 --- a/samples/client/echo_api/java/native/README.md +++ b/samples/client/echo_api/java/native/README.md @@ -132,6 +132,8 @@ Class | Method | HTTP request | Description *BodyApi* | [**testEchoBodyTagResponseStringWithHttpInfo**](docs/BodyApi.md#testEchoBodyTagResponseStringWithHttpInfo) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) *FormApi* | [**testFormIntegerBooleanStringWithHttpInfo**](docs/FormApi.md#testFormIntegerBooleanStringWithHttpInfo) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**testFormObjectMultipart**](docs/FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema +*FormApi* | [**testFormObjectMultipartWithHttpInfo**](docs/FormApi.md#testFormObjectMultipartWithHttpInfo) | **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 *FormApi* | [**testFormOneofWithHttpInfo**](docs/FormApi.md#testFormOneofWithHttpInfo) | **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) @@ -171,6 +173,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/java/native/api/openapi.yaml b/samples/client/echo_api/java/native/api/openapi.yaml index fc7f3a922369..872fbe58b60b 100644 --- a/samples/client/echo_api/java/native/api/openapi.yaml +++ b/samples/client/echo_api/java/native/api/openapi.yaml @@ -101,6 +101,27 @@ paths: - form x-content-type: application/x-www-form-urlencoded x-accepts: text/plain + /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 + x-content-type: multipart/form-data + x-accepts: text/plain /header/integer/boolean/string/enums: get: description: Test header parameter(s) @@ -907,6 +928,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: diff --git a/samples/client/echo_api/java/native/docs/FormApi.md b/samples/client/echo_api/java/native/docs/FormApi.md index 435271bcedf7..e1d52ae5e079 100644 --- a/samples/client/echo_api/java/native/docs/FormApi.md +++ b/samples/client/echo_api/java/native/docs/FormApi.md @@ -6,6 +6,8 @@ All URIs are relative to *http://localhost:3000* |------------- | ------------- | -------------| | [**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) | | [**testFormIntegerBooleanStringWithHttpInfo**](FormApi.md#testFormIntegerBooleanStringWithHttpInfo) | **POST** /form/integer/boolean/string | Test form parameter(s) | +| [**testFormObjectMultipart**](FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema | +| [**testFormObjectMultipartWithHttpInfo**](FormApi.md#testFormObjectMultipartWithHttpInfo) | **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 | | [**testFormOneofWithHttpInfo**](FormApi.md#testFormOneofWithHttpInfo) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | @@ -153,6 +155,140 @@ No authorization required | **200** | Successful operation | - | +## testFormObjectMultipart + +> String testFormObjectMultipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker | + try { + String result = apiInstance.testFormObjectMultipart(marker); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormObjectMultipart"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **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 | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + +## testFormObjectMultipartWithHttpInfo + +> ApiResponse testFormObjectMultipart testFormObjectMultipartWithHttpInfo(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker | + try { + ApiResponse response = apiInstance.testFormObjectMultipartWithHttpInfo(marker); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormObjectMultipart"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **marker** | [**TestFormObjectMultipartRequestMarker**](TestFormObjectMultipartRequestMarker.md)| | | + +### Return type + +ApiResponse<**String**> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + ## testFormOneof > String testFormOneof(form1, form2, form3, form4, id, name) diff --git a/samples/client/echo_api/java/native/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/java/native/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..3e67574f36d3 --- /dev/null +++ b/samples/client/echo_api/java/native/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,13 @@ + + +# TestFormObjectMultipartRequestMarker + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java index db63ec703ea3..ecb6239d617f 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/api/FormApi.java @@ -17,6 +17,7 @@ import org.openapitools.client.ApiResponse; import org.openapitools.client.Pair; +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -185,6 +186,117 @@ private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(Integer i } return localVarRequestBuilder; } + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return String + * @throws ApiException if fails to make API call + */ + public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker) throws ApiException { + ApiResponse localVarResponse = testFormObjectMultipartWithHttpInfo(marker); + return localVarResponse.getData(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + */ + public ApiResponse testFormObjectMultipartWithHttpInfo(TestFormObjectMultipartRequestMarker marker) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = testFormObjectMultipartRequestBuilder(marker); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("testFormObjectMultipart", localVarResponse); + } + // for plain text response + if (localVarResponse.headers().map().containsKey("Content-Type") && + "text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) { + java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A"); + String responseBodyText = s.hasNext() ? s.next() : ""; + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBodyText + ); + } else { + throw new RuntimeException("Error! The response Content-Type is supposed to be `text/plain` but it's not: " + localVarResponse); + } + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder testFormObjectMultipartRequestBuilder(TestFormObjectMultipartRequestMarker marker) throws ApiException { + // verify the required parameter 'marker' is set + if (marker == null) { + throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/form/object/multipart"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "text/plain"); + + MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create(); + boolean hasFiles = false; + multiPartBuilder.addTextBody("marker", marker.toString()); + HttpEntity entity = multiPartBuilder.build(); + HttpRequest.BodyPublisher formDataPublisher; + if (hasFiles) { + Pipe pipe; + try { + pipe = Pipe.open(); + } catch (IOException e) { + throw new RuntimeException(e); + } + new Thread(() -> { + try (OutputStream outputStream = Channels.newOutputStream(pipe.sink())) { + entity.writeTo(outputStream); + } catch (IOException e) { + e.printStackTrace(); + } + }).start(); + formDataPublisher = HttpRequest.BodyPublishers.ofInputStream(() -> Channels.newInputStream(pipe.source())); + } else { + ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream(); + try { + entity.writeTo(formOutputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } + formDataPublisher = HttpRequest.BodyPublishers + .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())); + } + localVarRequestBuilder + .header("Content-Type", entity.getContentType().getValue()) + .method("POST", formDataPublisher); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } /** * Test form parameter(s) for oneOf schema * Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java new file mode 100644 index 000000000000..c84ea1893032 --- /dev/null +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -0,0 +1,150 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * TestFormObjectMultipartRequestMarker + */ +@JsonPropertyOrder({ + TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +public class TestFormObjectMultipartRequestMarker { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public TestFormObjectMultipartRequestMarker() { + } + + public TestFormObjectMultipartRequestMarker name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + + /** + * Return true if this test_form_object_multipart_request_marker object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestFormObjectMultipartRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java new file mode 100644 index 000000000000..f4dc3543e6ce --- /dev/null +++ b/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java @@ -0,0 +1,48 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for TestFormObjectMultipartRequestMarker + */ +public class TestFormObjectMultipartRequestMarkerTest { + private final TestFormObjectMultipartRequestMarker model = new TestFormObjectMultipartRequestMarker(); + + /** + * Model tests for TestFormObjectMultipartRequestMarker + */ + @Test + public void testTestFormObjectMultipartRequestMarker() { + // TODO: test TestFormObjectMultipartRequestMarker + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES b/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES index 28fb8df54a4e..be65eb6dc263 100644 --- a/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES +++ b/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES @@ -20,6 +20,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 @@ -64,5 +65,7 @@ src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Query.java src/main/java/org/openapitools/client/model/StringEnumRef.java src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/okhttp-gson/README.md b/samples/client/echo_api/java/okhttp-gson/README.md index 0b84831a1e43..785b6c030300 100644 --- a/samples/client/echo_api/java/okhttp-gson/README.md +++ b/samples/client/echo_api/java/okhttp-gson/README.md @@ -132,6 +132,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) @@ -158,6 +159,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/java/okhttp-gson/api/openapi.yaml b/samples/client/echo_api/java/okhttp-gson/api/openapi.yaml index fc7f3a922369..872fbe58b60b 100644 --- a/samples/client/echo_api/java/okhttp-gson/api/openapi.yaml +++ b/samples/client/echo_api/java/okhttp-gson/api/openapi.yaml @@ -101,6 +101,27 @@ paths: - form x-content-type: application/x-www-form-urlencoded x-accepts: text/plain + /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 + x-content-type: multipart/form-data + x-accepts: text/plain /header/integer/boolean/string/enums: get: description: Test header parameter(s) @@ -907,6 +928,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: diff --git a/samples/client/echo_api/java/okhttp-gson/docs/FormApi.md b/samples/client/echo_api/java/okhttp-gson/docs/FormApi.md index 4bb3395781ad..836fc999837c 100644 --- a/samples/client/echo_api/java/okhttp-gson/docs/FormApi.md +++ b/samples/client/echo_api/java/okhttp-gson/docs/FormApi.md @@ -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 | @@ -74,6 +75,68 @@ No authorization required |-------------|-------------|------------------| | **200** | Successful operation | - | + +# **testFormObjectMultipart** +> String testFormObjectMultipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker | + try { + String result = apiInstance.testFormObjectMultipart(marker); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormObjectMultipart"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **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 | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + # **testFormOneof** > String testFormOneof(form1, form2, form3, form4, id, name) diff --git a/samples/client/echo_api/java/okhttp-gson/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/java/okhttp-gson/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..3e67574f36d3 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,13 @@ + + +# TestFormObjectMultipartRequestMarker + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index 00da6bda9dee..1520a2c93573 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -107,6 +107,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.NumberPropertiesOnly.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TestFormObjectMultipartRequestMarker.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/FormApi.java index c8672dc2b18b..92a270914dd2 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/api/FormApi.java @@ -27,6 +27,7 @@ import java.io.IOException; +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; import java.lang.reflect.Type; import java.util.ArrayList; @@ -209,6 +210,133 @@ public okhttp3.Call testFormIntegerBooleanStringAsync(Integer integerForm, Boole localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for testFormObjectMultipart + * @param marker (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormObjectMultipartCall(TestFormObjectMultipartRequestMarker marker, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/form/object/multipart"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marker != null) { + localVarFormParams.put("marker", marker); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + 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 testFormObjectMultipartValidateBeforeCall(TestFormObjectMultipartRequestMarker marker, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'marker' is set + if (marker == null) { + throw new ApiException("Missing the required parameter 'marker' when calling testFormObjectMultipart(Async)"); + } + + return testFormObjectMultipartCall(marker, _callback); + + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker) throws ApiException { + ApiResponse localVarResp = testFormObjectMultipartWithHttpInfo(marker); + return localVarResp.getData(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testFormObjectMultipartWithHttpInfo(TestFormObjectMultipartRequestMarker marker) throws ApiException { + okhttp3.Call localVarCall = testFormObjectMultipartValidateBeforeCall(marker, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test form parameter(s) for multipart schema (asynchronously) + * Test form parameter(s) for multipart schema + * @param marker (required) + * @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 + + + +
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormObjectMultipartAsync(TestFormObjectMultipartRequestMarker marker, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testFormObjectMultipartValidateBeforeCall(marker, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for testFormOneof * @param form1 (optional) diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java new file mode 100644 index 000000000000..b8882cabf0cf --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -0,0 +1,206 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestFormObjectMultipartRequestMarker + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +public class TestFormObjectMultipartRequestMarker { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public TestFormObjectMultipartRequestMarker() { + } + + public TestFormObjectMultipartRequestMarker name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestFormObjectMultipartRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TestFormObjectMultipartRequestMarker + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TestFormObjectMultipartRequestMarker.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TestFormObjectMultipartRequestMarker is not found in the empty JSON string", TestFormObjectMultipartRequestMarker.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TestFormObjectMultipartRequestMarker.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TestFormObjectMultipartRequestMarker` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TestFormObjectMultipartRequestMarker.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TestFormObjectMultipartRequestMarker' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TestFormObjectMultipartRequestMarker.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TestFormObjectMultipartRequestMarker value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TestFormObjectMultipartRequestMarker read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TestFormObjectMultipartRequestMarker given an JSON string + * + * @param jsonString JSON string + * @return An instance of TestFormObjectMultipartRequestMarker + * @throws IOException if the JSON string is invalid with respect to TestFormObjectMultipartRequestMarker + */ + public static TestFormObjectMultipartRequestMarker fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TestFormObjectMultipartRequestMarker.class); + } + + /** + * Convert an instance of TestFormObjectMultipartRequestMarker to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java new file mode 100644 index 000000000000..6e72ea994191 --- /dev/null +++ b/samples/client/echo_api/java/okhttp-gson/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java @@ -0,0 +1,48 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestFormObjectMultipartRequestMarker + */ +public class TestFormObjectMultipartRequestMarkerTest { + private final TestFormObjectMultipartRequestMarker model = new TestFormObjectMultipartRequestMarker(); + + /** + * Model tests for TestFormObjectMultipartRequestMarker + */ + @Test + public void testTestFormObjectMultipartRequestMarker() { + // TODO: test TestFormObjectMultipartRequestMarker + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/resteasy/.openapi-generator/FILES b/samples/client/echo_api/java/resteasy/.openapi-generator/FILES index 2ff641b20af8..813b02156e09 100644 --- a/samples/client/echo_api/java/resteasy/.openapi-generator/FILES +++ b/samples/client/echo_api/java/resteasy/.openapi-generator/FILES @@ -20,6 +20,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 @@ -60,5 +61,7 @@ src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Query.java src/main/java/org/openapitools/client/model/StringEnumRef.java src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/resteasy/README.md b/samples/client/echo_api/java/resteasy/README.md index 99407f338763..82f33115af48 100644 --- a/samples/client/echo_api/java/resteasy/README.md +++ b/samples/client/echo_api/java/resteasy/README.md @@ -132,6 +132,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) @@ -158,6 +159,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/java/resteasy/api/openapi.yaml b/samples/client/echo_api/java/resteasy/api/openapi.yaml index fc7f3a922369..872fbe58b60b 100644 --- a/samples/client/echo_api/java/resteasy/api/openapi.yaml +++ b/samples/client/echo_api/java/resteasy/api/openapi.yaml @@ -101,6 +101,27 @@ paths: - form x-content-type: application/x-www-form-urlencoded x-accepts: text/plain + /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 + x-content-type: multipart/form-data + x-accepts: text/plain /header/integer/boolean/string/enums: get: description: Test header parameter(s) @@ -907,6 +928,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: diff --git a/samples/client/echo_api/java/resteasy/docs/FormApi.md b/samples/client/echo_api/java/resteasy/docs/FormApi.md index 1f3ad73e9384..a9b7132b732c 100644 --- a/samples/client/echo_api/java/resteasy/docs/FormApi.md +++ b/samples/client/echo_api/java/resteasy/docs/FormApi.md @@ -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 | @@ -79,6 +80,72 @@ No authorization required | **200** | Successful operation | - | +## testFormObjectMultipart + +> String testFormObjectMultipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker | + try { + String result = apiInstance.testFormObjectMultipart(marker); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormObjectMultipart"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **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 | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + ## testFormOneof > String testFormOneof(form1, form2, form3, form4, id, name) diff --git a/samples/client/echo_api/java/resteasy/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/java/resteasy/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..3e67574f36d3 --- /dev/null +++ b/samples/client/echo_api/java/resteasy/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,13 @@ + + +# TestFormObjectMultipartRequestMarker + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/api/FormApi.java index 4db7b714d952..7e801fc40a07 100644 --- a/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/api/FormApi.java @@ -7,6 +7,7 @@ import javax.ws.rs.core.GenericType; +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; import java.util.ArrayList; import java.util.HashMap; @@ -80,6 +81,51 @@ public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanF return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return a {@code String} + * @throws ApiException if fails to make API call + */ + public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'marker' is set + if (marker == null) { + throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); + } + + // create path and map variables + String localVarPath = "/form/object/multipart".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (marker != null) + localVarFormParams.put("marker", marker); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** * Test form parameter(s) for oneOf schema * Test form parameter(s) for oneOf schema * @param form1 (optional) diff --git a/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java new file mode 100644 index 000000000000..84a953d9a7fb --- /dev/null +++ b/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -0,0 +1,104 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * TestFormObjectMultipartRequestMarker + */ +@JsonPropertyOrder({ + TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME +}) +@JsonTypeName("test_form_object_multipart_request_marker") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +public class TestFormObjectMultipartRequestMarker { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public TestFormObjectMultipartRequestMarker() { + } + + public TestFormObjectMultipartRequestMarker name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestFormObjectMultipartRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java new file mode 100644 index 000000000000..cdb7c02c0fd8 --- /dev/null +++ b/samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java @@ -0,0 +1,47 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for TestFormObjectMultipartRequestMarker + */ +public class TestFormObjectMultipartRequestMarkerTest { + private final TestFormObjectMultipartRequestMarker model = new TestFormObjectMultipartRequestMarker(); + + /** + * Model tests for TestFormObjectMultipartRequestMarker + */ + @Test + public void testTestFormObjectMultipartRequestMarker() { + // TODO: test TestFormObjectMultipartRequestMarker + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES b/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES index 9f6928c38e5d..fe3e53ee20cf 100644 --- a/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES +++ b/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES @@ -20,6 +20,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 @@ -56,5 +57,7 @@ src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Query.java src/main/java/org/openapitools/client/model/StringEnumRef.java src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/resttemplate/README.md b/samples/client/echo_api/java/resttemplate/README.md index 682c72c0115d..2de81123ebf2 100644 --- a/samples/client/echo_api/java/resttemplate/README.md +++ b/samples/client/echo_api/java/resttemplate/README.md @@ -132,6 +132,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) @@ -158,6 +159,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/java/resttemplate/api/openapi.yaml b/samples/client/echo_api/java/resttemplate/api/openapi.yaml index fc7f3a922369..872fbe58b60b 100644 --- a/samples/client/echo_api/java/resttemplate/api/openapi.yaml +++ b/samples/client/echo_api/java/resttemplate/api/openapi.yaml @@ -101,6 +101,27 @@ paths: - form x-content-type: application/x-www-form-urlencoded x-accepts: text/plain + /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 + x-content-type: multipart/form-data + x-accepts: text/plain /header/integer/boolean/string/enums: get: description: Test header parameter(s) @@ -907,6 +928,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: diff --git a/samples/client/echo_api/java/resttemplate/docs/FormApi.md b/samples/client/echo_api/java/resttemplate/docs/FormApi.md index 1f3ad73e9384..a9b7132b732c 100644 --- a/samples/client/echo_api/java/resttemplate/docs/FormApi.md +++ b/samples/client/echo_api/java/resttemplate/docs/FormApi.md @@ -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 | @@ -79,6 +80,72 @@ No authorization required | **200** | Successful operation | - | +## testFormObjectMultipart + +> String testFormObjectMultipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker | + try { + String result = apiInstance.testFormObjectMultipart(marker); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormObjectMultipart"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **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 | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + ## testFormOneof > String testFormOneof(form1, form2, form3, form4, id, name) diff --git a/samples/client/echo_api/java/resttemplate/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/java/resttemplate/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..3e67574f36d3 --- /dev/null +++ b/samples/client/echo_api/java/resttemplate/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,13 @@ + + +# TestFormObjectMultipartRequestMarker + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/api/FormApi.java index 7d4315e1f2ab..19bea3a1b220 100644 --- a/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/api/FormApi.java +++ b/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/api/FormApi.java @@ -3,6 +3,7 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.BaseApi; +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; import java.util.Collections; import java.util.HashMap; @@ -90,6 +91,57 @@ public ResponseEntity testFormIntegerBooleanStringWithHttpInfo(Integer i ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/form/integer/boolean/string", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + *

200 - Successful operation + * @param marker (required) + * @return String + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker) throws RestClientException { + return testFormObjectMultipartWithHttpInfo(marker).getBody(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + *

200 - Successful operation + * @param marker (required) + * @return ResponseEntity<String> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity testFormObjectMultipartWithHttpInfo(TestFormObjectMultipartRequestMarker marker) throws RestClientException { + Object localVarPostBody = null; + + // verify the required parameter 'marker' is set + if (marker == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); + } + + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + if (marker != null) + localVarFormParams.add("marker", marker); + + final String[] localVarAccepts = { + "text/plain" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/form/object/multipart", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * Test form parameter(s) for oneOf schema * Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java new file mode 100644 index 000000000000..84a953d9a7fb --- /dev/null +++ b/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -0,0 +1,104 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * TestFormObjectMultipartRequestMarker + */ +@JsonPropertyOrder({ + TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME +}) +@JsonTypeName("test_form_object_multipart_request_marker") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0-SNAPSHOT") +public class TestFormObjectMultipartRequestMarker { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public TestFormObjectMultipartRequestMarker() { + } + + public TestFormObjectMultipartRequestMarker name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestFormObjectMultipartRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/echo_api/java/resttemplate/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/resttemplate/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java new file mode 100644 index 000000000000..cdb7c02c0fd8 --- /dev/null +++ b/samples/client/echo_api/java/resttemplate/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java @@ -0,0 +1,47 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for TestFormObjectMultipartRequestMarker + */ +public class TestFormObjectMultipartRequestMarkerTest { + private final TestFormObjectMultipartRequestMarker model = new TestFormObjectMultipartRequestMarker(); + + /** + * Model tests for TestFormObjectMultipartRequestMarker + */ + @Test + public void testTestFormObjectMultipartRequestMarker() { + // TODO: test TestFormObjectMultipartRequestMarker + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/php-nextgen/.openapi-generator/FILES b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES index 82705c8ca1df..b957a1699ecb 100644 --- a/samples/client/echo_api/php-nextgen/.openapi-generator/FILES +++ b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES @@ -19,6 +19,7 @@ docs/Model/Pet.md docs/Model/Query.md docs/Model/StringEnumRef.md docs/Model/Tag.md +docs/Model/TestFormObjectMultipartRequestMarker.md docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md git_push.sh @@ -42,6 +43,8 @@ src/Model/Pet.php src/Model/Query.php src/Model/StringEnumRef.php src/Model/Tag.php +src/Model/TestFormObjectMultipartRequestMarker.php src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php src/ObjectSerializer.php +tests/Model/TestFormObjectMultipartRequestMarkerTest.php diff --git a/samples/client/echo_api/php-nextgen/README.md b/samples/client/echo_api/php-nextgen/README.md index 6a9854bf22c8..c251282b62c3 100644 --- a/samples/client/echo_api/php-nextgen/README.md +++ b/samples/client/echo_api/php-nextgen/README.md @@ -89,6 +89,7 @@ Class | Method | HTTP request | Description *BodyApi* | [**testEchoBodyStringEnum**](docs/Api/BodyApi.md#testechobodystringenum) | **POST** /echo/body/string_enum | Test string enum response body *BodyApi* | [**testEchoBodyTagResponseString**](docs/Api/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *FormApi* | [**testFormIntegerBooleanString**](docs/Api/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**testFormObjectMultipart**](docs/Api/FormApi.md#testformobjectmultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema *FormApi* | [**testFormOneof**](docs/Api/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema *HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/Api/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) *PathApi* | [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/Api/PathApi.md#testspathstringpathstringintegerpathintegerenumnonrefstringpathenumrefstringpath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) @@ -114,6 +115,7 @@ Class | Method | HTTP request | Description - [Query](docs/Model/Query.md) - [StringEnumRef](docs/Model/StringEnumRef.md) - [Tag](docs/Model/Tag.md) +- [TestFormObjectMultipartRequestMarker](docs/Model/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/php-nextgen/docs/Api/FormApi.md b/samples/client/echo_api/php-nextgen/docs/Api/FormApi.md index 1321378cc07b..f9236a17214e 100644 --- a/samples/client/echo_api/php-nextgen/docs/Api/FormApi.md +++ b/samples/client/echo_api/php-nextgen/docs/Api/FormApi.md @@ -5,6 +5,7 @@ All URIs are relative to http://localhost:3000, except if the operation defines | 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 | @@ -68,6 +69,62 @@ No authorization required [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `testFormObjectMultipart()` + +```php +testFormObjectMultipart($marker): string +``` + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + +```php +testFormObjectMultipart($marker); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FormApi->testFormObjectMultipart: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **marker** | [**\OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker**](../Model/TestFormObjectMultipartRequestMarker.md)| | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `multipart/form-data` +- **Accept**: `text/plain` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `testFormOneof()` ```php diff --git a/samples/client/echo_api/php-nextgen/docs/Model/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/php-nextgen/docs/Model/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..212a07554ae2 --- /dev/null +++ b/samples/client/echo_api/php-nextgen/docs/Model/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,9 @@ +# # TestFormObjectMultipartRequestMarker + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php index 9c929585d041..483dfc3f9920 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php @@ -75,6 +75,9 @@ class FormApi 'testFormIntegerBooleanString' => [ 'application/x-www-form-urlencoded', ], + 'testFormObjectMultipart' => [ + 'multipart/form-data', + ], 'testFormOneof' => [ 'application/x-www-form-urlencoded', ], @@ -468,6 +471,324 @@ public function testFormIntegerBooleanStringRequest( ); } + /** + * Operation testFormObjectMultipart + * + * Test form parameter(s) for multipart schema + * + * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker marker (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return string + */ + public function testFormObjectMultipart( + \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker, + string $contentType = self::contentTypes['testFormObjectMultipart'][0] + ): string + { + list($response) = $this->testFormObjectMultipartWithHttpInfo($marker, $contentType); + return $response; + } + + /** + * Operation testFormObjectMultipartWithHttpInfo + * + * Test form parameter(s) for multipart schema + * + * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function testFormObjectMultipartWithHttpInfo( + \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker, + string $contentType = self::contentTypes['testFormObjectMultipart'][0] + ): array + { + $request = $this->testFormObjectMultipartRequest($marker, $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 ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testFormObjectMultipartAsync + * + * Test form parameter(s) for multipart schema + * + * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function testFormObjectMultipartAsync( + \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker, + string $contentType = self::contentTypes['testFormObjectMultipart'][0] + ): PromiseInterface + { + return $this->testFormObjectMultipartAsyncWithHttpInfo($marker, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testFormObjectMultipartAsyncWithHttpInfo + * + * Test form parameter(s) for multipart schema + * + * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function testFormObjectMultipartAsyncWithHttpInfo( + $marker, + string $contentType = self::contentTypes['testFormObjectMultipart'][0] + ): PromiseInterface + { + $returnType = 'string'; + $request = $this->testFormObjectMultipartRequest($marker, $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 'testFormObjectMultipart' + * + * @param \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormObjectMultipart'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function testFormObjectMultipartRequest( + $marker, + string $contentType = self::contentTypes['testFormObjectMultipart'][0] + ): Request + { + + // verify the required parameter 'marker' is set + if ($marker === null || (is_array($marker) && count($marker) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $marker when calling testFormObjectMultipart' + ); + } + + + $resourcePath = '/form/object/multipart'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // form params + if ($marker !== null) { + $formParams['marker'] = ObjectSerializer::toFormValue($marker); + } + + $headers = $this->headerSelector->selectHeaders( + ['text/plain', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (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 testFormOneof * diff --git a/samples/client/echo_api/php-nextgen/src/Model/TestFormObjectMultipartRequestMarker.php b/samples/client/echo_api/php-nextgen/src/Model/TestFormObjectMultipartRequestMarker.php new file mode 100644 index 000000000000..1ee131c14bb2 --- /dev/null +++ b/samples/client/echo_api/php-nextgen/src/Model/TestFormObjectMultipartRequestMarker.php @@ -0,0 +1,408 @@ + + */ +class TestFormObjectMultipartRequestMarker implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'test_form_object_multipart_request_marker'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name name + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/echo_api/php-nextgen/tests/Model/TestFormObjectMultipartRequestMarkerTest.php b/samples/client/echo_api/php-nextgen/tests/Model/TestFormObjectMultipartRequestMarkerTest.php new file mode 100644 index 000000000000..30eb64c636a8 --- /dev/null +++ b/samples/client/echo_api/php-nextgen/tests/Model/TestFormObjectMultipartRequestMarkerTest.php @@ -0,0 +1,89 @@ + +# **Test-FormObjectMultipart** +> String Test-FormObjectMultipart
+>         [-Marker]
+ +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example +```powershell +$TestFormObjectMultipartRequestMarker = Initialize-TestFormObjectMultipartRequestMarker -Name "MyName" # TestFormObjectMultipartRequestMarker | + +# Test form parameter(s) for multipart schema +try { + $Result = Test-FormObjectMultipart -Marker $Marker +} catch { + Write-Host ("Exception occurred when calling Test-FormObjectMultipart: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) + Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json)) +} +``` + +### 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 + +[[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-FormOneof** > String Test-FormOneof
diff --git a/samples/client/echo_api/powershell/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/powershell/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..4356abc98d7f --- /dev/null +++ b/samples/client/echo_api/powershell/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,21 @@ +# TestFormObjectMultipartRequestMarker +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **String** | | [optional] + +## Examples + +- Prepare the resource +```powershell +$TestFormObjectMultipartRequestMarker = Initialize-PSOpenAPIToolsTestFormObjectMultipartRequestMarker -Name null +``` + +- Convert the resource to JSON +```powershell +$TestFormObjectMultipartRequestMarker | ConvertTo-JSON +``` + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/FormApi.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/FormApi.ps1 index 677221d160f7..7d7a960ae1c8 100644 --- a/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/FormApi.ps1 +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Api/FormApi.ps1 @@ -105,6 +105,83 @@ function Test-FormIntegerBooleanString { <# .SYNOPSIS +Test form parameter(s) for multipart schema + +.DESCRIPTION + +No description available. + +.PARAMETER Marker +No description available. + +.PARAMETER WithHttpInfo + +A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response + +.OUTPUTS + +String +#> +function Test-FormObjectMultipart { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)] + [PSCustomObject] + ${Marker}, + [Switch] + $WithHttpInfo + ) + + Process { + 'Calling method: Test-FormObjectMultipart' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $LocalVarAccepts = @() + $LocalVarContentTypes = @() + $LocalVarQueryParameters = @{} + $LocalVarHeaderParameters = @{} + $LocalVarFormParameters = @{} + $LocalVarPathParameters = @{} + $LocalVarCookieParameters = @{} + $LocalVarBodyParameter = $null + + $Configuration = Get-Configuration + # HTTP header 'Accept' (if needed) + $LocalVarAccepts = @('text/plain') + + # HTTP header 'Content-Type' + $LocalVarContentTypes = @('multipart/form-data') + + $LocalVarUri = '/form/object/multipart' + + if (!$Marker) { + throw "Error! The required parameter `Marker` missing when calling test_form_object_multipart." + } + $LocalVarFormParameters['marker'] = $Marker + + $LocalVarResult = Invoke-ApiClient -Method 'POST' ` + -Uri $LocalVarUri ` + -Accepts $LocalVarAccepts ` + -ContentTypes $LocalVarContentTypes ` + -Body $LocalVarBodyParameter ` + -HeaderParameters $LocalVarHeaderParameters ` + -QueryParameters $LocalVarQueryParameters ` + -FormParameters $LocalVarFormParameters ` + -CookieParameters $LocalVarCookieParameters ` + -ReturnType "String" ` + -IsBodyNullable $false + + if ($WithHttpInfo.IsPresent) { + return $LocalVarResult + } else { + return $LocalVarResult["Response"] + } + } +} + +<# +.SYNOPSIS + Test form parameter(s) for oneOf schema .DESCRIPTION diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestFormObjectMultipartRequestMarker.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestFormObjectMultipartRequestMarker.ps1 new file mode 100644 index 000000000000..b7dc812a9728 --- /dev/null +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Model/TestFormObjectMultipartRequestMarker.ps1 @@ -0,0 +1,98 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +<# +.SYNOPSIS + +No summary available. + +.DESCRIPTION + +No description available. + +.PARAMETER Name +No description available. +.OUTPUTS + +TestFormObjectMultipartRequestMarker +#> + +function Initialize-TestFormObjectMultipartRequestMarker { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [String] + ${Name} + ) + + Process { + 'Creating PSCustomObject: PSOpenAPITools => TestFormObjectMultipartRequestMarker' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + } + + + return $PSO + } +} + +<# +.SYNOPSIS + +Convert from JSON to TestFormObjectMultipartRequestMarker + +.DESCRIPTION + +Convert from JSON to TestFormObjectMultipartRequestMarker + +.PARAMETER Json + +Json object + +.OUTPUTS + +TestFormObjectMultipartRequestMarker +#> +function ConvertFrom-JsonToTestFormObjectMultipartRequestMarker { + Param( + [AllowEmptyString()] + [string]$Json + ) + + Process { + 'Converting JSON to PSCustomObject: PSOpenAPITools => TestFormObjectMultipartRequestMarker' | Write-Debug + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $JsonParameters = ConvertFrom-Json -InputObject $Json + + # check if Json contains properties not defined in TestFormObjectMultipartRequestMarker + $AllProperties = ("name") + foreach ($name in $JsonParameters.PsObject.Properties.Name) { + if (!($AllProperties.Contains($name))) { + throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" + } + } + + if (!([bool]($JsonParameters.PSobject.Properties.name -match "name"))) { #optional property not found + $Name = $null + } else { + $Name = $JsonParameters.PSobject.Properties["name"].value + } + + $PSO = [PSCustomObject]@{ + "name" = ${Name} + } + + return $PSO + } + +} + diff --git a/samples/client/echo_api/powershell/tests/Model/TestFormObjectMultipartRequestMarker.Tests.ps1 b/samples/client/echo_api/powershell/tests/Model/TestFormObjectMultipartRequestMarker.Tests.ps1 new file mode 100644 index 000000000000..1fa8c774ab98 --- /dev/null +++ b/samples/client/echo_api/powershell/tests/Model/TestFormObjectMultipartRequestMarker.Tests.ps1 @@ -0,0 +1,18 @@ +# +# Echo Server API +# Echo Server API +# Version: 0.1.0 +# Contact: team@openapitools.org +# Generated by OpenAPI Generator: https://openapi-generator.tech +# + +Describe -tag 'PSOpenAPITools' -name 'TestFormObjectMultipartRequestMarker' { + Context 'TestFormObjectMultipartRequestMarker' { + It 'Initialize-TestFormObjectMultipartRequestMarker' { + # a simple test to create an object + #$NewObject = Initialize-TestFormObjectMultipartRequestMarker -Name "TEST_VALUE" + #$NewObject | Should -BeOfType TestFormObjectMultipartRequestMarker + #$NewObject.property | Should -Be 0 + } + } +} diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES index 0723c3ab0dea..6a4ad19b323c 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES @@ -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 @@ -43,6 +44,7 @@ openapi_client/models/pet.py openapi_client/models/query.py openapi_client/models/string_enum_ref.py openapi_client/models/tag.py +openapi_client/models/test_form_object_multipart_request_marker.py openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py openapi_client/py.typed @@ -53,4 +55,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_test_form_object_multipart_request_marker.py tox.ini diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/README.md b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/README.md index 42487c28d4e2..22e467899846 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/README.md +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/README.md @@ -107,6 +107,7 @@ Class | Method | HTTP request | Description *BodyApi* | [**test_echo_body_string_enum**](docs/BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body *BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**test_form_object_multipart**](docs/FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema *FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema *HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) *PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) @@ -133,6 +134,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/FormApi.md b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/FormApi.md index 94205cd60e4a..86ae2be36975 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/FormApi.md +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/FormApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000* Method | HTTP request | Description ------------- | ------------- | ------------- [**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +[**test_form_object_multipart**](FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema [**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema @@ -79,6 +80,74 @@ 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_form_object_multipart** +> str test_form_object_multipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + + +```python +import openapi_client +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker +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.FormApi(api_client) + marker = openapi_client.TestFormObjectMultipartRequestMarker() # TestFormObjectMultipartRequestMarker | + + try: + # Test form parameter(s) for multipart schema + api_response = api_instance.test_form_object_multipart(marker) + print("The response of FormApi->test_form_object_multipart:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FormApi->test_form_object_multipart: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestFormObjectMultipartRequestMarker**](TestFormObjectMultipartRequestMarker.md)| | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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) + # **test_form_oneof** > str test_form_oneof(form1=form1, form2=form2, form3=form3, form4=form4, id=id, name=name) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..254c3b6a045a --- /dev/null +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,29 @@ +# TestFormObjectMultipartRequestMarker + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker + +# TODO update the JSON string below +json = "{}" +# create an instance of TestFormObjectMultipartRequestMarker from a JSON string +test_form_object_multipart_request_marker_instance = TestFormObjectMultipartRequestMarker.from_json(json) +# print the JSON string representation of the object +print(TestFormObjectMultipartRequestMarker.to_json()) + +# convert the object into a dict +test_form_object_multipart_request_marker_dict = test_form_object_multipart_request_marker_instance.to_dict() +# create an instance of TestFormObjectMultipartRequestMarker from a dict +test_form_object_multipart_request_marker_form_dict = test_form_object_multipart_request_marker.from_dict(test_form_object_multipart_request_marker_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/__init__.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/__init__.py index 7b67f7c597fb..3f63fe12abdb 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/__init__.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/__init__.py @@ -46,5 +46,6 @@ from openapi_client.models.query import Query from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.models.tag import Tag +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api/form_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api/form_api.py index 7c0959bd94ec..48f4dcf80b06 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api/form_api.py @@ -19,6 +19,7 @@ from pydantic import StrictBool, StrictInt, StrictStr from typing import Optional +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.api_client import ApiClient, RequestSerialized from openapi_client.api_response import ApiResponse @@ -338,6 +339,276 @@ def _test_form_integer_boolean_string_serialize( + @validate_call + def test_form_object_multipart( + self, + marker: TestFormObjectMultipartRequestMarker, + _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, + ) -> str: + """Test form parameter(s) for multipart schema + + Test form parameter(s) for multipart schema + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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_form_object_multipart_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + 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_form_object_multipart_with_http_info( + self, + marker: TestFormObjectMultipartRequestMarker, + _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[str]: + """Test form parameter(s) for multipart schema + + Test form parameter(s) for multipart schema + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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_form_object_multipart_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + 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_form_object_multipart_without_preload_content( + self, + marker: TestFormObjectMultipartRequestMarker, + _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 form parameter(s) for multipart schema + + Test form parameter(s) for multipart schema + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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_form_object_multipart_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _test_form_object_multipart_serialize( + self, + marker, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _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, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if marker is not None: + _form_params.append(('marker', marker)) + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + # 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( + [ + 'multipart/form-data' + ] + ) + ) + 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='/form/object/multipart', + 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_form_oneof( self, diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/__init__.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/__init__.py index 4b981699e6a0..f070f6323167 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/__init__.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/__init__.py @@ -24,5 +24,6 @@ from openapi_client.models.query import Query from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.models.tag import Tag +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/test_form_object_multipart_request_marker.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/test_form_object_multipart_request_marker.py new file mode 100644 index 000000000000..9fab70ea178d --- /dev/null +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/test_form_object_multipart_request_marker.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TestFormObjectMultipartRequestMarker(BaseModel): + """ + TestFormObjectMultipartRequestMarker + """ # noqa: E501 + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TestFormObjectMultipartRequestMarker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TestFormObjectMultipartRequestMarker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + # raise errors for additional fields in the input + for _key in obj.keys(): + if _key not in cls.__properties: + raise ValueError("Error due to additional fields (not defined in TestFormObjectMultipartRequestMarker) in the input: " + _key) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py new file mode 100644 index 000000000000..d49974286060 --- /dev/null +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker + +class TestTestFormObjectMultipartRequestMarker(unittest.TestCase): + """TestFormObjectMultipartRequestMarker unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestFormObjectMultipartRequestMarker: + """Test TestFormObjectMultipartRequestMarker + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TestFormObjectMultipartRequestMarker` + """ + model = TestFormObjectMultipartRequestMarker() + if include_optional: + return TestFormObjectMultipartRequestMarker( + name = '' + ) + else: + return TestFormObjectMultipartRequestMarker( + ) + """ + + def testTestFormObjectMultipartRequestMarker(self): + """Test TestFormObjectMultipartRequestMarker""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES index 0723c3ab0dea..6a4ad19b323c 100644 --- a/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES +++ b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES @@ -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 @@ -43,6 +44,7 @@ openapi_client/models/pet.py openapi_client/models/query.py openapi_client/models/string_enum_ref.py openapi_client/models/tag.py +openapi_client/models/test_form_object_multipart_request_marker.py openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py openapi_client/py.typed @@ -53,4 +55,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_test_form_object_multipart_request_marker.py tox.ini diff --git a/samples/client/echo_api/python-pydantic-v1/README.md b/samples/client/echo_api/python-pydantic-v1/README.md index a566e0673e41..87aa115b3d9b 100644 --- a/samples/client/echo_api/python-pydantic-v1/README.md +++ b/samples/client/echo_api/python-pydantic-v1/README.md @@ -108,6 +108,7 @@ Class | Method | HTTP request | Description *BodyApi* | [**test_echo_body_string_enum**](docs/BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body *BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**test_form_object_multipart**](docs/FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema *FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema *HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) *PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) @@ -134,6 +135,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/python-pydantic-v1/docs/FormApi.md b/samples/client/echo_api/python-pydantic-v1/docs/FormApi.md index c823e4b82ae4..56841c42d416 100644 --- a/samples/client/echo_api/python-pydantic-v1/docs/FormApi.md +++ b/samples/client/echo_api/python-pydantic-v1/docs/FormApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000* Method | HTTP request | Description ------------- | ------------- | ------------- [**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +[**test_form_object_multipart**](FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema [**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema @@ -78,6 +79,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_form_object_multipart** +> str test_form_object_multipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker +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.FormApi(api_client) + marker = openapi_client.TestFormObjectMultipartRequestMarker() # TestFormObjectMultipartRequestMarker | + + try: + # Test form parameter(s) for multipart schema + api_response = api_instance.test_form_object_multipart(marker) + print("The response of FormApi->test_form_object_multipart:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FormApi->test_form_object_multipart: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestFormObjectMultipartRequestMarker**](TestFormObjectMultipartRequestMarker.md)| | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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) + # **test_form_oneof** > str test_form_oneof(form1=form1, form2=form2, form3=form3, form4=form4, id=id, name=name) diff --git a/samples/client/echo_api/python-pydantic-v1/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/python-pydantic-v1/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..bccc9a9405f7 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,28 @@ +# TestFormObjectMultipartRequestMarker + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker + +# TODO update the JSON string below +json = "{}" +# create an instance of TestFormObjectMultipartRequestMarker from a JSON string +test_form_object_multipart_request_marker_instance = TestFormObjectMultipartRequestMarker.from_json(json) +# print the JSON string representation of the object +print TestFormObjectMultipartRequestMarker.to_json() + +# convert the object into a dict +test_form_object_multipart_request_marker_dict = test_form_object_multipart_request_marker_instance.to_dict() +# create an instance of TestFormObjectMultipartRequestMarker from a dict +test_form_object_multipart_request_marker_form_dict = test_form_object_multipart_request_marker.from_dict(test_form_object_multipart_request_marker_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py index 7b67f7c597fb..3f63fe12abdb 100644 --- a/samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py @@ -46,5 +46,6 @@ from openapi_client.models.query import Query from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.models.tag import Tag +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py index 7b0f9720c6c9..4d33489816c6 100644 --- a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py @@ -23,6 +23,7 @@ from typing import Optional +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.api_client import ApiClient from openapi_client.api_response import ApiResponse @@ -207,6 +208,153 @@ def test_form_integer_boolean_string_with_http_info(self, integer_form : Optiona collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) + @validate_arguments + def test_form_object_multipart(self, marker : TestFormObjectMultipartRequestMarker, **kwargs) -> str: # noqa: E501 + """Test form parameter(s) for multipart schema # noqa: E501 + + Test form parameter(s) for multipart schema # 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_form_object_multipart(marker, async_req=True) + >>> result = thread.get() + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_form_object_multipart_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_form_object_multipart_with_http_info(marker, **kwargs) # noqa: E501 + + @validate_arguments + def test_form_object_multipart_with_http_info(self, marker : TestFormObjectMultipartRequestMarker, **kwargs) -> ApiResponse: # noqa: E501 + """Test form parameter(s) for multipart schema # noqa: E501 + + Test form parameter(s) for multipart schema # 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_form_object_multipart_with_http_info(marker, async_req=True) + >>> result = thread.get() + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'marker' + ] + _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_form_object_multipart" % _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 = {} + if _params['marker'] is not None: + _form_params.append(('marker', _params['marker'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/form/object/multipart', '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_form_oneof(self, form1 : Optional[StrictStr] = None, form2 : Optional[StrictInt] = None, form3 : Optional[StrictStr] = None, form4 : Optional[StrictBool] = None, id : Optional[StrictInt] = None, name : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 """Test form parameter(s) for oneOf schema # noqa: E501 diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py index 4b981699e6a0..f070f6323167 100644 --- a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py @@ -24,5 +24,6 @@ from openapi_client.models.query import Query from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.models.tag import Tag +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_form_object_multipart_request_marker.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_form_object_multipart_request_marker.py new file mode 100644 index 000000000000..54ea54fd8d27 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_form_object_multipart_request_marker.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class TestFormObjectMultipartRequestMarker(BaseModel): + """ + TestFormObjectMultipartRequestMarker + """ + name: Optional[StrictStr] = None + __properties = ["name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> TestFormObjectMultipartRequestMarker: + """Create an instance of TestFormObjectMultipartRequestMarker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> TestFormObjectMultipartRequestMarker: + """Create an instance of TestFormObjectMultipartRequestMarker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TestFormObjectMultipartRequestMarker.parse_obj(obj) + + _obj = TestFormObjectMultipartRequestMarker.parse_obj({ + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_form_object_multipart_request_marker.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_form_object_multipart_request_marker.py new file mode 100644 index 000000000000..4dfd5a5c6242 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_test_form_object_multipart_request_marker.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker # noqa: E501 + +class TestTestFormObjectMultipartRequestMarker(unittest.TestCase): + """TestFormObjectMultipartRequestMarker unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestFormObjectMultipartRequestMarker: + """Test TestFormObjectMultipartRequestMarker + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TestFormObjectMultipartRequestMarker` + """ + model = TestFormObjectMultipartRequestMarker() # noqa: E501 + if include_optional: + return TestFormObjectMultipartRequestMarker( + name = '' + ) + else: + return TestFormObjectMultipartRequestMarker( + ) + """ + + def testTestFormObjectMultipartRequestMarker(self): + """Test TestFormObjectMultipartRequestMarker""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python/.openapi-generator/FILES b/samples/client/echo_api/python/.openapi-generator/FILES index 0723c3ab0dea..6a4ad19b323c 100644 --- a/samples/client/echo_api/python/.openapi-generator/FILES +++ b/samples/client/echo_api/python/.openapi-generator/FILES @@ -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 @@ -43,6 +44,7 @@ openapi_client/models/pet.py openapi_client/models/query.py openapi_client/models/string_enum_ref.py openapi_client/models/tag.py +openapi_client/models/test_form_object_multipart_request_marker.py openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py openapi_client/py.typed @@ -53,4 +55,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_test_form_object_multipart_request_marker.py tox.ini diff --git a/samples/client/echo_api/python/README.md b/samples/client/echo_api/python/README.md index 42487c28d4e2..22e467899846 100644 --- a/samples/client/echo_api/python/README.md +++ b/samples/client/echo_api/python/README.md @@ -107,6 +107,7 @@ Class | Method | HTTP request | Description *BodyApi* | [**test_echo_body_string_enum**](docs/BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body *BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**test_form_object_multipart**](docs/FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema *FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema *HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) *PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) @@ -133,6 +134,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/python/docs/FormApi.md b/samples/client/echo_api/python/docs/FormApi.md index 94205cd60e4a..86ae2be36975 100644 --- a/samples/client/echo_api/python/docs/FormApi.md +++ b/samples/client/echo_api/python/docs/FormApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000* Method | HTTP request | Description ------------- | ------------- | ------------- [**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +[**test_form_object_multipart**](FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema [**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema @@ -79,6 +80,74 @@ 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_form_object_multipart** +> str test_form_object_multipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example + + +```python +import openapi_client +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker +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.FormApi(api_client) + marker = openapi_client.TestFormObjectMultipartRequestMarker() # TestFormObjectMultipartRequestMarker | + + try: + # Test form parameter(s) for multipart schema + api_response = api_instance.test_form_object_multipart(marker) + print("The response of FormApi->test_form_object_multipart:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FormApi->test_form_object_multipart: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestFormObjectMultipartRequestMarker**](TestFormObjectMultipartRequestMarker.md)| | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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) + # **test_form_oneof** > str test_form_oneof(form1=form1, form2=form2, form3=form3, form4=form4, id=id, name=name) diff --git a/samples/client/echo_api/python/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/python/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..254c3b6a045a --- /dev/null +++ b/samples/client/echo_api/python/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,29 @@ +# TestFormObjectMultipartRequestMarker + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker + +# TODO update the JSON string below +json = "{}" +# create an instance of TestFormObjectMultipartRequestMarker from a JSON string +test_form_object_multipart_request_marker_instance = TestFormObjectMultipartRequestMarker.from_json(json) +# print the JSON string representation of the object +print(TestFormObjectMultipartRequestMarker.to_json()) + +# convert the object into a dict +test_form_object_multipart_request_marker_dict = test_form_object_multipart_request_marker_instance.to_dict() +# create an instance of TestFormObjectMultipartRequestMarker from a dict +test_form_object_multipart_request_marker_form_dict = test_form_object_multipart_request_marker.from_dict(test_form_object_multipart_request_marker_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/python/openapi_client/__init__.py b/samples/client/echo_api/python/openapi_client/__init__.py index 7b67f7c597fb..3f63fe12abdb 100644 --- a/samples/client/echo_api/python/openapi_client/__init__.py +++ b/samples/client/echo_api/python/openapi_client/__init__.py @@ -46,5 +46,6 @@ from openapi_client.models.query import Query from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.models.tag import Tag +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python/openapi_client/api/form_api.py b/samples/client/echo_api/python/openapi_client/api/form_api.py index 7c0959bd94ec..48f4dcf80b06 100644 --- a/samples/client/echo_api/python/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python/openapi_client/api/form_api.py @@ -19,6 +19,7 @@ from pydantic import StrictBool, StrictInt, StrictStr from typing import Optional +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.api_client import ApiClient, RequestSerialized from openapi_client.api_response import ApiResponse @@ -338,6 +339,276 @@ def _test_form_integer_boolean_string_serialize( + @validate_call + def test_form_object_multipart( + self, + marker: TestFormObjectMultipartRequestMarker, + _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, + ) -> str: + """Test form parameter(s) for multipart schema + + Test form parameter(s) for multipart schema + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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_form_object_multipart_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + 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_form_object_multipart_with_http_info( + self, + marker: TestFormObjectMultipartRequestMarker, + _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[str]: + """Test form parameter(s) for multipart schema + + Test form parameter(s) for multipart schema + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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_form_object_multipart_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + 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_form_object_multipart_without_preload_content( + self, + marker: TestFormObjectMultipartRequestMarker, + _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 form parameter(s) for multipart schema + + Test form parameter(s) for multipart schema + + :param marker: (required) + :type marker: TestFormObjectMultipartRequestMarker + :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_form_object_multipart_serialize( + marker=marker, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _test_form_object_multipart_serialize( + self, + marker, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _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, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if marker is not None: + _form_params.append(('marker', marker)) + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'text/plain' + ] + ) + + # 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( + [ + 'multipart/form-data' + ] + ) + ) + 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='/form/object/multipart', + 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_form_oneof( self, diff --git a/samples/client/echo_api/python/openapi_client/models/__init__.py b/samples/client/echo_api/python/openapi_client/models/__init__.py index 4b981699e6a0..f070f6323167 100644 --- a/samples/client/echo_api/python/openapi_client/models/__init__.py +++ b/samples/client/echo_api/python/openapi_client/models/__init__.py @@ -24,5 +24,6 @@ from openapi_client.models.query import Query from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.models.tag import Tag +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python/openapi_client/models/test_form_object_multipart_request_marker.py b/samples/client/echo_api/python/openapi_client/models/test_form_object_multipart_request_marker.py new file mode 100644 index 000000000000..9f7747151bd5 --- /dev/null +++ b/samples/client/echo_api/python/openapi_client/models/test_form_object_multipart_request_marker.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TestFormObjectMultipartRequestMarker(BaseModel): + """ + TestFormObjectMultipartRequestMarker + """ # noqa: E501 + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TestFormObjectMultipartRequestMarker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TestFormObjectMultipartRequestMarker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py b/samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py new file mode 100644 index 000000000000..d49974286060 --- /dev/null +++ b/samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.models.test_form_object_multipart_request_marker import TestFormObjectMultipartRequestMarker + +class TestTestFormObjectMultipartRequestMarker(unittest.TestCase): + """TestFormObjectMultipartRequestMarker unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestFormObjectMultipartRequestMarker: + """Test TestFormObjectMultipartRequestMarker + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TestFormObjectMultipartRequestMarker` + """ + model = TestFormObjectMultipartRequestMarker() + if include_optional: + return TestFormObjectMultipartRequestMarker( + name = '' + ) + else: + return TestFormObjectMultipartRequestMarker( + ) + """ + + def testTestFormObjectMultipartRequestMarker(self): + """Test TestFormObjectMultipartRequestMarker""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/r/.openapi-generator/FILES b/samples/client/echo_api/r/.openapi-generator/FILES index 00661ff72f60..0330c9ab8a34 100644 --- a/samples/client/echo_api/r/.openapi-generator/FILES +++ b/samples/client/echo_api/r/.openapi-generator/FILES @@ -22,6 +22,7 @@ R/query.R R/query_api.R R/string_enum_ref.R R/tag.R +R/test_form_object_multipart_request_marker.R R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R R/test_query_style_form_explode_true_array_string_query_object_parameter.R README.md @@ -40,7 +41,9 @@ docs/Query.md docs/QueryApi.md docs/StringEnumRef.md docs/Tag.md +docs/TestFormObjectMultipartRequestMarker.md docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md git_push.sh tests/testthat.R +tests/testthat/test_test_form_object_multipart_request_marker.R diff --git a/samples/client/echo_api/r/NAMESPACE b/samples/client/echo_api/r/NAMESPACE index ba08b5eee57f..c4148c7cee0c 100644 --- a/samples/client/echo_api/r/NAMESPACE +++ b/samples/client/echo_api/r/NAMESPACE @@ -22,6 +22,7 @@ export(Pet) export(Query) export(StringEnumRef) export(Tag) +export(TestFormObjectMultipartRequestMarker) export(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) export(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) diff --git a/samples/client/echo_api/r/R/form_api.R b/samples/client/echo_api/r/R/form_api.R index a25adbde0619..17f7c520ca80 100644 --- a/samples/client/echo_api/r/R/form_api.R +++ b/samples/client/echo_api/r/R/form_api.R @@ -32,6 +32,22 @@ #' } #' } #' +#' \strong{ TestFormObjectMultipart } \emph{ Test form parameter(s) for multipart schema } +#' Test form parameter(s) for multipart schema +#' +#' \itemize{ +#' \item \emph{ @param } marker \link{TestFormObjectMultipartRequestMarker} +#' +#' +#' \item status code : 200 | Successful operation +#' +#' \item return type : character +#' \item response headers : +#' +#' \tabular{ll}{ +#' } +#' } +#' #' \strong{ TestFormOneof } \emph{ Test form parameter(s) for oneOf schema } #' Test form parameter(s) for oneOf schema #' @@ -74,6 +90,20 @@ #' dput(result) #' #' +#' #################### TestFormObjectMultipart #################### +#' +#' library(openapi) +#' var_marker <- test_form_object_multipart_request_marker$new("name_example") # TestFormObjectMultipartRequestMarker | +#' +#' #Test form parameter(s) for multipart schema +#' api_instance <- FormApi$new() +#' +#' # to save the result into a file, simply add the optional `data_file` parameter, e.g. +#' # result <- api_instance$TestFormObjectMultipart(var_markerdata_file = "result.txt") +#' result <- api_instance$TestFormObjectMultipart(var_marker) +#' dput(result) +#' +#' #' #################### TestFormOneof #################### #' #' library(openapi) @@ -213,6 +243,100 @@ FormApi <- R6::R6Class( local_var_resp } }, + #' Test form parameter(s) for multipart schema + #' + #' @description + #' Test form parameter(s) for multipart schema + #' + #' @param marker + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return character + #' @export + TestFormObjectMultipart = function(marker, data_file = NULL, ...) { + local_var_response <- self$TestFormObjectMultipartWithHttpInfo(marker, data_file = data_file, ...) + if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) { + local_var_response$content + } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) { + local_var_response + } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) { + local_var_response + } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) { + local_var_response + } + }, + #' Test form parameter(s) for multipart schema + #' + #' @description + #' Test form parameter(s) for multipart schema + #' + #' @param marker + #' @param data_file (optional) name of the data file to save the result + #' @param ... Other optional arguments + #' @return API response (character) with additional information such as HTTP status code, headers + #' @export + TestFormObjectMultipartWithHttpInfo = function(marker, data_file = NULL, ...) { + args <- list(...) + query_params <- list() + header_params <- c() + form_params <- list() + file_params <- list() + local_var_body <- NULL + oauth_scopes <- NULL + is_oauth <- FALSE + + if (missing(`marker`)) { + stop("Missing required parameter `marker`.") + } + + + form_params["marker"] <- `marker` + local_var_url_path <- "/form/object/multipart" + + # The Accept request HTTP header + local_var_accepts <- list("text/plain") + + # The Content-Type representation header + local_var_content_types <- list("multipart/form-data") + + local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path), + method = "POST", + query_params = query_params, + header_params = header_params, + form_params = form_params, + file_params = file_params, + accepts = local_var_accepts, + content_types = local_var_content_types, + body = local_var_body, + is_oauth = is_oauth, + oauth_scopes = oauth_scopes, + ...) + + if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) { + # save response in a file + if (!is.null(data_file)) { + write(local_var_resp$response, data_file) + } + + deserialized_resp_obj <- tryCatch( + self$api_client$deserialize(local_var_resp$response_as_text(), "character", loadNamespace("openapi")), + error = function(e) { + stop("Failed to deserialize response") + } + ) + local_var_resp$content <- deserialized_resp_obj + local_var_resp + } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) { + ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp) + } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) { + ApiResponse$new("API client error", local_var_resp) + } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) { + if (is.null(local_var_resp$response) || local_var_resp$response == "") { + local_var_resp$response <- "API server error" + } + local_var_resp + } + }, #' Test form parameter(s) for oneOf schema #' #' @description diff --git a/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R new file mode 100644 index 000000000000..0be30ca5f6e8 --- /dev/null +++ b/samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R @@ -0,0 +1,163 @@ +#' Create a new TestFormObjectMultipartRequestMarker +#' +#' @description +#' TestFormObjectMultipartRequestMarker Class +#' +#' @docType class +#' @title TestFormObjectMultipartRequestMarker +#' @description TestFormObjectMultipartRequestMarker Class +#' @format An \code{R6Class} generator object +#' @field name character [optional] +#' @importFrom R6 R6Class +#' @importFrom jsonlite fromJSON toJSON +#' @export +TestFormObjectMultipartRequestMarker <- R6::R6Class( + "TestFormObjectMultipartRequestMarker", + public = list( + `name` = NULL, + #' Initialize a new TestFormObjectMultipartRequestMarker class. + #' + #' @description + #' Initialize a new TestFormObjectMultipartRequestMarker class. + #' + #' @param name name + #' @param ... Other optional arguments. + #' @export + initialize = function(`name` = NULL, ...) { + if (!is.null(`name`)) { + if (!(is.character(`name`) && length(`name`) == 1)) { + stop(paste("Error! Invalid data for `name`. Must be a string:", `name`)) + } + self$`name` <- `name` + } + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return TestFormObjectMultipartRequestMarker in JSON format + #' @export + toJSON = function() { + TestFormObjectMultipartRequestMarkerObject <- list() + if (!is.null(self$`name`)) { + TestFormObjectMultipartRequestMarkerObject[["name"]] <- + self$`name` + } + TestFormObjectMultipartRequestMarkerObject + }, + #' Deserialize JSON string into an instance of TestFormObjectMultipartRequestMarker + #' + #' @description + #' Deserialize JSON string into an instance of TestFormObjectMultipartRequestMarker + #' + #' @param input_json the JSON input + #' @return the instance of TestFormObjectMultipartRequestMarker + #' @export + fromJSON = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + if (!is.null(this_object$`name`)) { + self$`name` <- this_object$`name` + } + self + }, + #' To JSON string + #' + #' @description + #' To JSON String + #' + #' @return TestFormObjectMultipartRequestMarker in JSON format + #' @export + toJSONString = function() { + jsoncontent <- c( + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', + self$`name` + ) + } + ) + jsoncontent <- paste(jsoncontent, collapse = ",") + json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = ""))) + }, + #' Deserialize JSON string into an instance of TestFormObjectMultipartRequestMarker + #' + #' @description + #' Deserialize JSON string into an instance of TestFormObjectMultipartRequestMarker + #' + #' @param input_json the JSON input + #' @return the instance of TestFormObjectMultipartRequestMarker + #' @export + fromJSONString = function(input_json) { + this_object <- jsonlite::fromJSON(input_json) + self$`name` <- this_object$`name` + self + }, + #' Validate JSON input with respect to TestFormObjectMultipartRequestMarker + #' + #' @description + #' Validate JSON input with respect to TestFormObjectMultipartRequestMarker and throw an exception if invalid + #' + #' @param input the JSON input + #' @export + validateJSON = function(input) { + input_json <- jsonlite::fromJSON(input) + }, + #' To string (JSON format) + #' + #' @description + #' To string (JSON format) + #' + #' @return String representation of TestFormObjectMultipartRequestMarker + #' @export + toString = function() { + self$toJSONString() + }, + #' Return true if the values in all fields are valid. + #' + #' @description + #' Return true if the values in all fields are valid. + #' + #' @return true if the values in all fields are valid. + #' @export + isValid = function() { + TRUE + }, + #' Return a list of invalid fields (if any). + #' + #' @description + #' Return a list of invalid fields (if any). + #' + #' @return A list of invalid fields (if any). + #' @export + getInvalidFields = function() { + invalid_fields <- list() + invalid_fields + }, + #' Print the object + #' + #' @description + #' Print the object + #' + #' @export + print = function() { + print(jsonlite::prettify(self$toJSONString())) + invisible(self) + } + ), + # Lock the class to prevent modifications to the method or field + lock_class = TRUE +) +## Uncomment below to unlock the class to allow modifications of the method or field +# TestFormObjectMultipartRequestMarker$unlock() +# +## Below is an example to define the print function +# TestFormObjectMultipartRequestMarker$set("public", "print", function(...) { +# print(jsonlite::prettify(self$toJSONString())) +# invisible(self) +# }) +## Uncomment below to lock the class to prevent modifications to the method or field +# TestFormObjectMultipartRequestMarker$lock() + diff --git a/samples/client/echo_api/r/README.md b/samples/client/echo_api/r/README.md index d2e0edd131d3..068477a66562 100644 --- a/samples/client/echo_api/r/README.md +++ b/samples/client/echo_api/r/README.md @@ -86,6 +86,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) @@ -112,6 +113,7 @@ Class | Method | HTTP request | Description - [Query](docs/Query.md) - [StringEnumRef](docs/StringEnumRef.md) - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/r/docs/FormApi.md b/samples/client/echo_api/r/docs/FormApi.md index b444d98794f6..96623e44bcd0 100644 --- a/samples/client/echo_api/r/docs/FormApi.md +++ b/samples/client/echo_api/r/docs/FormApi.md @@ -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 @@ -59,6 +60,53 @@ No authorization required |-------------|-------------|------------------| | **200** | Successful operation | - | +# **TestFormObjectMultipart** +> character TestFormObjectMultipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Example +```R +library(openapi) + +# Test form parameter(s) for multipart schema +# +# prepare function argument(s) +var_marker <- test_form_object_multipart_request_marker$new("name_example") # TestFormObjectMultipartRequestMarker | + +api_instance <- FormApi$new() +# to save the result into a file, simply add the optional `data_file` parameter, e.g. +# result <- api_instance$TestFormObjectMultipart(var_markerdata_file = "result.txt") +result <- api_instance$TestFormObjectMultipart(var_marker) +dput(result) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **marker** | [**TestFormObjectMultipartRequestMarker**](test_form_object_multipart_request_marker.md)| | + +### Return type + +**character** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + # **TestFormOneof** > character TestFormOneof(form1 = var.form1, form2 = var.form2, form3 = var.form3, form4 = var.form4, id = var.id, name = var.name) diff --git a/samples/client/echo_api/r/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/r/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..a263b985da65 --- /dev/null +++ b/samples/client/echo_api/r/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,9 @@ +# openapi::TestFormObjectMultipartRequestMarker + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **character** | | [optional] + + diff --git a/samples/client/echo_api/r/tests/testthat/test_test_form_object_multipart_request_marker.R b/samples/client/echo_api/r/tests/testthat/test_test_form_object_multipart_request_marker.R new file mode 100644 index 000000000000..0a934c9fdf65 --- /dev/null +++ b/samples/client/echo_api/r/tests/testthat/test_test_form_object_multipart_request_marker.R @@ -0,0 +1,13 @@ +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate + +context("Test TestFormObjectMultipartRequestMarker") + +model_instance <- TestFormObjectMultipartRequestMarker$new() + +test_that("name", { + # tests for the property `name` (character) + + # uncomment below to test the property + #expect_equal(model.instance$`name`, "EXPECTED_RESULT") +}) diff --git a/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES b/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES index a54b808c26ff..06466ee59194 100644 --- a/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES +++ b/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES @@ -21,6 +21,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 @@ -43,8 +44,10 @@ lib/openapi_client/models/pet.rb lib/openapi_client/models/query.rb lib/openapi_client/models/string_enum_ref.rb lib/openapi_client/models/tag.rb +lib/openapi_client/models/test_form_object_multipart_request_marker.rb lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb lib/openapi_client/version.rb openapi_client.gemspec +spec/models/test_form_object_multipart_request_marker_spec.rb spec/spec_helper.rb diff --git a/samples/client/echo_api/ruby-faraday/README.md b/samples/client/echo_api/ruby-faraday/README.md index ea43d48e48f1..7cd83142eaed 100644 --- a/samples/client/echo_api/ruby-faraday/README.md +++ b/samples/client/echo_api/ruby-faraday/README.md @@ -97,6 +97,7 @@ Class | Method | HTTP request | Description *OpenapiClient::BodyApi* | [**test_echo_body_string_enum**](docs/BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body *OpenapiClient::BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *OpenapiClient::FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*OpenapiClient::FormApi* | [**test_form_object_multipart**](docs/FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema *OpenapiClient::FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema *OpenapiClient::HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) *OpenapiClient::PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description - [OpenapiClient::Query](docs/Query.md) - [OpenapiClient::StringEnumRef](docs/StringEnumRef.md) - [OpenapiClient::Tag](docs/Tag.md) + - [OpenapiClient::TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/ruby-faraday/docs/FormApi.md b/samples/client/echo_api/ruby-faraday/docs/FormApi.md index 632949e8b808..8cfafc83e81e 100644 --- a/samples/client/echo_api/ruby-faraday/docs/FormApi.md +++ b/samples/client/echo_api/ruby-faraday/docs/FormApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) | +| [**test_form_object_multipart**](FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema | | [**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | @@ -78,6 +79,70 @@ No authorization required - **Accept**: text/plain +## test_form_object_multipart + +> String test_form_object_multipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::FormApi.new +marker = OpenapiClient::TestFormObjectMultipartRequestMarker.new # TestFormObjectMultipartRequestMarker | + +begin + # Test form parameter(s) for multipart schema + result = api_instance.test_form_object_multipart(marker) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_object_multipart: #{e}" +end +``` + +#### Using the test_form_object_multipart_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_form_object_multipart_with_http_info(marker) + +```ruby +begin + # Test form parameter(s) for multipart schema + data, status_code, headers = api_instance.test_form_object_multipart_with_http_info(marker) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_object_multipart_with_http_info: #{e}" +end +``` + +### 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 + + ## test_form_oneof > String test_form_oneof(opts) diff --git a/samples/client/echo_api/ruby-faraday/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/ruby-faraday/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..caf8f8331778 --- /dev/null +++ b/samples/client/echo_api/ruby-faraday/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,18 @@ +# OpenapiClient::TestFormObjectMultipartRequestMarker + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::TestFormObjectMultipartRequestMarker.new( + name: null +) +``` + diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client.rb index a320248f0f47..7f1a8a0232a6 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client.rb @@ -25,6 +25,7 @@ require 'openapi_client/models/query' require 'openapi_client/models/string_enum_ref' require 'openapi_client/models/tag' +require 'openapi_client/models/test_form_object_multipart_request_marker' require 'openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter' require 'openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter' require 'openapi_client/models/data_query' diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb index 4f6af01ac5db..872558802389 100644 --- a/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/api/form_api.rb @@ -90,6 +90,75 @@ def test_form_integer_boolean_string_with_http_info(opts = {}) return data, status_code, headers end + # Test form parameter(s) for multipart schema + # Test form parameter(s) for multipart schema + # @param marker [TestFormObjectMultipartRequestMarker] + # @param [Hash] opts the optional parameters + # @return [String] + def test_form_object_multipart(marker, opts = {}) + data, _status_code, _headers = test_form_object_multipart_with_http_info(marker, opts) + data + end + + # Test form parameter(s) for multipart schema + # Test form parameter(s) for multipart schema + # @param marker [TestFormObjectMultipartRequestMarker] + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_form_object_multipart_with_http_info(marker, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormApi.test_form_object_multipart ...' + end + # verify the required parameter 'marker' is set + if @api_client.config.client_side_validation && marker.nil? + fail ArgumentError, "Missing the required parameter 'marker' when calling FormApi.test_form_object_multipart" + end + # resource path + local_var_path = '/form/object/multipart' + + # 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(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['marker'] = marker + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FormApi.test_form_object_multipart", + :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: FormApi#test_form_object_multipart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test form parameter(s) for oneOf schema # Test form parameter(s) for oneOf schema # @param [Hash] opts the optional parameters diff --git a/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb new file mode 100644 index 000000000000..253bbed63fa3 --- /dev/null +++ b/samples/client/echo_api/ruby-faraday/lib/openapi_client/models/test_form_object_multipart_request_marker.rb @@ -0,0 +1,214 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +Generator version: 7.5.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class TestFormObjectMultipartRequestMarker + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::TestFormObjectMultipartRequestMarker` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-faraday/spec/models/test_form_object_multipart_request_marker_spec.rb b/samples/client/echo_api/ruby-faraday/spec/models/test_form_object_multipart_request_marker_spec.rb new file mode 100644 index 000000000000..9cfa1af80f84 --- /dev/null +++ b/samples/client/echo_api/ruby-faraday/spec/models/test_form_object_multipart_request_marker_spec.rb @@ -0,0 +1,36 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +Generator version: 7.5.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::TestFormObjectMultipartRequestMarker +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::TestFormObjectMultipartRequestMarker do + let(:instance) { OpenapiClient::TestFormObjectMultipartRequestMarker.new } + + describe 'test an instance of TestFormObjectMultipartRequestMarker' do + it 'should create an instance of TestFormObjectMultipartRequestMarker' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::TestFormObjectMultipartRequestMarker) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES b/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES index a54b808c26ff..06466ee59194 100644 --- a/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES +++ b/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES @@ -21,6 +21,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 @@ -43,8 +44,10 @@ lib/openapi_client/models/pet.rb lib/openapi_client/models/query.rb lib/openapi_client/models/string_enum_ref.rb lib/openapi_client/models/tag.rb +lib/openapi_client/models/test_form_object_multipart_request_marker.rb lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb lib/openapi_client/version.rb openapi_client.gemspec +spec/models/test_form_object_multipart_request_marker_spec.rb spec/spec_helper.rb diff --git a/samples/client/echo_api/ruby-httpx/README.md b/samples/client/echo_api/ruby-httpx/README.md index 0f0a1dac7eea..58fecf447d98 100644 --- a/samples/client/echo_api/ruby-httpx/README.md +++ b/samples/client/echo_api/ruby-httpx/README.md @@ -97,6 +97,7 @@ Class | Method | HTTP request | Description *OpenapiClient::BodyApi* | [**test_echo_body_string_enum**](docs/BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body *OpenapiClient::BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *OpenapiClient::FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*OpenapiClient::FormApi* | [**test_form_object_multipart**](docs/FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema *OpenapiClient::FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema *OpenapiClient::HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) *OpenapiClient::PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description - [OpenapiClient::Query](docs/Query.md) - [OpenapiClient::StringEnumRef](docs/StringEnumRef.md) - [OpenapiClient::Tag](docs/Tag.md) + - [OpenapiClient::TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/ruby-httpx/docs/FormApi.md b/samples/client/echo_api/ruby-httpx/docs/FormApi.md index 632949e8b808..8cfafc83e81e 100644 --- a/samples/client/echo_api/ruby-httpx/docs/FormApi.md +++ b/samples/client/echo_api/ruby-httpx/docs/FormApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) | +| [**test_form_object_multipart**](FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema | | [**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | @@ -78,6 +79,70 @@ No authorization required - **Accept**: text/plain +## test_form_object_multipart + +> String test_form_object_multipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::FormApi.new +marker = OpenapiClient::TestFormObjectMultipartRequestMarker.new # TestFormObjectMultipartRequestMarker | + +begin + # Test form parameter(s) for multipart schema + result = api_instance.test_form_object_multipart(marker) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_object_multipart: #{e}" +end +``` + +#### Using the test_form_object_multipart_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_form_object_multipart_with_http_info(marker) + +```ruby +begin + # Test form parameter(s) for multipart schema + data, status_code, headers = api_instance.test_form_object_multipart_with_http_info(marker) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_object_multipart_with_http_info: #{e}" +end +``` + +### 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 + + ## test_form_oneof > String test_form_oneof(opts) diff --git a/samples/client/echo_api/ruby-httpx/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/ruby-httpx/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..caf8f8331778 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,18 @@ +# OpenapiClient::TestFormObjectMultipartRequestMarker + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::TestFormObjectMultipartRequestMarker.new( + name: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client.rb index a320248f0f47..7f1a8a0232a6 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client.rb @@ -25,6 +25,7 @@ require 'openapi_client/models/query' require 'openapi_client/models/string_enum_ref' require 'openapi_client/models/tag' +require 'openapi_client/models/test_form_object_multipart_request_marker' require 'openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter' require 'openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter' require 'openapi_client/models/data_query' diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb index 4f6af01ac5db..872558802389 100644 --- a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb @@ -90,6 +90,75 @@ def test_form_integer_boolean_string_with_http_info(opts = {}) return data, status_code, headers end + # Test form parameter(s) for multipart schema + # Test form parameter(s) for multipart schema + # @param marker [TestFormObjectMultipartRequestMarker] + # @param [Hash] opts the optional parameters + # @return [String] + def test_form_object_multipart(marker, opts = {}) + data, _status_code, _headers = test_form_object_multipart_with_http_info(marker, opts) + data + end + + # Test form parameter(s) for multipart schema + # Test form parameter(s) for multipart schema + # @param marker [TestFormObjectMultipartRequestMarker] + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_form_object_multipart_with_http_info(marker, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormApi.test_form_object_multipart ...' + end + # verify the required parameter 'marker' is set + if @api_client.config.client_side_validation && marker.nil? + fail ArgumentError, "Missing the required parameter 'marker' when calling FormApi.test_form_object_multipart" + end + # resource path + local_var_path = '/form/object/multipart' + + # 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(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['marker'] = marker + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FormApi.test_form_object_multipart", + :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: FormApi#test_form_object_multipart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test form parameter(s) for oneOf schema # Test form parameter(s) for oneOf schema # @param [Hash] opts the optional parameters diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb new file mode 100644 index 000000000000..253bbed63fa3 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_form_object_multipart_request_marker.rb @@ -0,0 +1,214 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +Generator version: 7.5.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class TestFormObjectMultipartRequestMarker + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::TestFormObjectMultipartRequestMarker` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/test_form_object_multipart_request_marker_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/test_form_object_multipart_request_marker_spec.rb new file mode 100644 index 000000000000..9cfa1af80f84 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/test_form_object_multipart_request_marker_spec.rb @@ -0,0 +1,36 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +Generator version: 7.5.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::TestFormObjectMultipartRequestMarker +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::TestFormObjectMultipartRequestMarker do + let(:instance) { OpenapiClient::TestFormObjectMultipartRequestMarker.new } + + describe 'test an instance of TestFormObjectMultipartRequestMarker' do + it 'should create an instance of TestFormObjectMultipartRequestMarker' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::TestFormObjectMultipartRequestMarker) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES b/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES index a54b808c26ff..06466ee59194 100644 --- a/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES +++ b/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES @@ -21,6 +21,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 @@ -43,8 +44,10 @@ lib/openapi_client/models/pet.rb lib/openapi_client/models/query.rb lib/openapi_client/models/string_enum_ref.rb lib/openapi_client/models/tag.rb +lib/openapi_client/models/test_form_object_multipart_request_marker.rb lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb lib/openapi_client/version.rb openapi_client.gemspec +spec/models/test_form_object_multipart_request_marker_spec.rb spec/spec_helper.rb diff --git a/samples/client/echo_api/ruby-typhoeus/README.md b/samples/client/echo_api/ruby-typhoeus/README.md index 4601a9a3bdb6..4cff638043e5 100644 --- a/samples/client/echo_api/ruby-typhoeus/README.md +++ b/samples/client/echo_api/ruby-typhoeus/README.md @@ -95,6 +95,7 @@ Class | Method | HTTP request | Description *OpenapiClient::BodyApi* | [**test_echo_body_string_enum**](docs/BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body *OpenapiClient::BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) *OpenapiClient::FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*OpenapiClient::FormApi* | [**test_form_object_multipart**](docs/FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema *OpenapiClient::FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema *OpenapiClient::HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) *OpenapiClient::PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) @@ -121,6 +122,7 @@ Class | Method | HTTP request | Description - [OpenapiClient::Query](docs/Query.md) - [OpenapiClient::StringEnumRef](docs/StringEnumRef.md) - [OpenapiClient::Tag](docs/Tag.md) + - [OpenapiClient::TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) - [OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) - [OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) diff --git a/samples/client/echo_api/ruby-typhoeus/docs/FormApi.md b/samples/client/echo_api/ruby-typhoeus/docs/FormApi.md index 632949e8b808..8cfafc83e81e 100644 --- a/samples/client/echo_api/ruby-typhoeus/docs/FormApi.md +++ b/samples/client/echo_api/ruby-typhoeus/docs/FormApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:3000* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) | +| [**test_form_object_multipart**](FormApi.md#test_form_object_multipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema | | [**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | @@ -78,6 +79,70 @@ No authorization required - **Accept**: text/plain +## test_form_object_multipart + +> String test_form_object_multipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::FormApi.new +marker = OpenapiClient::TestFormObjectMultipartRequestMarker.new # TestFormObjectMultipartRequestMarker | + +begin + # Test form parameter(s) for multipart schema + result = api_instance.test_form_object_multipart(marker) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_object_multipart: #{e}" +end +``` + +#### Using the test_form_object_multipart_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_form_object_multipart_with_http_info(marker) + +```ruby +begin + # Test form parameter(s) for multipart schema + data, status_code, headers = api_instance.test_form_object_multipart_with_http_info(marker) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_object_multipart_with_http_info: #{e}" +end +``` + +### 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 + + ## test_form_oneof > String test_form_oneof(opts) diff --git a/samples/client/echo_api/ruby-typhoeus/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/ruby-typhoeus/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..caf8f8331778 --- /dev/null +++ b/samples/client/echo_api/ruby-typhoeus/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,18 @@ +# OpenapiClient::TestFormObjectMultipartRequestMarker + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::TestFormObjectMultipartRequestMarker.new( + name: null +) +``` + diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client.rb index a320248f0f47..7f1a8a0232a6 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client.rb @@ -25,6 +25,7 @@ require 'openapi_client/models/query' require 'openapi_client/models/string_enum_ref' require 'openapi_client/models/tag' +require 'openapi_client/models/test_form_object_multipart_request_marker' require 'openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter' require 'openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter' require 'openapi_client/models/data_query' diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb index 4f6af01ac5db..872558802389 100644 --- a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/api/form_api.rb @@ -90,6 +90,75 @@ def test_form_integer_boolean_string_with_http_info(opts = {}) return data, status_code, headers end + # Test form parameter(s) for multipart schema + # Test form parameter(s) for multipart schema + # @param marker [TestFormObjectMultipartRequestMarker] + # @param [Hash] opts the optional parameters + # @return [String] + def test_form_object_multipart(marker, opts = {}) + data, _status_code, _headers = test_form_object_multipart_with_http_info(marker, opts) + data + end + + # Test form parameter(s) for multipart schema + # Test form parameter(s) for multipart schema + # @param marker [TestFormObjectMultipartRequestMarker] + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_form_object_multipart_with_http_info(marker, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormApi.test_form_object_multipart ...' + end + # verify the required parameter 'marker' is set + if @api_client.config.client_side_validation && marker.nil? + fail ArgumentError, "Missing the required parameter 'marker' when calling FormApi.test_form_object_multipart" + end + # resource path + local_var_path = '/form/object/multipart' + + # 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(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['marker'] = marker + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FormApi.test_form_object_multipart", + :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: FormApi#test_form_object_multipart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test form parameter(s) for oneOf schema # Test form parameter(s) for oneOf schema # @param [Hash] opts the optional parameters diff --git a/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb new file mode 100644 index 000000000000..253bbed63fa3 --- /dev/null +++ b/samples/client/echo_api/ruby-typhoeus/lib/openapi_client/models/test_form_object_multipart_request_marker.rb @@ -0,0 +1,214 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +Generator version: 7.5.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class TestFormObjectMultipartRequestMarker + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::TestFormObjectMultipartRequestMarker` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestFormObjectMultipartRequestMarker`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-typhoeus/spec/models/test_form_object_multipart_request_marker_spec.rb b/samples/client/echo_api/ruby-typhoeus/spec/models/test_form_object_multipart_request_marker_spec.rb new file mode 100644 index 000000000000..9cfa1af80f84 --- /dev/null +++ b/samples/client/echo_api/ruby-typhoeus/spec/models/test_form_object_multipart_request_marker_spec.rb @@ -0,0 +1,36 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +Generator version: 7.5.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::TestFormObjectMultipartRequestMarker +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::TestFormObjectMultipartRequestMarker do + let(:instance) { OpenapiClient::TestFormObjectMultipartRequestMarker.new } + + describe 'test an instance of TestFormObjectMultipartRequestMarker' do + it 'should create an instance of TestFormObjectMultipartRequestMarker' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::TestFormObjectMultipartRequestMarker) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/typescript-axios/build/api.ts b/samples/client/echo_api/typescript-axios/build/api.ts index c6874e7a43f2..384ba1cdfc3c 100644 --- a/samples/client/echo_api/typescript-axios/build/api.ts +++ b/samples/client/echo_api/typescript-axios/build/api.ts @@ -291,6 +291,19 @@ export interface Tag { */ 'name'?: string; } +/** + * + * @export + * @interface TestFormObjectMultipartRequestMarker + */ +export interface TestFormObjectMultipartRequestMarker { + /** + * + * @type {string} + * @memberof TestFormObjectMultipartRequestMarker + */ + 'name'?: string; +} /** * * @export @@ -1298,6 +1311,47 @@ export const FormApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * Test form parameter(s) for multipart schema + * @summary Test form parameter(s) for multipart schema + * @param {TestFormObjectMultipartRequestMarker} marker + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testFormObjectMultipart: async (marker: TestFormObjectMultipartRequestMarker, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'marker' is not null or undefined + assertParamExists('testFormObjectMultipart', 'marker', marker) + const localVarPath = `/form/object/multipart`; + // 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; + const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); + + + if (marker !== undefined) { + localVarFormParams.append('marker', new Blob([JSON.stringify(marker)], { type: "application/json", })); + } + + + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Test form parameter(s) for oneOf schema * @summary Test form parameter(s) for oneOf schema @@ -1387,6 +1441,19 @@ export const FormApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['FormApi.testFormIntegerBooleanString']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, + /** + * Test form parameter(s) for multipart schema + * @summary Test form parameter(s) for multipart schema + * @param {TestFormObjectMultipartRequestMarker} marker + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testFormObjectMultipart(marker, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['FormApi.testFormObjectMultipart']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * Test form parameter(s) for oneOf schema * @summary Test form parameter(s) for oneOf schema @@ -1427,6 +1494,16 @@ export const FormApiFactory = function (configuration?: Configuration, basePath? testFormIntegerBooleanString(integerForm?: number, booleanForm?: boolean, stringForm?: string, options?: any): AxiosPromise { return localVarFp.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, options).then((request) => request(axios, basePath)); }, + /** + * Test form parameter(s) for multipart schema + * @summary Test form parameter(s) for multipart schema + * @param {TestFormObjectMultipartRequestMarker} marker + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, options?: any): AxiosPromise { + return localVarFp.testFormObjectMultipart(marker, options).then((request) => request(axios, basePath)); + }, /** * Test form parameter(s) for oneOf schema * @summary Test form parameter(s) for oneOf schema @@ -1466,6 +1543,18 @@ export class FormApi extends BaseAPI { return FormApiFp(this.configuration).testFormIntegerBooleanString(integerForm, booleanForm, stringForm, options).then((request) => request(this.axios, this.basePath)); } + /** + * Test form parameter(s) for multipart schema + * @summary Test form parameter(s) for multipart schema + * @param {TestFormObjectMultipartRequestMarker} marker + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FormApi + */ + public testFormObjectMultipart(marker: TestFormObjectMultipartRequestMarker, options?: RawAxiosRequestConfig) { + return FormApiFp(this.configuration).testFormObjectMultipart(marker, options).then((request) => request(this.axios, this.basePath)); + } + /** * Test form parameter(s) for oneOf schema * @summary Test form parameter(s) for oneOf schema From 2e0debbc02ac4a4988cc83f962d7b6efbbdd24a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Wed, 20 Mar 2024 11:30:59 +0000 Subject: [PATCH 3/3] [echo api] update samples --- .../client/echo_api/csharp-restsharp/.openapi-generator/FILES | 1 - .../echo_api/java/apache-httpclient/.openapi-generator/FILES | 1 - samples/client/echo_api/java/feign-gson/.openapi-generator/FILES | 1 - samples/client/echo_api/java/native/.openapi-generator/FILES | 1 - .../client/echo_api/java/okhttp-gson/.openapi-generator/FILES | 1 - samples/client/echo_api/java/resteasy/.openapi-generator/FILES | 1 - .../client/echo_api/java/resttemplate/.openapi-generator/FILES | 1 - samples/client/echo_api/php-nextgen/.openapi-generator/FILES | 1 - samples/client/echo_api/powershell/.openapi-generator/FILES | 1 - .../.openapi-generator/FILES | 1 - .../client/echo_api/python-pydantic-v1/.openapi-generator/FILES | 1 - samples/client/echo_api/python/.openapi-generator/FILES | 1 - samples/client/echo_api/r/.openapi-generator/FILES | 1 - samples/client/echo_api/ruby-faraday/.openapi-generator/FILES | 1 - samples/client/echo_api/ruby-httpx/.openapi-generator/FILES | 1 - samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES | 1 - 16 files changed, 16 deletions(-) diff --git a/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES b/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES index 79b5f3ca21cb..04ec2fd0c625 100644 --- a/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES +++ b/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES @@ -22,7 +22,6 @@ docs/TestFormObjectMultipartRequestMarker.md docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md git_push.sh -src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools/Api/AuthApi.cs src/Org.OpenAPITools/Api/BodyApi.cs diff --git a/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES b/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES index b2dbde8f6b19..38f10d604ab9 100644 --- a/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES +++ b/samples/client/echo_api/java/apache-httpclient/.openapi-generator/FILES @@ -64,4 +64,3 @@ src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java -src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES b/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES index fac2028d5aa8..1258fb4f7383 100644 --- a/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES +++ b/samples/client/echo_api/java/feign-gson/.openapi-generator/FILES @@ -41,4 +41,3 @@ src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java -src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/native/.openapi-generator/FILES b/samples/client/echo_api/java/native/.openapi-generator/FILES index 0ea6f9c88927..8a16d65ff80b 100644 --- a/samples/client/echo_api/java/native/.openapi-generator/FILES +++ b/samples/client/echo_api/java/native/.openapi-generator/FILES @@ -60,4 +60,3 @@ src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java -src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES b/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES index be65eb6dc263..a3ca74ad7282 100644 --- a/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES +++ b/samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES @@ -68,4 +68,3 @@ src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java -src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/resteasy/.openapi-generator/FILES b/samples/client/echo_api/java/resteasy/.openapi-generator/FILES index 813b02156e09..82ee0086cb7c 100644 --- a/samples/client/echo_api/java/resteasy/.openapi-generator/FILES +++ b/samples/client/echo_api/java/resteasy/.openapi-generator/FILES @@ -64,4 +64,3 @@ src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java -src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES b/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES index fe3e53ee20cf..f87bbe037058 100644 --- a/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES +++ b/samples/client/echo_api/java/resttemplate/.openapi-generator/FILES @@ -60,4 +60,3 @@ src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java -src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java diff --git a/samples/client/echo_api/php-nextgen/.openapi-generator/FILES b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES index b957a1699ecb..c51141c743e7 100644 --- a/samples/client/echo_api/php-nextgen/.openapi-generator/FILES +++ b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES @@ -47,4 +47,3 @@ src/Model/TestFormObjectMultipartRequestMarker.php src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php src/ObjectSerializer.php -tests/Model/TestFormObjectMultipartRequestMarkerTest.php diff --git a/samples/client/echo_api/powershell/.openapi-generator/FILES b/samples/client/echo_api/powershell/.openapi-generator/FILES index 01ba6043a9df..c94b1651330c 100644 --- a/samples/client/echo_api/powershell/.openapi-generator/FILES +++ b/samples/client/echo_api/powershell/.openapi-generator/FILES @@ -45,4 +45,3 @@ src/PSOpenAPITools/Private/HttpSignatureAuth.ps1 src/PSOpenAPITools/Private/Out-DebugParameter.ps1 src/PSOpenAPITools/Private/RSAEncryptionProvider.cs src/PSOpenAPITools/en-US/about_PSOpenAPITools.help.txt -tests/Model/TestFormObjectMultipartRequestMarker.Tests.ps1 diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES index 6a4ad19b323c..a7c64d3f55f4 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES @@ -55,5 +55,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_test_form_object_multipart_request_marker.py tox.ini diff --git a/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES index 6a4ad19b323c..a7c64d3f55f4 100644 --- a/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES +++ b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES @@ -55,5 +55,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_test_form_object_multipart_request_marker.py tox.ini diff --git a/samples/client/echo_api/python/.openapi-generator/FILES b/samples/client/echo_api/python/.openapi-generator/FILES index 6a4ad19b323c..a7c64d3f55f4 100644 --- a/samples/client/echo_api/python/.openapi-generator/FILES +++ b/samples/client/echo_api/python/.openapi-generator/FILES @@ -55,5 +55,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_test_form_object_multipart_request_marker.py tox.ini diff --git a/samples/client/echo_api/r/.openapi-generator/FILES b/samples/client/echo_api/r/.openapi-generator/FILES index 0330c9ab8a34..cf3034e39d0c 100644 --- a/samples/client/echo_api/r/.openapi-generator/FILES +++ b/samples/client/echo_api/r/.openapi-generator/FILES @@ -46,4 +46,3 @@ docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md git_push.sh tests/testthat.R -tests/testthat/test_test_form_object_multipart_request_marker.R diff --git a/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES b/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES index 06466ee59194..dd4431c0355a 100644 --- a/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES +++ b/samples/client/echo_api/ruby-faraday/.openapi-generator/FILES @@ -49,5 +49,4 @@ lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_o lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb lib/openapi_client/version.rb openapi_client.gemspec -spec/models/test_form_object_multipart_request_marker_spec.rb spec/spec_helper.rb diff --git a/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES b/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES index 06466ee59194..dd4431c0355a 100644 --- a/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES +++ b/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES @@ -49,5 +49,4 @@ lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_o lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb lib/openapi_client/version.rb openapi_client.gemspec -spec/models/test_form_object_multipart_request_marker_spec.rb spec/spec_helper.rb diff --git a/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES b/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES index 06466ee59194..dd4431c0355a 100644 --- a/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES +++ b/samples/client/echo_api/ruby-typhoeus/.openapi-generator/FILES @@ -49,5 +49,4 @@ lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_o lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb lib/openapi_client/version.rb openapi_client.gemspec -spec/models/test_form_object_multipart_request_marker_spec.rb spec/spec_helper.rb