[PYTHON] switch from mutable bytearray to immutable bytes to avoid pydantic error (#22988)

* switch from mutable bytearray to immutable bytes

* update python samples
This commit is contained in:
James Kent
2026-02-23 17:54:26 -06:00
committed by GitHub
parent 905b930144
commit a5e2fdf667
33 changed files with 231 additions and 232 deletions

View File

@@ -56,7 +56,7 @@ class BodyApi:
_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
@@ -91,7 +91,7 @@ class BodyApi:
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "bytearray",
'200': "bytes",
}
response_data = self.api_client.call_api(
*_param,
@@ -119,7 +119,7 @@ class BodyApi:
_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
@@ -154,7 +154,7 @@ class BodyApi:
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "bytearray",
'200': "bytes",
}
response_data = self.api_client.call_api(
*_param,
@@ -217,7 +217,7 @@ class BodyApi:
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "bytearray",
'200': "bytes",
}
response_data = self.api_client.call_api(
*_param,
@@ -308,7 +308,7 @@ class BodyApi:
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
@@ -375,7 +375,7 @@ class BodyApi:
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
@@ -442,7 +442,7 @@ class BodyApi:
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
@@ -589,7 +589,7 @@ class BodyApi:
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
@@ -656,7 +656,7 @@ class BodyApi:
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
@@ -723,7 +723,7 @@ class BodyApi:
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
@@ -863,7 +863,7 @@ class BodyApi:
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
@@ -930,7 +930,7 @@ class BodyApi:
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
@@ -997,7 +997,7 @@ class BodyApi:
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

View File

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