Skip to content

Commit e131d13

Browse files
committed
Merge branch 'main' into 342-could-not-find-reference-in-parsed-models,-when-components-title-is-different-from-the-name
2 parents d457227 + bf575fb commit e131d13

13 files changed

+109
-188
lines changed

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _get_kwargs(
131131
}
132132

133133

134-
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPValidationError]]:
134+
def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, None]]:
135135
if response.status_code == 200:
136136
response_200 = None
137137

@@ -143,7 +143,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPVal
143143
return None
144144

145145

146-
def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPValidationError]]:
146+
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, None]]:
147147
return Response(
148148
status_code=response.status_code,
149149
content=response.content,
@@ -172,7 +172,7 @@ def sync_detailed(
172172
required_model_prop: ModelWithUnionProperty,
173173
nullable_model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
174174
nullable_required_model_prop: Optional[ModelWithUnionProperty],
175-
) -> Response[Union[None, HTTPValidationError]]:
175+
) -> Response[Union[HTTPValidationError, None]]:
176176
kwargs = _get_kwargs(
177177
client=client,
178178
string_prop=string_prop,
@@ -221,7 +221,7 @@ def sync(
221221
required_model_prop: ModelWithUnionProperty,
222222
nullable_model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
223223
nullable_required_model_prop: Optional[ModelWithUnionProperty],
224-
) -> Optional[Union[None, HTTPValidationError]]:
224+
) -> Optional[Union[HTTPValidationError, None]]:
225225
""" """
226226

227227
return sync_detailed(
@@ -266,7 +266,7 @@ async def asyncio_detailed(
266266
required_model_prop: ModelWithUnionProperty,
267267
nullable_model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
268268
nullable_required_model_prop: Optional[ModelWithUnionProperty],
269-
) -> Response[Union[None, HTTPValidationError]]:
269+
) -> Response[Union[HTTPValidationError, None]]:
270270
kwargs = _get_kwargs(
271271
client=client,
272272
string_prop=string_prop,
@@ -314,7 +314,7 @@ async def asyncio(
314314
required_model_prop: ModelWithUnionProperty,
315315
nullable_model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
316316
nullable_required_model_prop: Optional[ModelWithUnionProperty],
317-
) -> Optional[Union[None, HTTPValidationError]]:
317+
) -> Optional[Union[HTTPValidationError, None]]:
318318
""" """
319319

320320
return (

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _get_kwargs(
4747
}
4848

4949

50-
def _parse_response(*, response: httpx.Response) -> Optional[Union[List[AModel], HTTPValidationError]]:
50+
def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, List[AModel]]]:
5151
if response.status_code == 200:
5252
response_200 = []
5353
_response_200 = response.json()
@@ -61,10 +61,14 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[List[AModel],
6161
response_422 = HTTPValidationError.from_dict(response.json())
6262

6363
return response_422
64+
if response.status_code == 423:
65+
response_423 = HTTPValidationError.from_dict(response.json())
66+
67+
return response_423
6468
return None
6569

6670

67-
def _build_response(*, response: httpx.Response) -> Response[Union[List[AModel], HTTPValidationError]]:
71+
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, List[AModel]]]:
6872
return Response(
6973
status_code=response.status_code,
7074
content=response.content,
@@ -78,7 +82,7 @@ def sync_detailed(
7882
client: Client,
7983
an_enum_value: List[AnEnum],
8084
some_date: Union[datetime.date, datetime.datetime],
81-
) -> Response[Union[List[AModel], HTTPValidationError]]:
85+
) -> Response[Union[HTTPValidationError, List[AModel]]]:
8286
kwargs = _get_kwargs(
8387
client=client,
8488
an_enum_value=an_enum_value,
@@ -97,7 +101,7 @@ def sync(
97101
client: Client,
98102
an_enum_value: List[AnEnum],
99103
some_date: Union[datetime.date, datetime.datetime],
100-
) -> Optional[Union[List[AModel], HTTPValidationError]]:
104+
) -> Optional[Union[HTTPValidationError, List[AModel]]]:
101105
""" Get a list of things """
102106

