Skip to content

Commit db662d0

Browse files
committed
Address CI failures
1 parent b400726 commit db662d0

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

openapi_python_client/parser/properties/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ class PropertyProtocol(Protocol):
6363
json_is_dict: ClassVar[bool] = False
6464

6565
@property
66-
def type_string(self):
66+
def type_string(self) -> str:
6767
return self.get_type_string()
6868

6969
@property
70-
def instance_type_string(self):
70+
def instance_type_string(self) -> str:
7171
return self.get_instance_type_string()
7272

7373
@abstractmethod

openapi_python_client/parser/responses.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _source_by_content_type(content_type: str, config: Config) -> Optional[_Resp
6969

7070

7171
def empty_response(
72-
*,
72+
*,
7373
status_code: HTTPStatus,
7474
response_name: str,
7575
config: Config,
@@ -79,18 +79,21 @@ def empty_response(
7979
return Response(
8080
data=data,
8181
status_code=status_code,
82-
content=[MediaType(
83-
content_type=None,
84-
prop=AnyProperty(
85-
name=response_name,
86-
default=None,
87-
required=True,
88-
python_name=PythonIdentifier(value=response_name, prefix=config.field_prefix),
89-
description=data.description if isinstance(data, oai.Response) else None,
90-
example=None,
91-
),
92-
source=NONE_SOURCE,
93-
data=None)],
82+
content=[
83+
MediaType(
84+
content_type=None,
85+
prop=AnyProperty(
86+
name=response_name,
87+
default=None,
88+
required=True,
89+
python_name=PythonIdentifier(value=response_name, prefix=config.field_prefix),
90+
description=data.description if isinstance(data, oai.Response) else None,
91+
example=None,
92+
),
93+
source=NONE_SOURCE,
94+
data=None,
95+
)
96+
],
9497
)
9598

9699

@@ -135,12 +138,12 @@ def response_from_data( # noqa: PLR0911
135138
source = _source_by_content_type(content_type, config)
136139
if source is not None:
137140
prop, schemas = property_from_data(
138-
name=response_name,
139-
required=True,
140-
data=media_type.media_type_schema or oai.Schema(),
141-
schemas=schemas,
142-
parent_name=parent_name,
143-
config=config,
141+
name=response_name,
142+
required=True,
143+
data=media_type.media_type_schema or oai.Schema(),
144+
schemas=schemas,
145+
parent_name=parent_name,
146+
config=config,
144147
)
145148
if isinstance(prop, PropertyError):
146149
return prop, schemas

tests/test_parser/test_responses.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
from openapi_python_client.parser import responses
77
from openapi_python_client.parser.errors import ParseError, PropertyError
88
from openapi_python_client.parser.properties import Schemas
9-
from openapi_python_client.parser.responses import BYTES_SOURCE, JSON_SOURCE, NONE_SOURCE, MediaType, Response, response_from_data
9+
from openapi_python_client.parser.responses import (
10+
BYTES_SOURCE,
11+
JSON_SOURCE,
12+
NONE_SOURCE,
13+
MediaType,
14+
Response,
15+
response_from_data,
16+
)
1017

1118
MODULE_NAME = "openapi_python_client.parser.responses"
1219

0 commit comments

Comments
 (0)