Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ def deserialize(cls, response: urllib3.HTTPResponse, configuration: schema_confi
elif content_type.startswith('multipart/form-data'):
body_data = cls.__deserialize_multipart_form_data(response)
content_type = 'multipart/form-data'
elif content_type == 'application/x-pem-file':
body_data = response.data.decode()
else:
raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type))
body_schema = schemas.get_class(body_schema)
Expand Down Expand Up @@ -1258,6 +1260,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
content: content_type to MediaType schemas.Schema info
"""
__json_encoder = JSONEncoder()
__plain_txt_content_types = {'text/plain', 'application/x-pem-file'}
content: typing.Dict[str, typing.Type[MediaType]]
required: bool = False

Expand Down Expand Up @@ -1379,7 +1382,7 @@ def serialize(
if isinstance(cast_in_data, (schemas.FileIO, bytes)):
raise ValueError(f"Invalid input data type. Data must be int/float/str/bool/None/tuple/immutabledict and it was type {type(cast_in_data)}")
return cls.__serialize_json(cast_in_data)
elif content_type == 'text/plain':
elif content_type in cls.__plain_txt_content_types:
if not isinstance(cast_in_data, (int, float, str)):
raise ValueError(f"Unable to serialize type {type(cast_in_data)} to text/plain")
return cls.__serialize_text_plain(cast_in_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ def deserialize(cls, response: urllib3.HTTPResponse, configuration: schema_confi
elif content_type.startswith('multipart/form-data'):
body_data = cls.__deserialize_multipart_form_data(response)
content_type = 'multipart/form-data'
elif content_type == 'application/x-pem-file':
body_data = response.data.decode()
else:
raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type))
body_schema = schemas.get_class(body_schema)
Expand Down Expand Up @@ -1258,6 +1260,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
content: content_type to MediaType schemas.Schema info
"""
__json_encoder = JSONEncoder()
__plain_txt_content_types = {'text/plain', 'application/x-pem-file'}
content: typing.Dict[str, typing.Type[MediaType]]
required: bool = False

