Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/generators/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>List</li>
<li>UUID</li>
<li>bool</li>
<li>bytearray</li>
<li>bytes</li>
<li>date</li>
<li>datetime</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ public PythonClientCodegen() {
typeMapping.put("set", "List");
typeMapping.put("map", "Dict");
typeMapping.put("decimal", "decimal.Decimal");
typeMapping.put("file", "bytearray");
typeMapping.put("binary", "bytearray");
typeMapping.put("ByteArray", "bytearray");
typeMapping.put("file", "bytes");
typeMapping.put("binary", "bytes");
typeMapping.put("ByteArray", "bytes");

languageSpecificPrimitives.remove("file");
languageSpecificPrimitives.add("decimal.Decimal");
languageSpecificPrimitives.add("bytearray");
languageSpecificPrimitives.add("bytes");
languageSpecificPrimitives.add("none_type");

supportsInheritance = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class ApiClient:
response_text = None
return_data = None
try:
if response_type == "bytearray":
if response_type in ("bytearray", "bytes"):
return_data = response_data.data
elif response_type == "file":
return_data = self.__deserialize_file(response_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Method | HTTP request | Description


# **test_binary_gif**
> bytearray test_binary_gif()
> bytes test_binary_gif()

Test binary (gif) response body

Expand Down Expand Up @@ -60,7 +60,7 @@ This endpoint does not need any parameter.

### Return type

**bytearray**
**bytes**

### Authorization

Expand Down Expand Up @@ -105,7 +105,7 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
body = None # bytearray | (optional)
body = None # bytes | (optional)

try:
# Test body parameter(s)
Expand All @@ -123,7 +123,7 @@ with openapi_client.ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **bytearray**| | [optional]
**body** | **bytes**| | [optional]

### Return type

Expand Down Expand Up @@ -172,7 +172,7 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
files = None # List[bytearray] |
files = None # List[bytes] |

try:
# Test array of binary in multipart mime
Expand All @@ -190,7 +190,7 @@ with openapi_client.ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**files** | **List[bytearray]**| |
**files** | **List[bytes]**| |

### Return type

Expand Down Expand Up @@ -239,7 +239,7 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
my_file = None # bytearray | (optional)
my_file = None # bytes | (optional)

try:
# Test single binary in multipart mime
Expand All @@ -257,7 +257,7 @@ with openapi_client.ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**my_file** | **bytearray**| | [optional]
**my_file** | **bytes**| | [optional]

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_binary_gif(
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> bytearray:
) -> bytes:
"""Test binary (gif) response body

Test binary (gif) response body
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_binary_gif(
)

_response_types_map: Dict[str, Optional[str]] = {
'200': "bytearray",
'200': "bytes",
}
response_data = self.api_client.call_api(
*_param,
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_binary_gif_with_http_info(
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[bytearray]:
) -> ApiResponse[bytes]:
"""Test binary (gif) response body

Test binary (gif) response body
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_binary_gif_with_http_info(
)

_response_types_map: Dict[str, Optional[str]] = {
'200': "bytearray",
'200': "bytes",
}
response_data = self.api_client.call_api(
*_param,
Expand Down Expand Up @@ -217,7 +217,7 @@ def test_binary_gif_without_preload_content(
)

_response_types_map: Dict[str, Optional[str]] = {
'200': "bytearray",
'200': "bytes",
}
response_data = self.api_client.call_api(
*_param,
Expand Down Expand Up @@ -308,7 +308,7 @@ def test_body_application_octetstream_binary(
Test body parameter(s)

:param body:
:type body: bytearray
:type body: bytes
: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
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_body_application_octetstream_binary_with_http_info(
Test body parameter(s)

:param body:
:type body: bytearray
:type body: bytes
: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
Expand Down Expand Up @@ -442,7 +442,7 @@ def test_body_application_octetstream_binary_without_preload_content(
Test body parameter(s)

:param body:
:type body: bytearray
:type body: bytes
: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
Expand Down Expand Up @@ -589,7 +589,7 @@ def test_body_multipart_formdata_array_of_binary(
Test array of binary in multipart mime

:param files: (required)
:type files: List[bytearray]
:type files: List[bytes]
: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
Expand Down Expand Up @@ -656,7 +656,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info(
Test array of binary in multipart mime

:param files: (required)
:type files: List[bytearray]
:type files: List[bytes]
: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
Expand Down Expand Up @@ -723,7 +723,7 @@ def test_body_multipart_formdata_array_of_binary_without_preload_content(
Test array of binary in multipart mime

:param files: (required)
:type files: List[bytearray]
:type files: List[bytes]
: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
Expand Down Expand Up @@ -863,7 +863,7 @@ def test_body_multipart_formdata_single_binary(
Test single binary in multipart mime

:param my_file:
:type my_file: bytearray
:type my_file: bytes
: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
Expand Down Expand Up @@ -930,7 +930,7 @@ def test_body_multipart_formdata_single_binary_with_http_info(
Test single binary in multipart mime

:param my_file:
:type my_file: bytearray
:type my_file: bytes
: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
Expand Down Expand Up @@ -997,7 +997,7 @@ def test_body_multipart_formdata_single_binary_without_preload_content(
Test single binary in multipart mime

:param my_file:
:type my_file: bytearray
:type my_file: bytes
: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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def response_deserialize(
response_text = None
return_data = None
try:
if response_type == "bytearray":
if response_type in ("bytearray", "bytes"):
return_data = response_data.data
elif response_type == "file":
return_data = self.__deserialize_file(response_data)
Expand Down
16 changes: 8 additions & 8 deletions samples/client/echo_api/python/docs/BodyApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Method | HTTP request | Description


# **test_binary_gif**
> bytearray test_binary_gif()
> bytes test_binary_gif()

Test binary (gif) response body

Expand Down Expand Up @@ -60,7 +60,7 @@ This endpoint does not need any parameter.

### Return type

**bytearray**
**bytes**

### Authorization

Expand Down Expand Up @@ -105,7 +105,7 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
body = None # bytearray | (optional)
body = None # bytes | (optional)

try:
# Test body parameter(s)
Expand All @@ -123,7 +123,7 @@ with openapi_client.ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **bytearray**| | [optional]
**body** | **bytes**| | [optional]

### Return type

Expand Down Expand Up @@ -172,7 +172,7 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
files = None # List[bytearray] |
files = None # List[bytes] |

try:
# Test array of binary in multipart mime
Expand All @@ -190,7 +190,7 @@ with openapi_client.ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**files** | **List[bytearray]**| |
**files** | **List[bytes]**| |

### Return type

Expand Down Expand Up @@ -239,7 +239,7 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.BodyApi(api_client)
my_file = None # bytearray | (optional)
my_file = None # bytes | (optional)

try:
# Test single binary in multipart mime
Expand All @@ -257,7 +257,7 @@ with openapi_client.ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**my_file** | **bytearray**| | [optional]
**my_file** | **bytes**| | [optional]

### Return type

Expand Down
Loading