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

Commit 4a28451

Browse files
authored
[python-experimental] Fix error message (#13471)
* fix error message formatting * add more infos in error message
1 parent 54e712a commit 4a28451

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

modules/openapi-generator/src/main/resources/python-experimental/api_client.handlebars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,8 @@ class OpenApiResponse(JSONDetector):
915915
if self.content is not None:
916916
if content_type not in self.content:
917917
raise ApiValueError(
918-
f'Invalid content_type={content_type} returned for response with '
919-
'status_code={str(response.status)}'
918+
f"Invalid content_type returned. Content_type='{content_type}' was returned "
919+
f"when only {str(set(self.content))} are defined for status_code={str(response.status)}"
920920
)
921921
body_schema = self.content[content_type].schema
922922
if body_schema is None:

samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ def deserialize(self, response: urllib3.HTTPResponse, configuration: Configurati
919919
if self.content is not None:
920920
if content_type not in self.content:
921921
raise ApiValueError(
922-
f'Invalid content_type={content_type} returned for response with '
923-
'status_code={str(response.status)}'
922+
f"Invalid content_type returned. Content_type='{content_type}' was returned "
923+
f"when only {str(set(self.content))} are defined for status_code={str(response.status)}"
924924
)
925925
body_schema = self.content[content_type].schema
926926
if body_schema is None:

samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ def deserialize(self, response: urllib3.HTTPResponse, configuration: Configurati
919919
if self.content is not None:
920920
if content_type not in self.content:
921921
raise ApiValueError(
922-
f'Invalid content_type={content_type} returned for response with '
923-
'status_code={str(response.status)}'
922+
f"Invalid content_type returned. Content_type='{content_type}' was returned "
923+
f"when only {str(set(self.content))} are defined for status_code={str(response.status)}"
924924
)
925925
body_schema = self.content[content_type].schema
926926
if body_schema is None:

0 commit comments

Comments
 (0)