Skip to content

Commit 73d68d5

Browse files
fix: Make empty response a NoneProperty
We know the type of this: It's `None`, so we don't need to annotate it as `Any`.
1 parent 47cfdec commit 73d68d5

16 files changed

+146
-90
lines changed

end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _get_kwargs(
3434
}
3535

3636

37-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
37+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[None]:
3838
if response.status_code == HTTPStatus.OK:
3939
return None
4040
if client.raise_on_unexpected_status:
@@ -43,7 +43,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any
4343
return None
4444

4545

46-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
46+
def _build_response(*, client: Client, response: httpx.Response) -> Response[None]:
4747
return Response(
4848
status_code=HTTPStatus(response.status_code),
4949
content=response.content,
@@ -56,7 +56,7 @@ def sync_detailed(
5656
*,
5757
client: Client,
5858
common: Union[Unset, None, str] = UNSET,
59-
) -> Response[Any]:
59+
) -> Response[None]:
6060
"""
6161
Args:
6262
common (Union[Unset, None, str]):
@@ -66,7 +66,7 @@ def sync_detailed(
6666
httpx.TimeoutException: If the request takes longer than Client.timeout.
6767
6868
Returns:
69-
Response[Any]
69+
Response[None]
7070
"""
7171

7272
kwargs = _get_kwargs(
@@ -86,7 +86,7 @@ async def asyncio_detailed(
8686
*,
8787
client: Client,
8888
common: Union[Unset, None, str] = UNSET,
89-
) -> Response[Any]:
89+
) -> Response[None]:
9090
"""
9191
Args:
9292
common (Union[Unset, None, str]):
@@ -96,7 +96,7 @@ async def asyncio_detailed(
9696
httpx.TimeoutException: If the request takes longer than Client.timeout.
9797
9898
Returns:
99-
Response[Any]
99+
Response[None]
100100
"""
101101

