Skip to content

Commit 35b831a

Browse files
Support AnyProperty
1 parent 032a4a4 commit 35b831a

File tree

43 files changed

+229
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+229
-106
lines changed

end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py

Lines changed: 8 additions & 8 deletions
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[HTTPValidationError, None]]:
134+
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
135135
if response.status_code == 200:
136136
response_200 = None
137137

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

145145

146-
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, None]]:
146+
def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
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[HTTPValidationError, None]]:
175+
) -> Response[Union[Any, HTTPValidationError]]:
176176
kwargs = _get_kwargs(
177177
client=client,
178178
string_prop=string_prop,
@@ -221,8 +221,8 @@ 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[HTTPValidationError, None]]:
225-
""" """
224+
) -> Optional[Union[Any, HTTPValidationError]]:
225+
""" """
226226

227227
return sync_detailed(
228228
client=client,
@@ -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[HTTPValidationError, None]]:
269+
) -> Response[Union[Any, HTTPValidationError]]:
270270
kwargs = _get_kwargs(
271271
client=client,
272272
string_prop=string_prop,
@@ -314,8 +314,8 @@ 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[HTTPValidationError, None]]:
318-
""" """
317+
) -> Optional[Union[Any, HTTPValidationError]]:
318+
""" """
319319

320320
return (
321321
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def sync(
5959
*,
6060
client: Client,
6161
) -> Optional[List[bool]]:
62-
"""Get a list of booleans"""
62+
""" Get a list of booleans """
6363

6464
return sync_detailed(
6565
client=client,
@@ -84,7 +84,7 @@ async def asyncio(
8484
*,
8585
client: Client,
8686
) -> Optional[List[bool]]:
87-
"""Get a list of booleans"""
87+
""" Get a list of booleans """
8888

8989
return (
9090
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def sync(
5959
*,
6060
client: Client,
6161
) -> Optional[List[float]]:
62-
"""Get a list of floats"""
62+
""" Get a list of floats """
6363

6464
return sync_detailed(
6565
client=client,
@@ -84,7 +84,7 @@ async def asyncio(
8484
*,
8585
client: Client,
8686
) -> Optional[List[float]]:
87-
"""Get a list of floats"""
87+
""" Get a list of floats """
8888

8989
return (
9090
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def sync(
5959
*,
6060
client: Client,
6161
) -> Optional[List[int]]:
62-
"""Get a list of integers"""
62+
""" Get a list of integers """
6363

6464
return sync_detailed(
6565
client=client,
@@ -84,7 +84,7 @@ async def asyncio(
8484
*,
8585
client: Client,
8686
) -> Optional[List[int]]:
87-
"""Get a list of integers"""
87+
""" Get a list of integers """
8888

8989
return (
9090
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def sync(
5959
*,
6060
client: Client,
6161
) -> Optional[List[str]]:
62-
"""Get a list of strings"""
62+
""" Get a list of strings """
6363

6464
return sync_detailed(
6565
client=client,
@@ -84,7 +84,7 @@ async def asyncio(
8484
*,
8585
client: Client,
8686
) -> Optional[List[str]]:
87-
"""Get a list of strings"""
87+
""" Get a list of strings """
8888

8989
return (
9090
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def sync(
102102
an_enum_value: List[AnEnum],
103103
some_date: Union[datetime.date, datetime.datetime],
104104
) -> Optional[Union[HTTPValidationError, List[AModel]]]:
105-
"""Get a list of things"""
105+
""" Get a list of things """
106106

107107
return sync_detailed(
108108
client=client,
@@ -135,7 +135,7 @@ async def asyncio(
135135
an_enum_value: List[AnEnum],
136136
some_date: Union[datetime.date, datetime.datetime],
137137
) -> Optional[Union[HTTPValidationError, List[AModel]]]:
138-
"""Get a list of things"""
138+
""" Get a list of things """
139139

140140
return (
141141
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py

Lines changed: 8 additions & 8 deletions
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[HTTPValidationError, None]]:
37+
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
3838
if response.status_code == 200:
3939
response_200 = None
4040

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

4848

49-
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, None]]:
49+
def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
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[HTTPValidationError, None]]:
62+
) -> Response[Union[Any, HTTPValidationError]]:
6363
kwargs = _get_kwargs(
6464
client=client,
6565
int_enum=int_enum,
@@ -76,8 +76,8 @@ def sync(
7676
*,
7777
client: Client,
7878
int_enum: AnIntEnum,
79-
) -> Optional[Union[HTTPValidationError, None]]:
80-
""" """
79+
) -> Optional[Union[Any, HTTPValidationError]]:
80+
""" """
8181

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

111111
return (
112112
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py

Lines changed: 8 additions & 8 deletions
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[HTTPValidationError, None]]:
32+
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
3333
if response.status_code == 200:
3434
response_200 = None
3535

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

4343

44-
def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, None]]:
44+
def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
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[HTTPValidationError, None]]:
57+
) -> Response[Union[Any, HTTPValidationError]]:
5858
kwargs = _get_kwargs(
5959
client=client,
6060
json_body=json_body,
@@ -71,8 +71,8 @@ def sync(
7171
*,
7272
client: Client,
7373
json_body: AModel,
74-
) -> Optional[Union[HTTPValidationError, None]]:
75-
"""Try sending a JSON body"""
74+
) -> Optional[Union[Any, HTTPValidationError]]:
75+
""" Try sending a JSON body """
7676

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

106106
return (
107107
await asyncio_detailed(

end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict
1+
from typing import Any, Dict, Optional
22

33
import httpx
44

@@ -23,19 +23,27 @@ def _get_kwargs(
2323
}
2424

2525

26-
def _build_response(*, response: httpx.Response) -> Response[None]:
26+
def _parse_response(*, response: httpx.Response) -> Optional[Any]:
27+
if response.status_code == 200:
28+
response_200 = None
29+
30+
return response_200
31+
return None
32+
33+
34+
def _build_response(*, response: httpx.Response) -> Response[Any]:
2735
return Response(
2836
status_code=response.status_code,
2937
content=response.content,
3038
headers=response.headers,
31-
parsed=None,
39+
parsed=_parse_response(response=response),
3240
)
3341

3442

3543
def sync_detailed(
3644
*,
3745
client: Client,
38-
) -> Response[None]:
46+
) -> Response[Any]:
3947
kwargs = _get_kwargs(
4048
client=client,
4149
)
@@ -47,10 +55,21 @@ def sync_detailed(
4755
return _build_response(response=response)
4856

4957

58+
def sync(
59+
*,
60+
client: Client,
61+
) -> Optional[Any]:
62+
""" """
63+
64+
return sync_detailed(
65+
client=client,
66+
).parsed
67+
68+
5069
async def asyncio_detailed(
5170
*,
5271
client: Client,
53-
) -> Response[None]:
72+
) -> Response[Any]:
5473
kwargs = _get_kwargs(
5574
client=client,
5675
)
@@ -59,3 +78,16 @@ async def asyncio_detailed(
5978
response = await _client.get(**kwargs)
6079

6180
return _build_response(response=response)
81+
82+
83+
async def asyncio(
84+
*,
85+
client: Client,
86+
) -> Optional[Any]:
87+
""" """
88+
89+
return (
90+
await asyncio_detailed(
91+
client=client,
92+
)
93+
).parsed

end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def sync(
6060
*,
6161
client: Client,
6262
) -> Optional[File]:
63-
""" """
63+
""" """
6464

6565
return sync_detailed(
6666
client=client,
@@ -85,7 +85,7 @@ async def asyncio(
8585
*,
8686
client: Client,
8787
) -> Optional[File]:
88-
""" """
88+
""" """
8989

9090
return (
9191
await asyncio_detailed(

0 commit comments

Comments
 (0)