Skip to content

Commit ddc512c

Browse files
Add model param
1 parent cd9fcda commit ddc512c

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
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
1617
from ...types import UNSET, Unset
1718

1819

@@ -53,6 +54,7 @@ def httpx_request(
5354
union_prop: Union[Unset, None, float, str] = "not a float",
5455
union_prop_with_ref: Union[Unset, None, float, AnEnum] = 0.6,
5556
enum_prop: Union[Unset, None, AnEnum] = UNSET,
57+
model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
5658
) -> Response[Union[None, HTTPValidationError]]:
5759

5860
json_not_required_not_nullable_datetime_prop: Union[Unset, None, str] = UNSET
@@ -113,6 +115,10 @@ def httpx_request(
113115
if not isinstance(enum_prop, Unset):
114116
json_enum_prop = enum_prop.value if enum_prop else None
115117

118+
json_model_prop: Union[Unset, None, Dict[str, Any]] = UNSET
119+
if not isinstance(model_prop, Unset):
120+
json_model_prop = model_prop.to_dict() if model_prop else None
121+
116122
params: Dict[str, Any] = {
117123
"required_not_nullable_datetime_prop": json_required_not_nullable_datetime_prop,
118124
}
@@ -140,6 +146,8 @@ def httpx_request(
140146
params["union_prop_with_ref"] = json_union_prop_with_ref
141147
if enum_prop is not UNSET and enum_prop is not None:
142148
params["enum_prop"] = json_enum_prop
149+
if model_prop is not UNSET and model_prop is not None:
150+
params["model_prop"] = json_model_prop
143151

144152
response = client.request(
145153
"post",

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ...client import Client
88
from ...models.an_enum import AnEnum
99
from ...models.http_validation_error import HTTPValidationError
10+
from ...models.model_with_union_property import ModelWithUnionProperty
1011
from ...types import UNSET, Response, Unset
1112

1213

@@ -26,6 +27,7 @@ def _get_kwargs(
2627
union_prop: Union[Unset, None, float, str] = "not a float",
2728
union_prop_with_ref: Union[Unset, None, float, AnEnum] = 0.6,
2829
enum_prop: Union[Unset, None, AnEnum] = UNSET,
30+
model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
2931
) -> Dict[str, Any]:
3032
url = "{}/tests/defaults".format(client.base_url)
3133

@@ -89,6 +91,10 @@ def _get_kwargs(
8991
if not isinstance(enum_prop, Unset):
9092
json_enum_prop = enum_prop.value if enum_prop else None
9193

94+
json_model_prop: Union[Unset, None, Dict[str, Any]] = UNSET
95+
if not isinstance(model_prop, Unset):
96+
json_model_prop = model_prop.to_dict() if model_prop else None
97+
9298
params: Dict[str, Any] = {
9399
"required_not_nullable_datetime_prop": json_required_not_nullable_datetime_prop,
94100
}
@@ -116,6 +122,8 @@ def _get_kwargs(
116122
params["union_prop_with_ref"] = json_union_prop_with_ref
117123
if enum_prop is not UNSET and enum_prop is not None:
118124
params["enum_prop"] = json_enum_prop
125+
if model_prop is not UNSET and model_prop is not None:
126+
params["model_prop"] = json_model_prop
119127

120128
return {
121129
"url": url,
@@ -163,6 +171,7 @@ def sync_detailed(
163171
union_prop: Union[Unset, None, float, str] = "not a float",
164172
union_prop_with_ref: Union[Unset, None, float, AnEnum] = 0.6,
165173
enum_prop: Union[Unset, None, AnEnum] = UNSET,
174+
model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
166175
) -> Response[Union[None, HTTPValidationError]]:
167176
kwargs = _get_kwargs(
168177
client=client,
@@ -179,6 +188,7 @@ def sync_detailed(
179188
union_prop=union_prop,
180189
union_prop_with_ref=union_prop_with_ref,
181190
enum_prop=enum_prop,
191+
model_prop=model_prop,
182192
)
183193

184194
response = httpx.post(
@@ -204,6 +214,7 @@ def sync(
204214
union_prop: Union[Unset, None, float, str] = "not a float",
205215
union_prop_with_ref: Union[Unset, None, float, AnEnum] = 0.6,
206216
enum_prop: Union[Unset, None, AnEnum] = UNSET,
217+
model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
207218
) -> Optional[Union[None, HTTPValidationError]]:
208219
""" """
209220

@@ -222,6 +233,7 @@ def sync(
222233
union_prop=union_prop,
223234
union_prop_with_ref=union_prop_with_ref,
224235
enum_prop=enum_prop,
236+
model_prop=model_prop,
225237
).parsed
226238

227239

@@ -241,6 +253,7 @@ async def asyncio_detailed(
241253
union_prop: Union[Unset, None, float, str] = "not a float",
242254
union_prop_with_ref: Union[Unset, None, float, AnEnum] = 0.6,
243255
enum_prop: Union[Unset, None, AnEnum] = UNSET,
256+
model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
244257
) -> Response[Union[None, HTTPValidationError]]:
245258
kwargs = _get_kwargs(
246259
client=client,
@@ -257,6 +270,7 @@ async def asyncio_detailed(
257270
union_prop=union_prop,
258271
union_prop_with_ref=union_prop_with_ref,
259272
enum_prop=enum_prop,
273+
model_prop=model_prop,
260274
)
261275

262276
async with httpx.AsyncClient() as _client:
@@ -281,6 +295,7 @@ async def asyncio(
281295
union_prop: Union[Unset, None, float, str] = "not a float",
282296
union_prop_with_ref: Union[Unset, None, float, AnEnum] = 0.6,
283297
enum_prop: Union[Unset, None, AnEnum] = UNSET,
298+
model_prop: Union[Unset, None, ModelWithUnionProperty] = UNSET,
284299
) -> Optional[Union[None, HTTPValidationError]]:
285300
""" """
286301

@@ -300,5 +315,6 @@ async def asyncio(
300315
union_prop=union_prop,
301316
union_prop_with_ref=union_prop_with_ref,
302317
enum_prop=enum_prop,
318+
model_prop=model_prop,
303319
)
304320
).parsed

end_to_end_tests/openapi.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,14 @@
433433
},
434434
"name": "enum_prop",
435435
"in": "query"
436+
},
437+
{
438+
"required": false,
439+
"schema": {
440+
"$ref": "#/components/schemas/ModelWithUnionProperty"
441+
},
442+
"name": "model_prop",
443+
"in": "query"
436444
}
437445
],
438446
"responses": {

0 commit comments

Comments
 (0)