Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit ddd51af

Browse files
committed
v3 fixes type errors (#175)
* Fixes errors in server.py * Fixes some errors in server py files * Fixes schema_config type error * Fixes errors in api_configuration * Adds type ignoring for enum values, schemas fixed * Fixes python tests * Moves ApiException back into the exceptions module * Fixes timeout type and rest client response type * Adds int input back into timeout, fixes type errors in rest.py * Fixes decimal exponent access * Parameter content storage updated to tuple so code can see length 1 * Uses content tuple in serialize methods * Adds __HeaderParameterBase to fix type error * Updates urllib3.HTTPResponse -> urllib3_response.BaseHTTPResponse * Adds _SERIALIZE_TYPES * Fixes explode type error * Fixes urllib3 response type + header and parameter schema references * Fixes response type, fixes api_response header type * Fixes 2 type errors * Adds assertion * Adds assertion * Adds from_tuples method and needed types * Fixes return type of __serialize_application_octet_stream * Fixes __serialize_json * Fixes __serialize_text_plain * Fixes __serialize_application_x_www_form_data * Fixes type error * Fixes __serialize_multipart_form_data * Fixes FieldValue types * Fixes uer agent type error * Fixes another type error * Fixes type error * Fixes type errors in security_schemes * Fixes errors in two tests * Fixes more type errors * Fixes error in get_server_url invocation * Fixes parameter and header serialization/deserialization * Fixes content references * Fixes parameter tests * Fixes last python test errors * Samples regen
1 parent e9fd364 commit ddd51af

File tree

856 files changed

+6269
-5864
lines changed
  • modules/openapi-json-schema-generator/src/main
  • samples/openapi3/client/3_0_3_unit_test/python
    • .openapi-generator
    • docs/paths
      • request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body
      • request_body_post_additionalproperties_are_allowed_by_default_request_body
      • request_body_post_additionalproperties_can_exist_by_itself_request_body
      • request_body_post_additionalproperties_should_not_look_in_applicators_request_body
      • request_body_post_allof_combined_with_anyof_oneof_request_body
      • request_body_post_allof_request_body
      • request_body_post_allof_simple_types_request_body
      • request_body_post_allof_with_base_schema_request_body
      • request_body_post_allof_with_one_empty_schema_request_body
      • request_body_post_allof_with_the_first_empty_schema_request_body
      • request_body_post_allof_with_the_last_empty_schema_request_body
      • request_body_post_allof_with_two_empty_schemas_request_body
      • request_body_post_anyof_complex_types_request_body
      • request_body_post_anyof_request_body
      • request_body_post_anyof_with_base_schema_request_body
      • request_body_post_anyof_with_one_empty_schema_request_body
      • request_body_post_array_type_matches_arrays_request_body
      • request_body_post_boolean_type_matches_booleans_request_body
      • request_body_post_by_int_request_body
      • request_body_post_by_number_request_body
      • request_body_post_by_small_number_request_body
      • request_body_post_date_time_format_request_body
      • request_body_post_email_format_request_body
      • request_body_post_enum_with0_does_not_match_false_request_body
      • request_body_post_enum_with1_does_not_match_true_request_body
      • request_body_post_enum_with_escaped_characters_request_body
      • request_body_post_enum_with_false_does_not_match0_request_body
      • request_body_post_enum_with_true_does_not_match1_request_body
      • request_body_post_enums_in_properties_request_body
      • request_body_post_forbidden_property_request_body
      • request_body_post_hostname_format_request_body
      • request_body_post_integer_type_matches_integers_request_body
      • request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body
      • request_body_post_invalid_string_value_for_default_request_body
      • request_body_post_ipv4_format_request_body
      • request_body_post_ipv6_format_request_body
      • request_body_post_json_pointer_format_request_body
      • request_body_post_maximum_validation_request_body
      • request_body_post_maximum_validation_with_unsigned_integer_request_body
      • request_body_post_maxitems_validation_request_body
      • request_body_post_maxlength_validation_request_body
      • request_body_post_maxproperties0_means_the_object_is_empty_request_body
      • request_body_post_maxproperties_validation_request_body
      • request_body_post_minimum_validation_request_body
      • request_body_post_minimum_validation_with_signed_integer_request_body
      • request_body_post_minitems_validation_request_body
      • request_body_post_minlength_validation_request_body
      • request_body_post_minproperties_validation_request_body
      • request_body_post_nested_allof_to_check_validation_semantics_request_body
      • request_body_post_nested_anyof_to_check_validation_semantics_request_body
      • request_body_post_nested_items_request_body
      • request_body_post_nested_oneof_to_check_validation_semantics_request_body
      • request_body_post_not_more_complex_schema_request_body
      • request_body_post_not_request_body
      • request_body_post_nul_characters_in_strings_request_body
      • request_body_post_null_type_matches_only_the_null_object_request_body
      • request_body_post_number_type_matches_numbers_request_body
      • request_body_post_object_properties_validation_request_body
      • request_body_post_object_type_matches_objects_request_body
      • request_body_post_oneof_complex_types_request_body
      • request_body_post_oneof_request_body
      • request_body_post_oneof_with_base_schema_request_body
      • request_body_post_oneof_with_empty_schema_request_body
      • request_body_post_oneof_with_required_request_body
      • request_body_post_pattern_is_not_anchored_request_body
      • request_body_post_pattern_validation_request_body
      • request_body_post_properties_with_escaped_characters_request_body
      • request_body_post_property_named_ref_that_is_not_a_reference_request_body
      • request_body_post_ref_in_additionalproperties_request_body
      • request_body_post_ref_in_allof_request_body
      • request_body_post_ref_in_anyof_request_body
      • request_body_post_ref_in_items_request_body
      • request_body_post_ref_in_not_request_body
      • request_body_post_ref_in_oneof_request_body
      • request_body_post_ref_in_property_request_body
      • request_body_post_required_default_validation_request_body
      • request_body_post_required_validation_request_body
      • request_body_post_required_with_empty_array_request_body
      • request_body_post_required_with_escaped_characters_request_body
      • request_body_post_simple_enum_validation_request_body
      • request_body_post_string_type_matches_strings_request_body
      • request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body
      • request_body_post_uniqueitems_false_validation_request_body
      • request_body_post_uniqueitems_validation_request_body
      • request_body_post_uri_format_request_body
      • request_body_post_uri_reference_format_request_body
      • request_body_post_uri_template_format_request_body
      • response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types
      • response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types
      • response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types
      • response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types
      • response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types
      • response_body_post_allof_response_body_for_content_types
      • response_body_post_allof_simple_types_response_body_for_content_types
      • response_body_post_allof_with_base_schema_response_body_for_content_types
      • response_body_post_allof_with_one_empty_schema_response_body_for_content_types
      • response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types
      • response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types
      • response_body_post_allof_with_two_empty_schemas_response_body_for_content_types
      • response_body_post_anyof_complex_types_response_body_for_content_types
      • response_body_post_anyof_response_body_for_content_types
      • response_body_post_anyof_with_base_schema_response_body_for_content_types
      • response_body_post_anyof_with_one_empty_schema_response_body_for_content_types
      • response_body_post_array_type_matches_arrays_response_body_for_content_types
      • response_body_post_boolean_type_matches_booleans_response_body_for_content_types
      • response_body_post_by_int_response_body_for_content_types
      • response_body_post_by_number_response_body_for_content_types
      • response_body_post_by_small_number_response_body_for_content_types
      • response_body_post_date_time_format_response_body_for_content_types
      • response_body_post_email_format_response_body_for_content_types
      • response_body_post_enum_with0_does_not_match_false_response_body_for_content_types
      • response_body_post_enum_with1_does_not_match_true_response_body_for_content_types
      • response_body_post_enum_with_escaped_characters_response_body_for_content_types
      • response_body_post_enum_with_false_does_not_match0_response_body_for_content_types
      • response_body_post_enum_with_true_does_not_match1_response_body_for_content_types
      • response_body_post_enums_in_properties_response_body_for_content_types
      • response_body_post_forbidden_property_response_body_for_content_types
      • response_body_post_hostname_format_response_body_for_content_types
      • response_body_post_integer_type_matches_integers_response_body_for_content_types
      • response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types
      • response_body_post_invalid_string_value_for_default_response_body_for_content_types
      • response_body_post_ipv4_format_response_body_for_content_types
      • response_body_post_ipv6_format_response_body_for_content_types
      • response_body_post_json_pointer_format_response_body_for_content_types
      • response_body_post_maximum_validation_response_body_for_content_types
      • response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types
      • response_body_post_maxitems_validation_response_body_for_content_types
      • response_body_post_maxlength_validation_response_body_for_content_types
      • response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types
      • response_body_post_maxproperties_validation_response_body_for_content_types
      • response_body_post_minimum_validation_response_body_for_content_types
      • response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types
      • response_body_post_minitems_validation_response_body_for_content_types
      • response_body_post_minlength_validation_response_body_for_content_types
      • response_body_post_minproperties_validation_response_body_for_content_types
      • response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types
      • response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types
      • response_body_post_nested_items_response_body_for_content_types
      • response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types
      • response_body_post_not_more_complex_schema_response_body_for_content_types
      • response_body_post_not_response_body_for_content_types
      • response_body_post_nul_characters_in_strings_response_body_for_content_types
      • response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types
      • response_body_post_number_type_matches_numbers_response_body_for_content_types
      • response_body_post_object_properties_validation_response_body_for_content_types
      • response_body_post_object_type_matches_objects_response_body_for_content_types
      • response_body_post_oneof_complex_types_response_body_for_content_types
      • response_body_post_oneof_response_body_for_content_types
      • response_body_post_oneof_with_base_schema_response_body_for_content_types
      • response_body_post_oneof_with_empty_schema_response_body_for_content_types
      • response_body_post_oneof_with_required_response_body_for_content_types
      • response_body_post_pattern_is_not_anchored_response_body_for_content_types
      • response_body_post_pattern_validation_response_body_for_content_types
      • response_body_post_properties_with_escaped_characters_response_body_for_content_types
      • response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types
      • response_body_post_ref_in_additionalproperties_response_body_for_content_types
      • response_body_post_ref_in_allof_response_body_for_content_types
      • response_body_post_ref_in_anyof_response_body_for_content_types
      • response_body_post_ref_in_items_response_body_for_content_types
      • response_body_post_ref_in_not_response_body_for_content_types
      • response_body_post_ref_in_oneof_response_body_for_content_types
      • response_body_post_ref_in_property_response_body_for_content_types
      • response_body_post_required_default_validation_response_body_for_content_types
      • response_body_post_required_validation_response_body_for_content_types
      • response_body_post_required_with_empty_array_response_body_for_content_types
      • response_body_post_required_with_escaped_characters_response_body_for_content_types
      • response_body_post_simple_enum_validation_response_body_for_content_types
      • response_body_post_string_type_matches_strings_response_body_for_content_types
      • response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types
      • response_body_post_uniqueitems_false_validation_response_body_for_content_types
      • response_body_post_uniqueitems_validation_response_body_for_content_types
      • response_body_post_uri_format_response_body_for_content_types
      • response_body_post_uri_reference_format_response_body_for_content_types
      • response_body_post_uri_template_format_response_body_for_content_types
    • src/unit_test_api

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

856 files changed

+6269
-5864
lines changed

modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/languages/PythonClientCodegen.java

+1
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ public void processOpts() {
720720
}
721721

722722
supportingFiles.add(new SupportingFile("api_client.hbs", packagePath(), "api_client.py"));
723+
supportingFiles.add(new SupportingFile("api_response.hbs", packagePath(), "api_response.py"));
723724
supportingFiles.add(new SupportingFile("rest.hbs", packagePath(), "rest.py"));
724725
supportingFiles.add(new SupportingFile("schemas.hbs", packagePath(), "schemas.py"));
725726
supportingFiles.add(new SupportingFile("security_schemes.hbs", packagePath(), "security_schemes.py"));

modules/openapi-json-schema-generator/src/main/resources/python/api_client.hbs

+169-129
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# coding: utf-8
2+
{{> _helper_header }}
3+
4+
import dataclasses
5+
import typing
6+
7+
import typing_extensions
8+
import urllib3
9+
10+
from {{packageName}} import schemas
11+
12+
13+
@dataclasses.dataclass
14+
class ApiResponse:
15+
response: urllib3.HTTPResponse
16+
body: typing.Union[schemas.Unset, schemas.Schema] = schemas.unset
17+
headers: typing.Union[schemas.Unset, typing_extensions.TypedDict] = schemas.unset
18+
19+
20+
@dataclasses.dataclass
21+
class ApiResponseWithoutDeserialization(ApiResponse):
22+
response: urllib3.HTTPResponse
23+
body: typing.Union[schemas.Unset, schemas.Schema] = schemas.unset
24+
headers: typing.Union[schemas.Unset, typing_extensions.TypedDict] = schemas.unset

modules/openapi-json-schema-generator/src/main/resources/python/components/_helper_param_or_header_instance.hbs

+2-4
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,17 @@ class {{jsonPathPiece.camelCase}}(api_client.{{#if noName}}Header{{/if}}{{#eq in
4141
{{/with}}
4242
{{/with}}
4343
{{/each}}
44+
{{#each content}}
4445
Content = typing_extensions.TypedDict(
4546
'Content',
4647
{
47-
{{#each content}}
4848
'{{{@key.original}}}': typing.Type[{{@key.camelCase}}MediaType],
49-
{{/each}}
5049
}
5150
)
5251
content: Content = {
53-
{{#each content}}
5452
'{{{@key.original}}}': {{@key.camelCase}}MediaType,
55-
{{/each}}
5653
}
54+
{{/each}}
5755
{{/if}}
5856
{{#if required}}
5957
required = True

modules/openapi-json-schema-generator/src/main/resources/python/components/responses/response.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ from .headers import {{jsonPathPiece.snakeCase}}
3131

3232

3333
@dataclasses.dataclass
34-
class Api{{jsonPathPiece.camelCase}}(api_client.ApiResponse):
34+
class Api{{jsonPathPiece.camelCase}}(api_response.ApiResponse):
3535
response: urllib3.HTTPResponse
3636
{{#and headers content}}
3737
{{#if hasContentSchema}}

modules/openapi-json-schema-generator/src/main/resources/python/components/schemas/_helper_enums.hbs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
@schemas.classproperty
55
def {{this}}(cls):
66
{{#eq @key.type "string"}}
7-
return cls("{{{@key.value}}}")
7+
return cls("{{{@key.value}}}") # type: ignore
88
{{/eq}}
99
{{#eq @key.type "number"}}
10-
return cls({{{@key.value}}})
10+
return cls({{{@key.value}}}) # type: ignore
1111
{{/eq}}
1212
{{#eq @key.type "integer"}}
13-
return cls({{{@key.value}}})
13+
return cls({{{@key.value}}}) # type: ignore
1414
{{/eq}}
1515
{{#eq @key.type "boolean"}}
1616
{{#if @key.value}}
17-
return cls(True)
17+
return cls(True) # type: ignore
1818
{{else}}
19-
return cls(False)
19+
return cls(False) # type: ignore
2020
{{/if}}
2121
{{/eq}}
2222
{{#eq @key.type "null"}}
23-
return cls(None)
23+
return cls(None) # type: ignore
2424
{{/eq}}
2525
{{/each}}
2626
{{/if}}

modules/openapi-json-schema-generator/src/main/resources/python/configurations/api_configuration.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ class ApiConfiguration(object):
409409
used_index = self.server_index_info[key_prefix]
410410
except KeyError:
411411
# fallback and use the default index
412-
used_index = self.server_index_info["servers"]
412+
used_index = self.server_index_info.get("servers", 0)
413413
server = self.server_info[f"{key_prefix}/{used_index}"]
414414
return server.url
415415
{{#if securitySchemes}}
@@ -431,6 +431,6 @@ class ApiConfiguration(object):
431431
used_index = self.security_index_info[key_prefix]
432432
except KeyError:
433433
# fallback and use the default index
434-
used_index = self.security_index_info["security"]
434+
used_index = self.security_index_info.get("security", 0)
435435
return security_requirement_objects[used_index]
436436
{{/if}}

modules/openapi-json-schema-generator/src/main/resources/python/configurations/schema_configuration.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class SchemaConfiguration:
6262

6363
def __init__(
6464
self,
65-
disabled_json_schema_keywords = frozenset(),
65+
disabled_json_schema_keywords = set(),
6666
):
6767
"""Constructor
6868
"""

modules/openapi-json-schema-generator/src/main/resources/python/exceptions.hbs

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
# coding: utf-8
22

33
{{> _helper_header }}
4+
45
import dataclasses
56
import typing
67

7-
from urllib3._collections import HTTPHeaderDict
8+
from {{packageName}} import api_response
89

910

1011
class OpenApiException(Exception):
1112
"""The base exception class for all OpenAPIExceptions"""
1213

14+
def render_path(path_to_item):
15+
"""Returns a string representation of a path"""
16+
result = ""
17+
for pth in path_to_item:
18+
if isinstance(pth, int):
19+
result += "[{0}]".format(pth)
20+
else:
21+
result += "['{0}']".format(pth)
22+
return result
23+
1324

1425
class ApiTypeError(OpenApiException, TypeError):
1526
def __init__(self, msg, path_to_item=None, valid_classes=None,
@@ -93,14 +104,13 @@ class ApiKeyError(OpenApiException, KeyError):
93104
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
94105
super(ApiKeyError, self).__init__(full_msg)
95106

96-
97-
T = typing.TypeVar("T")
107+
T = typing.TypeVar('T', bound=api_response.ApiResponse)
98108

99109

100110
@dataclasses.dataclass
101111
class ApiException(OpenApiException, typing.Generic[T]):
102112
status: int
103-
reason: str
113+
reason: typing.Optional[str] = None
104114
api_response: typing.Optional[T] = None
105115

106116
def __str__(self):
@@ -115,14 +125,3 @@ class ApiException(OpenApiException, typing.Generic[T]):
115125
error_message += "HTTP response body: {0}\n".format(self.api_response.response.data)
116126

117127
return error_message
118-
119-
120-
def render_path(path_to_item):
121-
"""Returns a string representation of a path"""
122-
result = ""
123-
for pth in path_to_item:
124-
if isinstance(pth, int):
125-
result += "[{0}]".format(pth)
126-
else:
127-
result += "['{0}']".format(pth)
128-
return result

modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_args.hbs

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
cookie_params: RequestCookieParameters.Params = frozendict.frozendict(),
2222
{{/if}}
2323
{{#if produces}}
24-
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
24+
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
2525
{{/if}}
2626
{{#neq security null}}
2727
{{#gt security.size 0}}
@@ -36,7 +36,7 @@
3636
{{/neq}}
3737
server_index: typing.Optional[int] = None,
3838
stream: bool = False,
39-
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
39+
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
4040
{{#if isOverload}}
4141
{{#eq skipDeserialization "False"}}
4242
skip_deserialization: typing_extensions.Literal[False] = ...,
@@ -48,10 +48,10 @@
4848
skip_deserialization: bool = False,
4949
{{/if}}
5050
{{#eq skipDeserialization "True"}}
51-
) -> api_client.ApiResponseWithoutDeserialization: ...
51+
) -> api_response.ApiResponseWithoutDeserialization: ...
5252
{{/eq}}
5353
{{#eq skipDeserialization "False"}}
54-
) -> {{#if getAllResponsesAreErrors}}api_client.ApiResponseWithoutDeserialization: ...{{else}}{{#gt getNonErrorResponses.size 1}}typing.Union[
54+
) -> {{#if getAllResponsesAreErrors}}api_response.ApiResponseWithoutDeserialization: ...{{else}}{{#gt getNonErrorResponses.size 1}}typing.Union[
5555
{{> paths/path/verb/_helper_operation_response_type_hint multiple=true }}
5656
]{{else}}{{> paths/path/verb/_helper_operation_response_type_hint multiple=false }}{{/gt}}: ...
5757
{{/if}}
@@ -60,7 +60,7 @@
6060
{{#if isOverload}}
6161
) -> typing.Union[
6262
{{> paths/path/verb/_helper_operation_response_type_hint multiple=true }}
63-
api_client.ApiResponseWithoutDeserialization,
63+
api_response.ApiResponseWithoutDeserialization,
6464
]: ...
6565
{{else}}
6666
):

modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/operation.hbs

+16-16
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class BaseApi(api_client.Api):
253253
{{else}}
254254
{{#if pathItem.servers}}
255255
host = self.api_client.configuration.get_server_url(
256-
'paths/' + path + '/' + '/servers', server_index
256+
'paths/' + path + '/servers', server_index
257257
)
258258
{{else}}
259259
host = self.api_client.configuration.get_server_url(
@@ -281,7 +281,7 @@ class BaseApi(api_client.Api):
281281
{{/neq}}
282282
{{/neq}}
283283

284-
response = self.api_client.call_api(
284+
raw_response = self.api_client.call_api(
285285
resource_path=used_path,
286286
method='{{httpMethod.original}}',
287287
host=host,
@@ -308,10 +308,10 @@ class BaseApi(api_client.Api):
308308
)
309309

310310
if skip_deserialization:
311-
api_response = api_client.ApiResponseWithoutDeserialization(response=response)
311+
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
312312
else:
313313
{{#if nonDefaultResponses}}
314-
status = str(response.status)
314+
status = str(raw_response.status)
315315
{{#if wildcardCodeResponses}}
316316
ranged_response_status_code = status[0]
317317
{{/if}}
@@ -322,17 +322,17 @@ class BaseApi(api_client.Api):
322322
'{{@key}}',
323323
{{/each}}
324324
]
325-
api_response = _status_code_to_response[status].deserialize(
326-
response, self.api_client.schema_configuration)
325+
response = _status_code_to_response[status].deserialize(
326+
raw_response, self.api_client.schema_configuration)
327327
{{#if wildcardCodeResponses}}
328328
elif ranged_response_status_code in _ranged_status_code_to_response:
329329
ranged_response_status_code: typing_extensions.Literal[
330330
{{#each wildcardCodeResponses}}
331331
'{{@key}}',
332332
{{/each}}
333333
]
334-
api_response = _ranged_status_code_to_response[ranged_response_status_code].deserialize(
335-
response, self.api_client.schema_configuration)
334+
response = _ranged_status_code_to_response[ranged_response_status_code].deserialize(
335+
raw_response, self.api_client.schema_configuration)
336336
{{/if}}
337337
{{else}}
338338
if ranged_response_status_code in _ranged_status_code_to_response:
@@ -341,26 +341,26 @@ class BaseApi(api_client.Api):
341341
'{{@key}}',
342342
{{/each}}
343343
]
344-
api_response = _ranged_status_code_to_response[ranged_response_status_code].deserialize(
345-
response, self.api_client.schema_configuration)
344+
response = _ranged_status_code_to_response[ranged_response_status_code].deserialize(
345+
raw_response, self.api_client.schema_configuration)
346346
{{/if}}
347347
else:
348348
{{#if defaultResponse}}
349-
api_response = default_response.deserialize(response, self.api_client.schema_configuration)
349+
response = default_response.deserialize(raw_response, self.api_client.schema_configuration)
350350
{{else}}
351-
api_response = api_client.ApiResponseWithoutDeserialization(response=response)
351+
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
352352
{{/if}}
353353
{{else}}
354354
{{#if defaultResponse}}
355-
api_response = default_response.deserialize(response, self.api_client.schema_configuration)
355+
response = default_response.deserialize(raw_response, self.api_client.schema_configuration)
356356
{{else}}
357-
api_response = api_client.ApiResponseWithoutDeserialization(response=response)
357+
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
358358
{{/if}}
359359
{{/if}}
360360

361-
self._verify_response_status(api_response)
361+
self._verify_response_status(response)
362362

363-
return api_response
363+
return response
364364

365365

366366
class {{operationId.camelCase}}(BaseApi):

modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/operation_doc.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ accept_content_types | typing.Tuple[str] | default is ({{#each produces}}"{{{.}}
9494
server_index | typing.Optional[int] | default is None | Allows one to select a different server
9595
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
9696
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
97-
skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned
97+
skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_response.ApiResponseWithoutDeserialization will be returned
9898
{{#if requestBody}}
9999
{{#unless requestBody.refInfo}}
100100
@@ -118,7 +118,7 @@ skip_deserialization | bool | default is False | when True, headers and body wil
118118
119119
HTTP Status Code | Class | Description
120120
------------- | ------------- | -------------
121-
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
121+
n/a | api_response.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
122122
{{#if defaultResponse}}
123123
{{#with defaultResponse}}
124124
{{#if refInfo}}

0 commit comments

Comments
 (0)