Skip to content

Commit a5d09f4

Browse files
Regenerate tests
1 parent f469553 commit a5d09f4

22 files changed

+243
-959
lines changed

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

Lines changed: 68 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
Client = httpx.Client
88

99
import datetime
10-
from typing import Dict, List, Union
10+
from typing import Dict, List, Optional, Union
1111

1212
from dateutil.parser import isoparse
1313

1414
from ...models.an_enum import AnEnum
1515
from ...models.http_validation_error import HTTPValidationError
16-
from ...models.model_with_union_property import ModelWithUnionProperty
1716
from ...types import UNSET, Unset
1817

1918

@@ -41,83 +40,106 @@ def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPVal
4140
def httpx_request(
4241
*,
4342
client: Client,
44-
string_prop: Union[Unset, str] = "the default string",
45-
datetime_prop: Union[Unset, datetime.datetime] = isoparse("1010-10-10T00:00:00"),
46-
date_prop: Union[Unset, datetime.date] = isoparse("1010-10-10").date(),
47-
float_prop: Union[Unset, float] = 3.14,
48-
int_prop: Union[Unset, int] = 7,
49-
boolean_prop: Union[Unset, bool] = False,
50-
list_prop: Union[Unset, List[AnEnum]] = UNSET,
51-
union_prop: Union[Unset, float, str] = "not a float",
52-
union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6,
53-
enum_prop: Union[Unset, AnEnum] = UNSET,
54-
model_prop: Union[ModelWithUnionProperty, Unset] = UNSET,
43+
string_prop: Union[Unset, None, str] = "the default string",
44+
not_required_not_nullable_datetime_prop: Union[Unset, None, datetime.datetime] = isoparse("1010-10-10T00:00:00"),
45+
not_required_nullable_datetime_prop: Union[Unset, None, datetime.datetime] = isoparse("1010-10-10T00:00:00"),
46+
required_not_nullable_datetime_prop: datetime.datetime = isoparse("1010-10-10T00:00:00"),
47+
required_nullable_datetime_prop: Optional[datetime.datetime] = isoparse("1010-10-10T00:00:00"),
48+
date_prop: Union[Unset, None, datetime.date] = isoparse("1010-10-10").date(),
49+
float_prop: Union[Unset, None, float] = 3.14,
50+
int_prop: Union[Unset, None, int] = 7,
51+
boolean_prop: Union[Unset, None, bool] = False,
52+
list_prop: Union[Unset, None, List[AnEnum]] = UNSET,
53+
union_prop: Union[Unset, None, float, str] = "not a float",
54+
union_prop_with_ref: Union[Unset, None, float, AnEnum] = 0.6,
55+
enum_prop: Union[Unset, None, AnEnum] = UNSET,
5556
) -> Response[Union[None, HTTPValidationError]]:
5657

57-
json_datetime_prop: Union[Unset, str] = UNSET
58-
if not isinstance(datetime_prop, Unset):
59-
json_datetime_prop = datetime_prop.isoformat()
58+
json_not_required_not_nullable_datetime_prop: Union[Unset, None, str] = UNSET
59+
if not isinstance(not_required_not_nullable_datetime_prop, Unset):
60+
json_not_required_not_nullable_datetime_prop = (
61+
not_required_not_nullable_datetime_prop.isoformat() if not_required_not_nullable_datetime_prop else None
62+
)
6063

61-
json_date_prop: Union[Unset, str] = UNSET
64+
json_not_required_nullable_datetime_prop: Union[Unset, None, str] = UNSET
65+
if not isinstance(not_required_nullable_datetime_prop, Unset):
66+
json_not_required_nullable_datetime_prop = (
67+
not_required_nullable_datetime_prop.isoformat() if not_required_nullable_datetime_prop else None
68+
)
69+
70+
json_required_not_nullable_datetime_prop = required_not_nullable_datetime_prop.isoformat()
71+
72+
json_required_nullable_datetime_prop = (
73+
required_nullable_datetime_prop.isoformat() if required_nullable_datetime_prop else None
74+
)
75+
76+
json_date_prop: Union[Unset, None, str] = UNSET
6277
if not isinstance(date_prop, Unset):
63-
json_date_prop = date_prop.isoformat()
78+
json_date_prop = date_prop.isoformat() if date_prop else None
6479

