Skip to content

Commit 323e71a

Browse files
committed
Resolve py3.8 incompatibility issues
1 parent 518be9f commit 323e71a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

openapi_python_client/parser/openapi.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def _add_body(
242242
if data.requestBody is None or isinstance(data.requestBody, oai.Reference):
243243
return endpoint, schemas
244244

245-
request_body_parsers: list[tuple[str, RequestBodyParser]] = [
245+
request_body_parsers: List[Tuple[str, RequestBodyParser]] = [
246246
("form_body", Endpoint.parse_request_form_body),
247247
("json_body", Endpoint.parse_request_json_body),
248248
("binary_body", Endpoint.parse_request_binary_body),
@@ -253,12 +253,12 @@ def _add_body(
253253
body, schemas = parser(body=data.requestBody, schemas=schemas, parent_name=endpoint.name, config=config)
254254

255255
if isinstance(body, ParseError):
256+
property_type = property_name
257+
if property_type.endswith('_body'):
258+
property_type = property_type[:-5]
256259
return (
257260
ParseError(
258-
header=(
259-
f"Cannot parse {property_name.removesuffix('_body')} request body of endpoint"
260-
f" {endpoint.name}"
261-
),
261+
header=f"Cannot parse {property_type} request body of endpoint {endpoint.name}",
262262
detail=body.detail,
263263
data=body.data,
264264
),

0 commit comments

Comments
 (0)