Expand Down Expand Up @@ -1379,7 +1382,7 @@ def serialize(
if isinstance(cast_in_data, (schemas.FileIO, bytes)):
raise ValueError(f"Invalid input data type. Data must be int/float/str/bool/None/tuple/immutabledict and it was type {type(cast_in_data)}")
return cls.__serialize_json(cast_in_data)
elif content_type == 'text/plain':
elif content_type in cls.__plain_txt_content_types:
if not isinstance(cast_in_data, (int, float, str)):
raise ValueError(f"Unable to serialize type {type(cast_in_data)} to text/plain")
return cls.__serialize_text_plain(cast_in_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ def deserialize(cls, response: urllib3.HTTPResponse, configuration: schema_confi
elif content_type.startswith('multipart/form-data'):
body_data = cls.__deserialize_multipart_form_data(response)
content_type = 'multipart/form-data'
elif content_type == 'application/x-pem-file':
body_data = response.data.decode()
else:
raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type))
body_schema = schemas.get_class(body_schema)
Expand Down Expand Up @@ -1258,6 +1260,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
content: content_type to MediaType schemas.Schema info
"""
__json_encoder = JSONEncoder()
__plain_txt_content_types = {'text/plain', 'application/x-pem-file'}
content: typing.Dict[str, typing.Type[MediaType]]
required: bool = False

Expand Down Expand Up @@ -1379,7 +1382,7 @@ def serialize(
if isinstance(cast_in_data, (schemas.FileIO, bytes)):
raise ValueError(f"Invalid input data type. Data must be int/float/str/bool/None/tuple/immutabledict and it was type {type(cast_in_data)}")
return cls.__serialize_json(cast_in_data)
elif content_type == 'text/plain':
elif content_type in cls.__plain_txt_content_types:
if not isinstance(cast_in_data, (int, float, str)):
raise ValueError(f"Unable to serialize type {type(cast_in_data)} to text/plain")
return cls.__serialize_text_plain(cast_in_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ def deserialize(cls, response: urllib3.HTTPResponse, configuration: schema_confi
elif content_type.startswith('multipart/form-data'):
body_data = cls.__deserialize_multipart_form_data(response)
content_type = 'multipart/form-data'
elif content_type == 'application/x-pem-file':
body_data = response.data.decode()
else:
raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type))
body_schema = schemas.get_class(body_schema)
Expand Down Expand Up @@ -1281,6 +1283,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
content: content_type to MediaType schemas.Schema info
"""
__json_encoder = JSONEncoder()
__plain_txt_content_types = {'text/plain', 'application/x-pem-file'}
content: typing.Dict[str, typing.Type[MediaType]]
required: bool = False

Expand Down Expand Up @@ -1402,7 +1405,7 @@ def serialize(
if isinstance(cast_in_data, (schemas.FileIO, bytes)):
raise ValueError(f"Invalid input data type. Data must be int/float/str/bool/None/tuple/immutabledict and it was type {type(cast_in_data)}")
return cls.__serialize_json(cast_in_data)
elif content_type == 'text/plain':
elif content_type in cls.__plain_txt_content_types:
if not isinstance(cast_in_data, (int, float, str)):
raise ValueError(f"Unable to serialize type {type(cast_in_data)} to text/plain")
return cls.__serialize_text_plain(cast_in_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ def deserialize(cls, response: urllib3.HTTPResponse, configuration: schema_confi
elif content_type.startswith('multipart/form-data'):
body_data = cls.__deserialize_multipart_form_data(response)
content_type = 'multipart/form-data'
elif content_type == 'application/x-pem-file':
body_data = response.data.decode()
else:
raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type))
body_schema = schemas.get_class(body_schema)
Expand Down Expand Up @@ -1285,6 +1287,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
content: content_type to MediaType schemas.Schema info
"""
__json_encoder = JSONEncoder()
__plain_txt_content_types = {'text/plain', 'application/x-pem-file'}
content: typing.Dict[str, typing.Type[MediaType]]
required: bool = False

Expand Down Expand Up @@ -1406,7 +1409,7 @@ def serialize(
if isinstance(cast_in_data, (schemas.FileIO, bytes)):
raise ValueError(f"Invalid input data type. Data must be int/float/str/bool/None/tuple/immutabledict and it was type {type(cast_in_data)}")
return cls.__serialize_json(cast_in_data)
elif content_type == 'text/plain':
elif content_type in cls.__plain_txt_content_types:
if not isinstance(cast_in_data, (int, float, str)):
raise ValueError(f"Unable to serialize type {type(cast_in_data)} to text/plain")
return cls.__serialize_text_plain(cast_in_data)
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/python/api_client.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,8 @@ class OpenApiResponse(typing.Generic[T], JSONDetector, abc.ABC):
elif content_type.startswith('multipart/form-data'):
body_data = cls.__deserialize_multipart_form_data(response)
content_type = 'multipart/form-data'
elif content_type == 'application/x-pem-file':
body_data = response.data.decode()
else:
raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type))
body_schema = schemas.get_class(body_schema)
Expand Down Expand Up @@ -1283,6 +1285,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
content: content_type to MediaType schemas.Schema info
"""
__json_encoder = JSONEncoder()
__plain_txt_content_types = {'text/plain', 'application/x-pem-file'}
content: typing.Dict[str, typing.Type[MediaType]]
required: bool = False

Expand Down Expand Up @@ -1404,7 +1407,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
if isinstance(cast_in_data, (schemas.FileIO, bytes)):
raise ValueError(f"Invalid input data type. Data must be int/float/str/bool/None/tuple/immutabledict and it was type {type(cast_in_data)}")
return cls.__serialize_json(cast_in_data)
elif content_type == 'text/plain':
elif content_type in cls.__plain_txt_content_types:
if not isinstance(cast_in_data, (int, float, str)):
raise ValueError(f"Unable to serialize type {type(cast_in_data)} to text/plain")
return cls.__serialize_text_plain(cast_in_data)
Expand Down