65-
json_list_prop: Union[Unset, List[Any]] = UNSET
80+
json_list_prop: Union[Unset, None, List[Any]] = UNSET
6681
if not isinstance(list_prop, Unset):
67-
json_list_prop = []
68-
for list_prop_item_data in list_prop:
69-
list_prop_item = list_prop_item_data.value
82+
if list_prop is None:
83+
json_list_prop = None
84+
else:
85+
json_list_prop = []
86+
for list_prop_item_data in list_prop:
87+
list_prop_item = list_prop_item_data.value
7088

71-
json_list_prop.append(list_prop_item)
89+
json_list_prop.append(list_prop_item)
7290

73-
json_union_prop: Union[Unset, float, str]
91+
json_union_prop: Union[Unset, None, float, str]
7492
if isinstance(union_prop, Unset):
7593
json_union_prop = UNSET
94+
elif union_prop is None:
95+
json_union_prop = None
7696
else:
7797
json_union_prop = union_prop
7898

79-
json_union_prop_with_ref: Union[Unset, float, AnEnum]
99+
json_union_prop_with_ref: Union[Unset, None, float, int]
80100
if isinstance(union_prop_with_ref, Unset):
81101
json_union_prop_with_ref = UNSET
102+
elif union_prop_with_ref is None:
103+
json_union_prop_with_ref = None
82104
elif isinstance(union_prop_with_ref, AnEnum):
83105
json_union_prop_with_ref = UNSET
84106
if not isinstance(union_prop_with_ref, Unset):
85-
json_union_prop_with_ref = union_prop_with_ref
107+
json_union_prop_with_ref = union_prop_with_ref.value
86108

87109
else:
88110
json_union_prop_with_ref = union_prop_with_ref
89111

90-
json_enum_prop: Union[Unset, AnEnum] = UNSET
112+
json_enum_prop: Union[Unset, None, int] = UNSET
91113
if not isinstance(enum_prop, Unset):
92-
json_enum_prop = enum_prop
93-
94-
json_model_prop: Union[Unset, Dict[str, Any]] = UNSET
95-
if not isinstance(model_prop, Unset):
96-
json_model_prop = model_prop.to_dict()
114+
json_enum_prop = enum_prop.value if enum_prop else None
97115

98-
params: Dict[str, Any] = {}
99-
if not isinstance(string_prop, Unset) and string_prop is not None:
116+
params: Dict[str, Any] = {
117+
"required_not_nullable_datetime_prop": json_required_not_nullable_datetime_prop,
118+
}
119+
if string_prop is not UNSET and string_prop is not None:
100120
params["string_prop"] = string_prop
101-
if not isinstance(json_datetime_prop, Unset) and json_datetime_prop is not None:
102-
params["datetime_prop"] = json_datetime_prop
103-
if not isinstance(json_date_prop, Unset) and json_date_prop is not None:
121+
if not_required_not_nullable_datetime_prop is not UNSET and not_required_not_nullable_datetime_prop is not None:
122+
params["not_required_not_nullable_datetime_prop"] = json_not_required_not_nullable_datetime_prop
123+
if not_required_nullable_datetime_prop is not UNSET and not_required_nullable_datetime_prop is not None:
124+
params["not_required_nullable_datetime_prop"] = json_not_required_nullable_datetime_prop
125+
if required_nullable_datetime_prop is not None:
126+
params["required_nullable_datetime_prop"] = json_required_nullable_datetime_prop
127+
if date_prop is not UNSET and date_prop is not None:
104128
params["date_prop"] = json_date_prop
105-
if not isinstance(float_prop, Unset) and float_prop is not None:
129+
if float_prop is not UNSET and float_prop is not None:
106130
params["float_prop"] = float_prop
107-
if not isinstance(int_prop, Unset) and int_prop is not None:
131+
if int_prop is not UNSET and int_prop is not None:
108132
params["int_prop"] = int_prop
109-
if not isinstance(boolean_prop, Unset) and boolean_prop is not None:
133+
if boolean_prop is not UNSET and boolean_prop is not None:
110134
params["boolean_prop"] = boolean_prop
111-
if not isinstance(json_list_prop, Unset) and json_list_prop is not None:
135+
if list_prop is not UNSET and list_prop is not None:
112136
params["list_prop"] = json_list_prop
113-
if not isinstance(json_union_prop, Unset) and json_union_prop is not None:
137+
if union_prop is not UNSET and union_prop is not None:
114138
params["union_prop"] = json_union_prop
115-
if not isinstance(json_union_prop_with_ref, Unset) and json_union_prop_with_ref is not None:
139+
if union_prop_with_ref is not UNSET and union_prop_with_ref is not None:
116140
params["union_prop_with_ref"] = json_union_prop_with_ref
117-
if not isinstance(json_enum_prop, Unset) and json_enum_prop is not None:
141+
if enum_prop is not UNSET and enum_prop is not None:
118142
params["enum_prop"] = json_enum_prop
119-
if not isinstance(json_model_prop, Unset) and json_model_prop is not None:
120-
params.update(json_model_prop)
121143

