Skip to content

Commit 3304030

Browse files
dbantyrtaycher
andauthored
feat: New and improved docstrings in generated functions and classes [#503, #505, #551]. Thanks @rtaycher!
Co-authored-by: Roman A. Taycher <[email protected]>
1 parent 49580ec commit 3304030

File tree

65 files changed

+1134
-97
lines changed

Some content is hidden

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

65 files changed

+1134
-97
lines changed

Diff for: end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/parameters/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
class ParametersEndpoints:
1414
@classmethod
1515
def get_common_parameters_overriding_param(cls) -> types.ModuleType:
16+
"""
17+
Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code
18+
"""
1619
return get_common_parameters_overriding_param
1720

1821
@classmethod

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py

+16
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def sync_detailed(
4444
client: Client,
4545
common: Union[Unset, None, str] = UNSET,
4646
) -> Response[Any]:
47+
"""
48+
Args:
49+
common (Union[Unset, None, str]):
50+
51+
Returns:
52+
Response[Any]
53+
"""
54+
4755
kwargs = _get_kwargs(
4856
client=client,
4957
common=common,
@@ -62,6 +70,14 @@ async def asyncio_detailed(
6270
client: Client,
6371
common: Union[Unset, None, str] = UNSET,
6472
) -> Response[Any]:
73+
"""
74+
Args:
75+
common (Union[Unset, None, str]):
76+
77+
Returns:
78+
Response[Any]
79+
"""
80+
6581
kwargs = _get_kwargs(
6682
client=client,
6783
common=common,

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py

+16
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def sync_detailed(
4444
client: Client,
4545
common: Union[Unset, None, str] = UNSET,
4646
) -> Response[Any]:
47+
"""
48+
Args:
49+
common (Union[Unset, None, str]):
50+
51+
Returns:
52+
Response[Any]
53+
"""
54+
4755
kwargs = _get_kwargs(
4856
client=client,
4957
common=common,
@@ -62,6 +70,14 @@ async def asyncio_detailed(
6270
client: Client,
6371
common: Union[Unset, None, str] = UNSET,
6472
) -> Response[Any]:
73+
"""
74+
Args:
75+
common (Union[Unset, None, str]):
76+
77+
Returns:
78+
Response[Any]
79+
"""
80+
6581
kwargs = _get_kwargs(
6682
client=client,
6783
common=common,

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py

+22
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ def sync_detailed(
6868
null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
6969
not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
7070
) -> Response[Any]:
71+
"""
72+
Args:
73+
not_null_required (datetime.datetime):
74+
null_required (Union[Unset, None, datetime.datetime]):
75+
null_not_required (Union[Unset, None, datetime.datetime]):
76+
not_null_not_required (Union[Unset, None, datetime.datetime]):
77+
78+
Returns:
79+
Response[Any]
80+
"""
81+
7182
kwargs = _get_kwargs(
7283
client=client,
7384
not_null_required=not_null_required,
@@ -92,6 +103,17 @@ async def asyncio_detailed(
92103
null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
93104
not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET,
94105
) -> Response[Any]:
106+
"""
107+
Args:
108+
not_null_required (datetime.datetime):
109+
null_required (Union[Unset, None, datetime.datetime]):
110+
null_not_required (Union[Unset, None, datetime.datetime]):
111+
not_null_not_required (Union[Unset, None, datetime.datetime]):
112+
113+
Returns:
114+
Response[Any]
115+
"""
116+
95117
kwargs = _get_kwargs(
96118
client=client,
97119
not_null_required=not_null_required,

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py

+18
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ def sync_detailed(
4646
client: Client,
4747
param_query: Union[Unset, None, str] = UNSET,
4848
) -> Response[Any]:
49+
"""
50+
Args:
51+
param_path (str):
52+
param_query (Union[Unset, None, str]):
53+
54+
Returns:
55+
Response[Any]
56+
"""
57+
4958
kwargs = _get_kwargs(
5059
param_path=param_path,
5160
client=client,
@@ -66,6 +75,15 @@ async def asyncio_detailed(
6675
client: Client,
6776
param_query: Union[Unset, None, str] = UNSET,
6877
) -> Response[Any]:
78+
"""
79+
Args:
80+
param_path (str):
81+
param_query (Union[Unset, None, str]):
82+
83+
Returns:
84+
Response[Any]
85+
"""
86+
6987
kwargs = _get_kwargs(
7088
param_path=param_path,
7189
client=client,

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py

+25-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def _get_kwargs(
1010
param_path: str,
1111
*,
1212
client: Client,
13-
param_query: str = "overriden_in_GET",
13+
param_query: str = "overridden_in_GET",
1414
) -> Dict[str, Any]:
1515
url = "{}/common_parameters_overriding/{param}".format(client.base_url, param=param_path)
1616

@@ -44,8 +44,19 @@ def sync_detailed(
4444
param_path: str,
4545
*,
4646
client: Client,
47-
param_query: str = "overriden_in_GET",
47+
param_query: str = "overridden_in_GET",
4848
) -> Response[Any]:
49+
"""Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code
50+
51+
Args:
52+
param_path (str):
53+
param_query (str): A parameter with the same name as another. Default:
54+
'overridden_in_GET'. Example: an example string.
55+
56+
Returns:
57+
Response[Any]
58+
"""
59+
4960
kwargs = _get_kwargs(
5061
param_path=param_path,
5162
client=client,
@@ -64,8 +75,19 @@ async def asyncio_detailed(
6475
param_path: str,
6576
*,
6677
client: Client,
67-
param_query: str = "overriden_in_GET",
78+
param_query: str = "overridden_in_GET",
6879
) -> Response[Any]:
80+
"""Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code
81+
82+
Args:
83+
param_path (str):
84+
param_query (str): A parameter with the same name as another. Default:
85+
'overridden_in_GET'. Example: an example string.
86+
87+
Returns:
88+
Response[Any]
89+
"""
90+
6991
kwargs = _get_kwargs(
7092
param_path=param_path,
7193
client=client,

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py

+22
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ def sync_detailed(
5656
param_header: Union[Unset, str] = UNSET,
5757
param_cookie: Union[Unset, str] = UNSET,
5858
) -> Response[Any]:
59+
"""
60+
Args:
61+
param_path (str):
62+
param_query (Union[Unset, None, str]):
63+
param_header (Union[Unset, str]):
64+
param_cookie (Union[Unset, str]):
65+
66+
Returns:
67+
Response[Any]
68+
"""
69+
5970
kwargs = _get_kwargs(
6071
param_path=param_path,
6172
client=client,
@@ -80,6 +91,17 @@ async def asyncio_detailed(
8091
param_header: Union[Unset, str] = UNSET,
8192
param_cookie: Union[Unset, str] = UNSET,
8293
) -> Response[Any]:
94+
"""
95+
Args:
96+
param_path (str):
97+
param_query (Union[Unset, None, str]):
98+
param_header (Union[Unset, str]):
99+
param_cookie (Union[Unset, str]):
100+
101+
Returns:
102+
Response[Any]
103+
"""
104+
83105
kwargs = _get_kwargs(
84106
param_path=param_path,
85107
client=client,

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py

+22
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ def sync_detailed(
4646
*,
4747
client: Client,
4848
) -> Response[Any]:
49+
"""
50+
Args:
51+
param4 (str):
52+
param2 (int):
53+
param1 (str):
54+
param3 (int):
55+
56+
Returns:
57+
Response[Any]
58+
"""
59+
4960
kwargs = _get_kwargs(
5061
param4=param4,
5162
param2=param2,
@@ -70,6 +81,17 @@ async def asyncio_detailed(
7081
*,
7182
client: Client,
7283
) -> Response[Any]:
84+
"""
85+
Args:
86+
param4 (str):
87+
param2 (int):
88+
param1 (str):
89+
param3 (int):
90+
91+
Returns:
92+
Response[Any]
93+
"""
94+
7395
kwargs = _get_kwargs(
7496
param4=param4,
7597
param2=param2,

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py

+10
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ def sync_detailed(
3636
*,
3737
client: Client,
3838
) -> Response[Any]:
39+
"""
40+
Returns:
41+
Response[Any]
42+
"""
43+
3944
kwargs = _get_kwargs(
4045
client=client,
4146
)
@@ -52,6 +57,11 @@ async def asyncio_detailed(
5257
*,
5358
client: Client,
5459
) -> Response[Any]:
60+
"""
61+
Returns:
62+
Response[Any]
63+
"""
64+
5565
kwargs = _get_kwargs(
5666
client=client,
5767
)

Diff for: end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py

+74-2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,25 @@ def sync_detailed(
119119
model_prop: ModelWithUnionProperty,
120120
required_model_prop: ModelWithUnionProperty,
121121
) -> Response[Union[Any, HTTPValidationError]]:
122+
"""Defaults
123+
124+
Args:
125+
string_prop (str): Default: 'the default string'.
126+
date_prop (datetime.date): Default: isoparse('1010-10-10').date().
127+
float_prop (float): Default: 3.14.
128+
int_prop (int): Default: 7.
129+
boolean_prop (bool):
130+
list_prop (List[AnEnum]):
131+
union_prop (Union[float, str]): Default: 'not a float'.
132+
union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6.
133+
enum_prop (AnEnum): For testing Enums in all the ways they can be used
134+
model_prop (ModelWithUnionProperty):
135+
required_model_prop (ModelWithUnionProperty):
136+
137+
Returns:
138+
Response[Union[Any, HTTPValidationError]]
139+
"""
140+
122141
kwargs = _get_kwargs(
123142
client=client,
124143
string_prop=string_prop,
@@ -157,7 +176,24 @@ def sync(
157176
model_prop: ModelWithUnionProperty,
158177
required_model_prop: ModelWithUnionProperty,
159178
) -> Optional[Union[Any, HTTPValidationError]]:
160-
""" """
179+
"""Defaults
180+
181+
Args:
182+
string_prop (str): Default: 'the default string'.
183+
date_prop (datetime.date): Default: isoparse('1010-10-10').date().
184+
float_prop (float): Default: 3.14.
185+
int_prop (int): Default: 7.
186+
boolean_prop (bool):
187+
list_prop (List[AnEnum]):
188+
union_prop (Union[float, str]): Default: 'not a float'.
189+
union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6.
190+
enum_prop (AnEnum): For testing Enums in all the ways they can be used
191+
model_prop (ModelWithUnionProperty):
192+
required_model_prop (ModelWithUnionProperty):
193+
194+
Returns:
195+
Response[Union[Any, HTTPValidationError]]
196+
"""
161197

162198
return sync_detailed(
163199
client=client,
@@ -190,6 +226,25 @@ async def asyncio_detailed(
190226
model_prop: ModelWithUnionProperty,
191227
required_model_prop: ModelWithUnionProperty,
192228
) -> Response[Union[Any, HTTPValidationError]]:
229+
"""Defaults
230+
231+
Args:
232+
string_prop (str): Default: 'the default string'.
233+
date_prop (datetime.date): Default: isoparse('1010-10-10').date().
234+
float_prop (float): Default: 3.14.
235+
int_prop (int): Default: 7.
236+
boolean_prop (bool):
237+
list_prop (List[AnEnum]):
238+
union_prop (Union[float, str]): Default: 'not a float'.
239+
union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6.
240+
enum_prop (AnEnum): For testing Enums in all the ways they can be used
241+
model_prop (ModelWithUnionProperty):
242+
required_model_prop (ModelWithUnionProperty):
243+
244+
Returns:
245+
Response[Union[Any, HTTPValidationError]]
246+
"""
247+
193248
kwargs = _get_kwargs(
194249
client=client,
195250
string_prop=string_prop,
@@ -226,7 +281,24 @@ async def asyncio(
226281
model_prop: ModelWithUnionProperty,
227282
required_model_prop: ModelWithUnionProperty,
228283
) -> Optional[Union[Any, HTTPValidationError]]:
229-
""" """
284+
"""Defaults
285+
286+
Args:
287+
string_prop (str): Default: 'the default string'.
288+
date_prop (datetime.date): Default: isoparse('1010-10-10').date().
289+
float_prop (float): Default: 3.14.
290+
int_prop (int): Default: 7.
291+
boolean_prop (bool):
292+
list_prop (List[AnEnum]):
293+
union_prop (Union[float, str]): Default: 'not a float'.
294+
union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6.
295+
enum_prop (AnEnum): For testing Enums in all the ways they can be used
296+
model_prop (ModelWithUnionProperty):
297+
required_model_prop (ModelWithUnionProperty):
298+
299+
Returns:
300+
Response[Union[Any, HTTPValidationError]]
301+
"""
230302

231303
return (
232304
await asyncio_detailed(

0 commit comments

Comments
 (0)