102102
kwargs = _get_kwargs(

end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _get_kwargs(
3434
}
3535

3636

37-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
37+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[None]:
3838
if response.status_code == HTTPStatus.OK:
3939
return None
4040
if client.raise_on_unexpected_status:
@@ -43,7 +43,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any
4343
return None
4444

4545

46-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
46+
def _build_response(*, client: Client, response: httpx.Response) -> Response[None]:
4747
return Response(
4848
status_code=HTTPStatus(response.status_code),
4949
content=response.content,
@@ -56,7 +56,7 @@ def sync_detailed(
5656
*,
5757
client: Client,
5858
common: Union[Unset, None, str] = UNSET,
59-
) -> Response[Any]:
59+
) -> Response[None]:
6060
"""
6161
Args:
6262
common (Union[Unset, None, str]):
@@ -66,7 +66,7 @@ def sync_detailed(
6666
httpx.TimeoutException: If the request takes longer than Client.timeout.
6767
6868
Returns:
69-
Response[Any]
69+
Response[None]
7070
"""
7171

7272
kwargs = _get_kwargs(
@@ -86,7 +86,7 @@ async def asyncio_detailed(
8686
*,
8787
client: Client,
8888
common: Union[Unset, None, str] = UNSET,
89-
) -> Response[Any]:
89+
) -> Response[None]:
9090
"""
9191
Args:
9292
common (Union[Unset, None, str]):
@@ -96,7 +96,7 @@ async def asyncio_detailed(
9696
httpx.TimeoutException: If the request takes longer than Client.timeout.
9797
9898
Returns:
99-
Response[Any]
99+
Response[None]
100100
"""
101101

102102
kwargs = _get_kwargs(

end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _get_kwargs(
5353
}
5454

5555

56-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
56+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[None]:
5757
if response.status_code == HTTPStatus.OK:
5858
return None
5959
if client.raise_on_unexpected_status:
@@ -62,7 +62,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any
6262
return None
6363

6464

65-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
65+
def _build_response(*, client: Client, response: httpx.Response) -> Response[None]:
6666
return Response(
6767
status_code=HTTPStatus(response.status_code),
6868
content=response.content,
@@ -80,7 +80,7 @@ def sync_detailed(
8080
integer_header: Union[Unset, int] = UNSET,
8181
int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET,
8282
string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET,
83-
) -> Response[Any]:
83+
) -> Response[None]:
8484
"""
8585
Args:
8686
boolean_header (Union[Unset, bool]):
@@ -95,7 +95,7 @@ def sync_detailed(
9595
httpx.TimeoutException: If the request takes longer than Client.timeout.
9696
9797
Returns:
98-
Response[Any]
98+
Response[None]
9999
"""
100100

101101
kwargs = _get_kwargs(
@@ -125,7 +125,7 @@ async def asyncio_detailed(
125125
integer_header: Union[Unset, int] = UNSET,
126126
int_enum_header: Union[Unset, GetLocationHeaderTypesIntEnumHeader] = UNSET,
127127
string_enum_header: Union[Unset, GetLocationHeaderTypesStringEnumHeader] = UNSET,
128-
) -> Response[Any]:
128+
) -> Response[None]:
129129
"""
130130
Args:
131131
boolean_header (Union[Unset, bool]):
@@ -140,7 +140,7 @@ async def asyncio_detailed(
140140
httpx.TimeoutException: If the request takes longer than Client.timeout.
141141
142142
Returns:
143-
Response[Any]
143+
Response[None]
144144
"""
145145

146146
kwargs = _get_kwargs(

end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _get_kwargs(
5858
}
5959

6060

61-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
61+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[None]:
6262
if response.status_code == HTTPStatus.OK:
6363
return None
6464
if client.raise_on_unexpected_status:
@@ -67,7 +67,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any
6767
return None
6868

6969

70-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
70+
def _build_response(*, client: Client, response: httpx.Response) -> Response[None]:
7171
return Response(
7272
status_code=HTTPStatus(response.status_code),
7373
content=response.content,
@@ -83,7 +83,7 @@ def sync_detailed(
8383
null_required: Union[Unset, None, datetime.datetime] = UNSET,
8484
null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
8585
not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
86-
) -> Response[Any]:
86+
) -> Response[None]:
8787
"""
8888
Args:
8989
not_null_required (datetime.datetime):
@@ -96,7 +96,7 @@ def sync_detailed(
9696
httpx.TimeoutException: If the request takes longer than Client.timeout.
9797
9898
Returns:
99-
Response[Any]
99+
Response[None]
100100
"""
101101

102102
kwargs = _get_kwargs(
@@ -122,7 +122,7 @@ async def asyncio_detailed(
122122
null_required: Union[Unset, None, datetime.datetime] = UNSET,
123123
null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
124124
not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
125-
) -> Response[Any]:
125+
) -> Response[None]:
126126
"""
127127
Args:
128128
not_null_required (datetime.datetime):
@@ -135,7 +135,7 @@ async def asyncio_detailed(
135135
httpx.TimeoutException: If the request takes longer than Client.timeout.
136136
137137
Returns:
138-
Response[Any]
138+
Response[None]
139139
"""
140140

141141
kwargs = _get_kwargs(

end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _get_kwargs(
4646
}
4747

4848

49-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
49+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[None]:
5050
if response.status_code == HTTPStatus.OK:
5151
return None
5252
if client.raise_on_unexpected_status:
@@ -55,7 +55,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any
5555
return None
5656

5757

58-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
58+
def _build_response(*, client: Client, response: httpx.Response) -> Response[None]:
5959
return Response(
6060
status_code=HTTPStatus(response.status_code),
6161
content=response.content,
@@ -72,7 +72,7 @@ def sync_detailed(
7272
integer_param: Union[Unset, None, int] = 0,
7373
header_param: Union[Unset, str] = UNSET,
7474
cookie_param: Union[Unset, str] = UNSET,
75-
) -> Response[Any]:
75+
) -> Response[None]:
7676
"""Test different types of parameter references
7777
7878
Args:
@@ -87,7 +87,7 @@ def sync_detailed(
8787
httpx.TimeoutException: If the request takes longer than Client.timeout.
8888
8989
Returns:
90-
Response[Any]
90+
Response[None]
9191
"""
9292

9393
kwargs = _get_kwargs(
@@ -115,7 +115,7 @@ async def asyncio_detailed(
115115
integer_param: Union[Unset, None, int] = 0,
116116
header_param: Union[Unset, str] = UNSET,
117117
cookie_param: Union[Unset, str] = UNSET,
118-
) -> Response[Any]:
118+
) -> Response[None]:
119119
"""Test different types of parameter references
120120
121121
Args:
@@ -130,7 +130,7 @@ async def asyncio_detailed(
130130
httpx.TimeoutException: If the request takes longer than Client.timeout.
131131
132132
Returns:
133-
Response[Any]
133+
Response[None]
134134
"""
135135

136136
kwargs = _get_kwargs(

end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _get_kwargs(
3535
}
3636

3737

38-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
38+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[None]:
3939
if response.status_code == HTTPStatus.OK:
4040
return None
4141
if client.raise_on_unexpected_status:
@@ -44,7 +44,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any
4444
return None
4545

4646

47-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
47+
def _build_response(*, client: Client, response: httpx.Response) -> Response[None]:
4848
return Response(
4949
status_code=HTTPStatus(response.status_code),
5050
content=response.content,
@@ -58,7 +58,7 @@ def sync_detailed(
5858
*,
5959
client: Client,
6060
param_query: Union[Unset, None, str] = UNSET,
61-
) -> Response[Any]:
61+
) -> Response[None]:
6262
"""
6363
Args:
6464
param_path (str):
@@ -69,7 +69,7 @@ def sync_detailed(
6969
httpx.TimeoutException: If the request takes longer than Client.timeout.
7070
7171
Returns:
72-
Response[Any]
72+
Response[None]
7373
"""
7474

7575
kwargs = _get_kwargs(
@@ -91,7 +91,7 @@ async def asyncio_detailed(
9191
*,
9292
client: Client,
9393
param_query: Union[Unset, None, str] = UNSET,
94-
) -> Response[Any]:
94+
) -> Response[None]:
9595
"""
9696
Args:
9797
param_path (str):
@@ -102,7 +102,7 @@ async def asyncio_detailed(
102102
httpx.TimeoutException: If the request takes longer than Client.timeout.
103103
104104
Returns:
105-
Response[Any]
105+
Response[None]
106106
"""
107107

108108
kwargs = _get_kwargs(

end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _get_kwargs(
3535
}
3636

3737

38-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]:
38+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[None]:
3939
if response.status_code == HTTPStatus.OK:
4040
return None
4141
if client.raise_on_unexpected_status:
@@ -44,7 +44,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any
4444
return None
4545

4646

47-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
47+
def _build_response(*, client: Client, response: httpx.Response) -> Response[None]:
4848
return Response(
4949
status_code=HTTPStatus(response.status_code),
5050
content=response.content,
@@ -58,7 +58,7 @@ def sync_detailed(
5858
*,
5959
client: Client,
6060
param_query: str = "overridden_in_GET",
61-
) -> Response[Any]:
61+
) -> Response[None]:
6262
"""Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code
6363
6464
Args:
@@ -71,7 +71,7 @@ def sync_detailed(
7171
httpx.TimeoutException: If the request takes longer than Client.timeout.
7272
7373
Returns:
74-
Response[Any]
74+
Response[None]
7575
"""
7676

7777
kwargs = _get_kwargs(
@@ -93,7 +93,7 @@ async def asyncio_detailed(
9393
*,
9494
client: Client,
9595
param_query: str = "overridden_in_GET",
96-
) -> Response[Any]:
96+
) -> Response[None]:
9797
"""Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code
9898
9999
Args:
@@ -106,7 +106,7 @@ async def asyncio_detailed(
106106
httpx.TimeoutException: If the request takes longer than Client.timeout.
107107
108108
Returns:
109-
Response[Any]
109+
Response[None]
110110
"""
111111

112112
kwargs = _get_kwargs(

0 commit comments

Comments
 (0)