122144
response = client.request(
123145
"post",

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,18 @@ def _build_response(*, response: httpx.Response) -> Response[Union[None, HTTPVal
3636
def httpx_request(
3737
*,
3838
client: Client,
39-
query_param: Union[Unset, List[str]] = UNSET,
39+
query_param: Union[Unset, None, List[str]] = UNSET,
4040
) -> Response[Union[None, HTTPValidationError]]:
4141

42-
json_query_param: Union[Unset, List[Any]] = UNSET
42+
json_query_param: Union[Unset, None, List[Any]] = UNSET
4343
if not isinstance(query_param, Unset):
44-
json_query_param = query_param
44+
if query_param is None:
45+
json_query_param = None
46+
else:
47+
json_query_param = query_param
4548

4649
params: Dict[str, Any] = {}
47-
if not isinstance(json_query_param, Unset) and json_query_param is not None:
50+
if query_param is not UNSET and query_param is not None:
4851
params["query_param"] = json_query_param
4952

5053
response = client.request(

end_to_end_tests/golden-record-custom/custom_e2e/models/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
""" Contains all the data models used in inputs/outputs """
22

33
from .a_model import AModel
4-
from .a_model_model import AModelModel
5-
from .a_model_not_required_model import AModelNotRequiredModel
6-
from .a_model_not_required_nullable_model import AModelNotRequiredNullableModel
7-
from .a_model_nullable_model import AModelNullableModel
84
from .an_enum import AnEnum
95
from .an_int_enum import AnIntEnum
106
from .body_upload_file_tests_upload_post import BodyUploadFileTestsUploadPost

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

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
import attr
55
from dateutil.parser import isoparse
66

7-
from ..models.a_model_model import AModelModel
8-
from ..models.a_model_not_required_model import AModelNotRequiredModel
9-
from ..models.a_model_not_required_nullable_model import AModelNotRequiredNullableModel
10-
from ..models.a_model_nullable_model import AModelNullableModel
117
from ..models.an_enum import AnEnum
128
from ..models.different_enum import DifferentEnum
139
from ..types import UNSET, Unset
@@ -21,16 +17,12 @@ class AModel:
2117
a_camel_date_time: Union[datetime.datetime, datetime.date]
2218
a_date: datetime.date
2319
required_not_nullable: str
24-
model: AModelModel
2520
a_nullable_date: Optional[datetime.date]
2621
required_nullable: Optional[str]
27-
nullable_model: Optional[AModelNullableModel]
2822
nested_list_of_enums: Union[Unset, List[List[DifferentEnum]]] = UNSET
2923
attr_1_leading_digit: Union[Unset, str] = UNSET
30-
not_required_nullable: Union[Unset, Optional[str]] = UNSET
24+
not_required_nullable: Union[Unset, None, str] = UNSET
3125
not_required_not_nullable: Union[Unset, str] = UNSET
32-
not_required_model: Union[AModelNotRequiredModel, Unset] = UNSET
33-
not_required_nullable_model: Union[Optional[AModelNotRequiredNullableModel], Unset] = UNSET
3426

3527
def to_dict(self) -> Dict[str, Any]:
3628
an_enum_value = self.an_enum_value.value
@@ -43,8 +35,6 @@ def to_dict(self) -> Dict[str, Any]:
4335

4436
a_date = self.a_date.isoformat()
4537
required_not_nullable = self.required_not_nullable
46-
model = self.model.to_dict()
47-
4838
nested_list_of_enums: Union[Unset, List[Any]] = UNSET
4939
if not isinstance(self.nested_list_of_enums, Unset):
5040
nested_list_of_enums = []
@@ -62,17 +52,6 @@ def to_dict(self) -> Dict[str, Any]:
6252
required_nullable = self.required_nullable
6353
not_required_nullable = self.not_required_nullable
6454
not_required_not_nullable = self.not_required_not_nullable
65-
nullable_model = self.nullable_model.to_dict() if self.nullable_model else None
66-
67-
not_required_model: Union[Unset, Dict[str, Any]] = UNSET
68-
if not isinstance(self.not_required_model, Unset):
69-
not_required_model = self.not_required_model.to_dict()
70-
71-
not_required_nullable_model: Union[None, Unset, Dict[str, Any]] = UNSET
72-
if not isinstance(self.not_required_nullable_model, Unset):
73-
not_required_nullable_model = (
74-
self.not_required_nullable_model.to_dict() if self.not_required_nullable_model else None
75-
)
7655

7756
field_dict: Dict[str, Any] = {}
7857
field_dict.update(
@@ -81,10 +60,8 @@ def to_dict(self) -> Dict[str, Any]:
8160
"aCamelDateTime": a_camel_date_time,
8261
"a_date": a_date,
8362
"required_not_nullable": required_not_nullable,
84-
"model": model,
8563
"a_nullable_date": a_nullable_date,
8664
"required_nullable": required_nullable,
87-
"nullable_model": nullable_model,
8865
}
8966
)
9067
if nested_list_of_enums is not UNSET:
@@ -95,10 +72,6 @@ def to_dict(self) -> Dict[str, Any]:
9572
field_dict["not_required_nullable"] = not_required_nullable
9673
if not_required_not_nullable is not UNSET:
9774
field_dict["not_required_not_nullable"] = not_required_not_nullable
98-
if not_required_model is not UNSET:
99-
field_dict["not_required_model"] = not_required_model
100-
if not_required_nullable_model is not UNSET:
101-
field_dict["not_required_nullable_model"] = not_required_nullable_model
10275

10376
return field_dict
10477

@@ -126,8 +99,6 @@ def _parse_a_camel_date_time(data: Any) -> Union[datetime.datetime, datetime.dat
12699

127100
required_not_nullable = d.pop("required_not_nullable")
128101

129-
model = AModelModel.from_dict(d.pop("model"))
130-
131102
nested_list_of_enums = []
132103
_nested_list_of_enums = d.pop("nested_list_of_enums", UNSET)
133104
for nested_list_of_enums_item_data in _nested_list_of_enums or []:
@@ -153,38 +124,17 @@ def _parse_a_camel_date_time(data: Any) -> Union[datetime.datetime, datetime.dat
153124

154125
not_required_not_nullable = d.pop("not_required_not_nullable", UNSET)
155126

156-
nullable_model = None
157-
_nullable_model = d.pop("nullable_model")
158-
if _nullable_model is not None:
159-
nullable_model = AModelNullableModel.from_dict(cast(Dict[str, Any], _nullable_model))
160-
161-
not_required_model: Union[AModelNotRequiredModel, Unset] = UNSET
162-
_not_required_model = d.pop("not_required_model", UNSET)
163-
if not isinstance(_not_required_model, Unset):
164-
not_required_model = AModelNotRequiredModel.from_dict(cast(Dict[str, Any], _not_required_model))
165-
166-
not_required_nullable_model = None
167-
_not_required_nullable_model = d.pop("not_required_nullable_model", UNSET)
168-
if _not_required_nullable_model is not None and not isinstance(_not_required_nullable_model, Unset):
169-
not_required_nullable_model = AModelNotRequiredNullableModel.from_dict(
170-
cast(Dict[str, Any], _not_required_nullable_model)
171-
)
172-
173127
a_model = AModel(
174128
an_enum_value=an_enum_value,
175129
a_camel_date_time=a_camel_date_time,
176130
a_date=a_date,
177131
required_not_nullable=required_not_nullable,
178-
model=model,
179132
nested_list_of_enums=nested_list_of_enums,
180133
a_nullable_date=a_nullable_date,
181134
attr_1_leading_digit=attr_1_leading_digit,
182135
required_nullable=required_nullable,
183136
not_required_nullable=not_required_nullable,
184137
not_required_not_nullable=not_required_not_nullable,
185-
nullable_model=nullable_model,
186-
not_required_model=not_required_model,
187-
not_required_nullable_model=not_required_nullable_model,
188138
)
189139

190140
return a_model

0 commit comments

Comments
 (0)