103107
return sync_detailed(
@@ -112,7 +116,7 @@ async def asyncio_detailed(
112116
client: Client,
113117
an_enum_value: List[AnEnum],
114118
some_date: Union[datetime.date, datetime.datetime],
115-
) -> Response[Union[List[AModel], HTTPValidationError]]:
119+
) -> Response[Union[HTTPValidationError, List[AModel]]]:
116120
kwargs = _get_kwargs(
117121
client=client,
118122
an_enum_value=an_enum_value,
@@ -130,7 +134,7 @@ async def asyncio(
130134
client: Client,
131135
an_enum_value: List[AnEnum],
132136
some_date: Union[datetime.date, datetime.datetime],
133-
) -> Optional[Union[List[AModel], HTTPValidationError]]:
137+
) -> Optional[Union[HTTPValidationError, List[AModel]]]:
134138
""" Get a list of things """
135139

136140
return (

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _get_kwargs(
3434
}
3535

3636

37-
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPValidationError]]:
37+
def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, None]]:
3838
if response.status_code == 200:
3939
response_200 = None
4040

@@ -46,7 +46,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPVal
4646
return None
4747

4848

49-
def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPValidationError]]:
49+
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, None]]:
5050
return Response(
5151
status_code=response.status_code,
5252
content=response.content,
@@ -59,7 +59,7 @@ def sync_detailed(
5959
*,
6060
client: Client,
6161
int_enum: AnIntEnum,
62-
) -> Response[Union[None, HTTPValidationError]]:
62+
) -> Response[Union[HTTPValidationError, None]]:
6363
kwargs = _get_kwargs(
6464
client=client,
6565
int_enum=int_enum,
@@ -76,7 +76,7 @@ def sync(
7676
*,
7777
client: Client,
7878
int_enum: AnIntEnum,
79-
) -> Optional[Union[None, HTTPValidationError]]:
79+
) -> Optional[Union[HTTPValidationError, None]]:
8080
""" """
8181

8282
return sync_detailed(
@@ -89,7 +89,7 @@ async def asyncio_detailed(
8989
*,
9090
client: Client,
9191
int_enum: AnIntEnum,
92-
) -> Response[Union[None, HTTPValidationError]]:
92+
) -> Response[Union[HTTPValidationError, None]]:
9393
kwargs = _get_kwargs(
9494
client=client,
9595
int_enum=int_enum,
@@ -105,7 +105,7 @@ async def asyncio(
105105
*,
106106
client: Client,
107107
int_enum: AnIntEnum,
108-
) -> Optional[Union[None, HTTPValidationError]]:
108+
) -> Optional[Union[HTTPValidationError, None]]:
109109
""" """
110110

111111
return (

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _get_kwargs(
2929
}
3030

3131

32-
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPValidationError]]:
32+
def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, None]]:
3333
if response.status_code == 200:
3434
response_200 = None
3535

@@ -41,7 +41,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPVal
4141
return None
4242

4343

44-
def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPValidationError]]:
44+
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, None]]:
4545
return Response(
4646
status_code=response.status_code,
4747
content=response.content,
@@ -54,7 +54,7 @@ def sync_detailed(
5454
*,
5555
client: Client,
5656
json_body: AModel,
57-
) -> Response[Union[None, HTTPValidationError]]:
57+
) -> Response[Union[HTTPValidationError, None]]:
5858
kwargs = _get_kwargs(
5959
client=client,
6060
json_body=json_body,
@@ -71,7 +71,7 @@ def sync(
7171
*,
7272
client: Client,
7373
json_body: AModel,
74-
) -> Optional[Union[None, HTTPValidationError]]:
74+
) -> Optional[Union[HTTPValidationError, None]]:
7575
""" Try sending a JSON body """
7676

7777
return sync_detailed(
@@ -84,7 +84,7 @@ async def asyncio_detailed(
8484
*,
8585
client: Client,
8686
json_body: AModel,
87-
) -> Response[Union[None, HTTPValidationError]]:
87+
) -> Response[Union[HTTPValidationError, None]]:
8888
kwargs = _get_kwargs(
8989
client=client,
9090
json_body=json_body,
@@ -100,7 +100,7 @@ async def asyncio(
100100
*,
101101
client: Client,
102102
json_body: AModel,
103-
) -> Optional[Union[None, HTTPValidationError]]:
103+
) -> Optional[Union[HTTPValidationError, None]]:
104104
""" Try sending a JSON body """
105105

