Skip to content

Commit 5addb4a

Browse files
committed
Fix naming and required/not required for shared enums/models
1 parent 745a7a3 commit 5addb4a

File tree

17 files changed

+113
-363
lines changed

17 files changed

+113
-363
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ test-reports/
2626
htmlcov/
2727

2828
# Generated end to end test data
29-
my-test-api-client
29+
my-test-api-client/
30+
custom-e2e/

end_to_end_tests/custom_config.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
project_name_override: "custom-e2e"
2+
package_name_override: "custom_e2e"
3+
class_overrides:
4+
_ABCResponse:
5+
class_name: ABCResponse
6+
module_name: abc_response
7+
AnEnumValueItem:
8+
class_name: AnEnumValue
9+
module_name: an_enum_value
10+
NestedListOfEnumsItemItem:
11+
class_name: AnEnumValue
12+
module_name: an_enum_value
13+
field_prefix: attr_

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _build_response(*, response: httpx.Response) -> httpx.Response[Union[None, H
3535
def httpx_request(
3636
*,
3737
client: Client,
38-
json_body: Dict[Any, Any],
38+
json_body: DictProp,
3939
string_prop: Union[Unset, str] = "the default string",
4040
datetime_prop: Union[Unset, datetime.datetime] = isoparse("1010-10-10T00:00:00"),
4141
date_prop: Union[Unset, datetime.date] = isoparse("1010-10-10").date(),
@@ -58,10 +58,10 @@ def httpx_request(
5858
json_list_prop: Union[Unset, List[Any]] = UNSET
5959
if not isinstance(list_prop, Unset):
6060
json_list_prop = []
61-
for an_enum_data in list_prop:
62-
an_enum = an_enum_data.value
61+
for list_prop_item_data in list_prop:
62+
list_prop_item = list_prop_item_data.value
6363

64-
json_list_prop.append(an_enum)
64+
json_list_prop.append(list_prop_item)
6565

6666
json_union_prop: Union[Unset, float, str]
6767
if isinstance(union_prop, Unset):

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def httpx_request(
3737
) -> httpx.Response[Union[List[AModel], HTTPValidationError]]:
3838

3939
json_an_enum_value = []
40-
for an_enum_data in an_enum_value:
41-
an_enum = an_enum_data.value
40+
for an_enum_value_item_data in an_enum_value:
41+
an_enum_value_item = an_enum_value_item_data.value
4242

43-
json_an_enum_value.append(an_enum)
43+
json_an_enum_value.append(an_enum_value_item)
4444

4545
if isinstance(some_date, datetime.date):
4646
json_some_date = some_date.isoformat()

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def _build_response(*, response: httpx.Response) -> httpx.Response[Union[None, H
2828
def httpx_request(
2929
*,
3030
client: Client,
31-
an_int_enum: AnIntEnum,
31+
int_enum: AnIntEnum,
3232
) -> httpx.Response[Union[None, HTTPValidationError]]:
3333

34-
json_an_int_enum = an_int_enum.value
34+
json_int_enum = int_enum.value
3535

3636
params: Dict[str, Any] = {
37-
"AnIntEnum": json_an_int_enum,
37+
"int_enum": json_int_enum,
3838
}
3939

4040
response = client.request(

end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/optional_value_tests_optional_query_param.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Client = httpx.Client
66

7-
from typing import List, Optional, Union
7+
from typing import List, Union
88

99
from ...models.http_validation_error import HTTPValidationError
1010
from ...types import UNSET, Unset

end_to_end_tests/golden-record-custom/my_test_api_client/api/tests/upload_file_tests_upload_post.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Client = httpx.Client
66

7-
from typing import Optional, Union
7+
from typing import Union
88

99
from ...models.body_upload_file_tests_upload_post import BodyUploadFileTestsUploadPost
1010
from ...models.http_validation_error import HTTPValidationError

end_to_end_tests/golden-record-custom/my_test_api_client/models/a_model.py

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

end_to_end_tests/golden-record-custom/my_test_api_client/models/http_validation_error.py

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

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def _get_kwargs(
4040
json_list_prop: Union[Unset, List[Any]] = UNSET
4141
if not isinstance(list_prop, Unset):
4242
json_list_prop = []
43-
for an_enum_data in list_prop:
44-
an_enum = an_enum_data.value
43+
for list_prop_item_data in list_prop:
44+
list_prop_item = list_prop_item_data.value
4545

46-
json_list_prop.append(an_enum)
46+
json_list_prop.append(list_prop_item)
4747

4848
json_union_prop: Union[Unset, float, str]
4949
if isinstance(union_prop, Unset):
@@ -53,11 +53,11 @@ def _get_kwargs(
5353
else:
5454
json_union_prop = union_prop
5555

56-
json_an_enum = enum_prop.value
56+
json_enum_prop: Union[Unset, AnEnum] = UNSET
57+
if not isinstance(enum_prop, Unset):
58+
json_enum_prop = enum_prop.value
5759

58-
params: Dict[str, Any] = {
59-
"AnEnum": json_an_enum,
60-
}
60+
params: Dict[str, Any] = {}
6161
if string_prop is not UNSET:
6262
params["string_prop"] = string_prop
6363
if datetime_prop is not UNSET:
@@ -74,6 +74,8 @@ def _get_kwargs(
7474
params["list_prop"] = json_list_prop
7575
if union_prop is not UNSET:
7676
params["union_prop"] = json_union_prop
77+
if enum_prop is not UNSET:
78+
params["enum_prop"] = json_enum_prop
7779

7880
json_json_body = json_body.to_dict()
7981

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_data in an_enum_value:
25-
an_enum = an_enum_data.value
24+
for an_enum_value_item_data in an_enum_value:
25+
an_enum_value_item = an_enum_value_item_data.value
2626

27-
json_an_enum_value.append(an_enum)
27+
json_an_enum_value.append(an_enum_value_item)
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-
an_int_enum: AnIntEnum,
14+
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_an_int_enum = an_int_enum.value
20+
json_int_enum = int_enum.value
2121

2222
params: Dict[str, Any] = {
23-
"AnIntEnum": json_an_int_enum,
23+
"int_enum": json_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-
an_int_enum: AnIntEnum,
55+
int_enum: AnIntEnum,
5656
) -> Response[Union[None, HTTPValidationError]]:
5757
kwargs = _get_kwargs(
5858
client=client,
59-
an_int_enum=an_int_enum,
59+
int_enum=int_enum,
6060
)
6161

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

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

8181

8282
async def asyncio_detailed(
8383
*,
8484
client: Client,
85-
an_int_enum: AnIntEnum,
85+
int_enum: AnIntEnum,
8686
) -> Response[Union[None, HTTPValidationError]]:
8787
kwargs = _get_kwargs(
8888
client=client,
89-
an_int_enum=an_int_enum,
89+
int_enum=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-
an_int_enum: AnIntEnum,
101+
int_enum: AnIntEnum,
102102
) -> Optional[Union[None, HTTPValidationError]]:
103103
""" """
104104

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

0 commit comments

Comments
 (0)