Skip to content

Commit 1150b37

Browse files
committed
[WIP] Major refactor of models/enums/schemas.
1 parent 890ef7e commit 1150b37

File tree

20 files changed

+1104
-1087
lines changed

20 files changed

+1104
-1087
lines changed

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

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
from ...client import Client
88
from ...models.an_enum import AnEnum
9+
from ...models.dict_prop import DictProp
910
from ...models.http_validation_error import HTTPValidationError
1011
from ...types import Response
1112

1213

1314
def _get_kwargs(
1415
*,
1516
client: Client,
16-
json_body: Dict[Any, Any],
17+
json_body: DictProp,
1718
string_prop: Optional[str] = "the default string",
1819
datetime_prop: Optional[datetime.datetime] = isoparse("1010-10-10T00:00:00"),
1920
date_prop: Optional[datetime.date] = isoparse("1010-10-10").date(),
@@ -22,7 +23,7 @@ def _get_kwargs(
2223
boolean_prop: Optional[bool] = False,
2324
list_prop: Optional[List[AnEnum]] = None,
2425
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
25-
enum_prop: Optional[AnEnum] = None,
26+
an_enum: AnEnum,
2627
) -> Dict[str, Any]:
2728
url = "{}/tests/defaults".format(client.base_url)
2829

@@ -36,10 +37,10 @@ def _get_kwargs(
3637
json_list_prop = None
3738
else:
3839
json_list_prop = []
39-
for list_prop_item_data in list_prop:
40-
list_prop_item = list_prop_item_data.value
40+
for an_enum_data in list_prop:
41+
an_enum = an_enum_data.value
4142

42-
json_list_prop.append(list_prop_item)
43+
json_list_prop.append(an_enum)
4344

4445
if union_prop is None:
4546
json_union_prop: Optional[Union[Optional[float], Optional[str]]] = None
@@ -48,9 +49,11 @@ def _get_kwargs(
4849
else:
4950
json_union_prop = union_prop
5051

51-
json_enum_prop = enum_prop.value if enum_prop else None
52+
json_an_enum = an_enum.value
5253

53-
params: Dict[str, Any] = {}
54+
params: Dict[str, Any] = {
55+
"AnEnum": json_an_enum,
56+
}
5457
if string_prop is not None:
5558
params["string_prop"] = string_prop
5659
if datetime_prop is not None:
@@ -67,10 +70,8 @@ def _get_kwargs(
6770
params["list_prop"] = json_list_prop
6871
if union_prop is not None:
6972
params["union_prop"] = json_union_prop
70-
if enum_prop is not None:
71-
params["enum_prop"] = json_enum_prop
7273

73-
json_json_body = json_body
74+
json_json_body = json_body.to_dict()
7475

7576
return {
7677
"url": url,
@@ -102,7 +103,7 @@ def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPVal
102103
def sync_detailed(
103104
*,
104105
client: Client,
105-
json_body: Dict[Any, Any],
106+
json_body: DictProp,
106107
string_prop: Optional[str] = "the default string",
107108
datetime_prop: Optional[datetime.datetime] = isoparse("1010-10-10T00:00:00"),
108109
date_prop: Optional[datetime.date] = isoparse("1010-10-10").date(),
@@ -111,7 +112,7 @@ def sync_detailed(
111112
boolean_prop: Optional[bool] = False,
112113
list_prop: Optional[List[AnEnum]] = None,
113114
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
114-
enum_prop: Optional[AnEnum] = None,
115+
an_enum: AnEnum,
115116
) -> Response[Union[None, HTTPValidationError]]:
116117
kwargs = _get_kwargs(
117118
client=client,
@@ -124,7 +125,7 @@ def sync_detailed(
124125
boolean_prop=boolean_prop,
125126
list_prop=list_prop,
126127
union_prop=union_prop,
127-
enum_prop=enum_prop,
128+
an_enum=an_enum,
128129
)
129130

130131
response = httpx.post(
@@ -137,7 +138,7 @@ def sync_detailed(
137138
def sync(
138139
*,
139140
client: Client,
140-
json_body: Dict[Any, Any],
141+
json_body: DictProp,
141142
string_prop: Optional[str] = "the default string",
142143
datetime_prop: Optional[datetime.datetime] = isoparse("1010-10-10T00:00:00"),
143144
date_prop: Optional[datetime.date] = isoparse("1010-10-10").date(),
@@ -146,7 +147,7 @@ def sync(
146147
boolean_prop: Optional[bool] = False,
147148
list_prop: Optional[List[AnEnum]] = None,
148149
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
149-
enum_prop: Optional[AnEnum] = None,
150+
an_enum: AnEnum,
150151
) -> Optional[Union[None, HTTPValidationError]]:
151152
""" """
152153

@@ -161,14 +162,14 @@ def sync(
161162
boolean_prop=boolean_prop,
162163
list_prop=list_prop,
163164
union_prop=union_prop,
164-
enum_prop=enum_prop,
165+
an_enum=an_enum,
165166
).parsed
166167

167168

168169
async def asyncio_detailed(
169170
*,
170171
client: Client,
171-
json_body: Dict[Any, Any],
172+
json_body: DictProp,
172173
string_prop: Optional[str] = "the default string",
173174
datetime_prop: Optional[datetime.datetime] = isoparse("1010-10-10T00:00:00"),
174175
date_prop: Optional[datetime.date] = isoparse("1010-10-10").date(),
@@ -177,7 +178,7 @@ async def asyncio_detailed(
177178
boolean_prop: Optional[bool] = False,
178179
list_prop: Optional[List[AnEnum]] = None,
179180
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
180-
enum_prop: Optional[AnEnum] = None,
181+
an_enum: AnEnum,
181182
) -> Response[Union[None, HTTPValidationError]]:
182183
kwargs = _get_kwargs(
183184
client=client,
@@ -190,7 +191,7 @@ async def asyncio_detailed(
190191
boolean_prop=boolean_prop,
191192
list_prop=list_prop,
192193
union_prop=union_prop,
193-
enum_prop=enum_prop,
194+
an_enum=an_enum,
194195
)
195196

196197
async with httpx.AsyncClient() as _client:
@@ -202,7 +203,7 @@ async def asyncio_detailed(
202203
async def asyncio(
203204
*,
204205
client: Client,
205-
json_body: Dict[Any, Any],
206+
json_body: DictProp,
206207
string_prop: Optional[str] = "the default string",
207208
datetime_prop: Optional[datetime.datetime] = isoparse("1010-10-10T00:00:00"),
208209
date_prop: Optional[datetime.date] = isoparse("1010-10-10").date(),
@@ -211,7 +212,7 @@ async def asyncio(
211212
boolean_prop: Optional[bool] = False,
212213
list_prop: Optional[List[AnEnum]] = None,
213214
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
214-
enum_prop: Optional[AnEnum] = None,
215+
an_enum: AnEnum,
215216
) -> Optional[Union[None, HTTPValidationError]]:
216217
""" """
217218

@@ -227,6 +228,6 @@ async def asyncio(
227228
boolean_prop=boolean_prop,
228229
list_prop=list_prop,
229230
union_prop=union_prop,
230-
enum_prop=enum_prop,
231+
an_enum=an_enum,
231232
)
232233
).parsed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ def _get_kwargs(
2121
headers: Dict[str, Any] = client.get_headers()
2222

2323
json_an_enum_value = []
24-
for an_enum_value_item_data in an_enum_value:
25-
an_enum_value_item = an_enum_value_item_data.value
24+
for an_enum_data in an_enum_value:
25+
an_enum = an_enum_data.value
2626

27-
json_an_enum_value.append(an_enum_value_item)
27+
json_an_enum_value.append(an_enum)
2828

2929
if isinstance(some_date, datetime.date):
3030
json_some_date = some_date.isoformat()

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
def _get_kwargs(
1212
*,
1313
client: Client,
14-
int_enum: AnIntEnum,
14+
an_int_enum: AnIntEnum,
1515
) -> Dict[str, Any]:
1616
url = "{}/tests/int_enum".format(client.base_url)
1717

1818
headers: Dict[str, Any] = client.get_headers()
1919

20-
json_int_enum = int_enum.value
20+
json_an_int_enum = an_int_enum.value
2121

2222
params: Dict[str, Any] = {
23-
"int_enum": json_int_enum,
23+
"AnIntEnum": json_an_int_enum,
2424
}
2525

2626
return {
@@ -52,11 +52,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPVal
5252
def sync_detailed(
5353
*,
5454
client: Client,
55-
int_enum: AnIntEnum,
55+
an_int_enum: AnIntEnum,
5656
) -> Response[Union[None, HTTPValidationError]]:
5757
kwargs = _get_kwargs(
5858
client=client,
59-
int_enum=int_enum,
59+
an_int_enum=an_int_enum,
6060
)
6161

6262
response = httpx.post(
@@ -69,24 +69,24 @@ def sync_detailed(
6969
def sync(
7070
*,
7171
client: Client,
72-
int_enum: AnIntEnum,
72+
an_int_enum: AnIntEnum,
7373
) -> Optional[Union[None, HTTPValidationError]]:
7474
""" """
7575

7676
return sync_detailed(
7777
client=client,
78-
int_enum=int_enum,
78+
an_int_enum=an_int_enum,
7979
).parsed
8080

8181

8282
async def asyncio_detailed(
8383
*,
8484
client: Client,
85-
int_enum: AnIntEnum,
85+
an_int_enum: AnIntEnum,
8686
) -> Response[Union[None, HTTPValidationError]]:
8787
kwargs = _get_kwargs(
8888
client=client,
89-
int_enum=int_enum,
89+
an_int_enum=an_int_enum,
9090
)
9191

9292
async with httpx.AsyncClient() as _client:
@@ -98,13 +98,13 @@ async def asyncio_detailed(
9898
async def asyncio(
9999
*,
100100
client: Client,
101-
int_enum: AnIntEnum,
101+
an_int_enum: AnIntEnum,
102102
) -> Optional[Union[None, HTTPValidationError]]:
103103
""" """
104104

105105
return (
106106
await asyncio_detailed(
107107
client=client,
108-
int_enum=int_enum,
108+
an_int_enum=an_int_enum,
109109
)
110110
).parsed

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

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)