106106
return (

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/tests/optional_value_tests_optional_query_param.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _get_kwargs(
3535
}
3636

3737

38-
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPValidationError]]:
38+
def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, None]]:
3939
if response.status_code == 200:
4040
response_200 = None
4141

@@ -47,7 +47,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[None, HTTPVal
4747
return None
4848

4949

50-
def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPValidationError]]:
50+
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, None]]:
5151
return Response(
5252
status_code=response.status_code,
5353
content=response.content,
@@ -60,7 +60,7 @@ def sync_detailed(
6060
*,
6161
client: Client,
6262
query_param: Union[Unset, List[str]] = UNSET,
63-
) -> Response[Union[None, HTTPValidationError]]:
63+
) -> Response[Union[HTTPValidationError, None]]:
6464
kwargs = _get_kwargs(
6565
client=client,
6666
query_param=query_param,
@@ -77,7 +77,7 @@ def sync(
7777
*,
7878
client: Client,
7979
query_param: Union[Unset, List[str]] = UNSET,
80-
) -> Optional[Union[None, HTTPValidationError]]:
80+
) -> Optional[Union[HTTPValidationError, None]]:
8181
""" Test optional query parameters """
8282

8383
return sync_detailed(
@@ -90,7 +90,7 @@ async def asyncio_detailed(
9090
*,
9191
client: Client,
9292
query_param: Union[Unset, List[str]] = UNSET,
93-
) -> Response[Union[None, HTTPValidationError]]:
93+
) -> Response[Union[HTTPValidationError, None]]:
9494
kwargs = _get_kwargs(
9595
client=client,
9696
query_param=query_param,
@@ -106,7 +106,7 @@ async def asyncio(
106106
*,
107107
client: Client,
108108
query_param: Union[Unset, List[str]] = UNSET,
109-
) -> Optional[Union[None, HTTPValidationError]]:
109+
) -> Optional[Union[HTTPValidationError, None]]:
110110
""" Test optional query parameters """
111111

112112
return (
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Optional, Union
1+
from typing import Any, Dict
22

33
import httpx
44

@@ -26,32 +26,20 @@ def _get_kwargs(
2626
}
2727

2828

29-
def _parse_response(*, response: httpx.Response) -> Optional[Union[None, None]]:
30-
if response.status_code == 200:
31-
response_200 = None
32-
33-
return response_200
34-
if response.status_code == 401:
35-
response_401 = None
36-
37-
return response_401
38-
return None
39-
40-
41-
def _build_response(*, response: httpx.Response) -> Response[Union[None, None]]:
29+
def _build_response(*, response: httpx.Response) -> Response[None]:
4230
return Response(
4331
status_code=response.status_code,
4432
content=response.content,
4533
headers=response.headers,
46-
parsed=_parse_response(response=response),
34+
parsed=None,
4735
)
4836

4937

5038
def sync_detailed(
5139
*,
5240
client: Client,
5341
my_token: str,
54-
) -> Response[Union[None, None]]:
42+
) -> Response[None]:
5543
kwargs = _get_kwargs(
5644
client=client,
5745
my_token=my_token,
@@ -64,24 +52,11 @@ def sync_detailed(
6452
return _build_response(response=response)
6553

6654

67-
def sync(
68-
*,
69-
client: Client,
70-
my_token: str,
71-
) -> Optional[Union[None, None]]:
72-
""" Test optional cookie parameters """
73-
74-
return sync_detailed(
75-
client=client,
76-
my_token=my_token,
77-
).parsed
78-
79-
8055
async def asyncio_detailed(
8156
*,
8257
client: Client,
8358
my_token: str,
84-
) -> Response[Union[None, None]]:
59+
) -> Response[None]:
8560
kwargs = _get_kwargs(
8661
client=client,
8762
my_token=my_token,
@@ -91,18 +66,3 @@ async def asyncio_detailed(
9166
response = await _client.get(**kwargs)
9267

9368
return _build_response(response=response)
94-
95-
96-
async def asyncio(
97-
*,
98-
client: Client,
99-
my_token: str,
100-
) -> Optional[Union[None, None]]:
101-
""" Test optional cookie parameters """
102-
103-
return (
104-
await asyncio_detailed(
105-
client=client,
106-
my_token=my_token,
107-
)
108-
).parsed

0 commit comments

Comments
 (0)