Skip to content

Commit 30edc56

Browse files
dtkavdbanty
authored andcommitted
Remove trailing comma in endpoint_macros.pyi (#178)
* Fixes #179
1 parent 849be6e commit 30edc56

File tree

4 files changed

+14
-29
lines changed

4 files changed

+14
-29
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8+
## 0.5.5 - Unreleased
9+
### Fixes
10+
- Improved trailing comma handling in endpoint generation (#178 & #179). Thanks @dtkav!
11+
12+
813
## 0.5.4 - 2020-08-29
914
### Additions
1015
- Support for octet-stream content type (#116)

end_to_end_tests/golden-master/my_test_api_client/api/tests.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
def get_user_list(
1616
*, client: Client, an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime],
17-
) -> Union[
18-
List[AModel], HTTPValidationError,
19-
]:
17+
) -> Union[List[AModel], HTTPValidationError]:
2018

2119
""" Get a list of things """
2220
url = "{}/tests/".format(client.base_url)
@@ -112,9 +110,7 @@ def get_basic_list_of_booleans(*, client: Client,) -> List[bool]:
112110

113111
def upload_file_tests_upload_post(
114112
*, client: Client, multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Optional[bool] = None,
115-
) -> Union[
116-
None, HTTPValidationError,
117-
]:
113+
) -> Union[None, HTTPValidationError]:
118114

119115
""" Upload a file """
120116
url = "{}/tests/upload".format(client.base_url)
@@ -133,11 +129,7 @@ def upload_file_tests_upload_post(
133129
raise ApiResponseError(response=response)
134130

135131

136-
def json_body_tests_json_body_post(
137-
*, client: Client, json_body: AModel,
138-
) -> Union[
139-
None, HTTPValidationError,
140-
]:
132+
def json_body_tests_json_body_post(*, client: Client, json_body: AModel,) -> Union[None, HTTPValidationError]:
141133

142134
""" Try sending a JSON body """
143135
url = "{}/tests/json_body".format(client.base_url)
@@ -171,9 +163,7 @@ def test_defaults_tests_test_defaults_post(
171163
),
172164
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
173165
enum_prop: Optional[AnEnum] = None,
174-
) -> Union[
175-
None, HTTPValidationError,
176-
]:
166+
) -> Union[None, HTTPValidationError]:
177167

178168
""" """
179169
url = "{}/tests/test_defaults".format(client.base_url)

end_to_end_tests/golden-master/my_test_api_client/async_api/tests.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
async def get_user_list(
1616
*, client: Client, an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime],
17-
) -> Union[
18-
List[AModel], HTTPValidationError,
19-
]:
17+
) -> Union[List[AModel], HTTPValidationError]:
2018

2119
""" Get a list of things """
2220
url = "{}/tests/".format(client.base_url,)
@@ -117,9 +115,7 @@ async def get_basic_list_of_booleans(*, client: Client,) -> List[bool]:
117115

118116
async def upload_file_tests_upload_post(
119117
*, client: Client, multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Optional[bool] = None,
120-
) -> Union[
121-
None, HTTPValidationError,
122-
]:
118+
) -> Union[None, HTTPValidationError]:
123119

124120
""" Upload a file """
125121
url = "{}/tests/upload".format(client.base_url,)
@@ -139,11 +135,7 @@ async def upload_file_tests_upload_post(
139135
raise ApiResponseError(response=response)
140136

141137

142-
async def json_body_tests_json_body_post(
143-
*, client: Client, json_body: AModel,
144-
) -> Union[
145-
None, HTTPValidationError,
146-
]:
138+
async def json_body_tests_json_body_post(*, client: Client, json_body: AModel,) -> Union[None, HTTPValidationError]:
147139

148140
""" Try sending a JSON body """
149141
url = "{}/tests/json_body".format(client.base_url,)
@@ -178,9 +170,7 @@ async def test_defaults_tests_test_defaults_post(
178170
),
179171
union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float",
180172
enum_prop: Optional[AnEnum] = None,
181-
) -> Union[
182-
None, HTTPValidationError,
183-
]:
173+
) -> Union[None, HTTPValidationError]:
184174

185175
""" """
186176
url = "{}/tests/test_defaults".format(client.base_url,)

openapi_python_client/templates/endpoint_macros.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if {{ property.python_name }} is not None:
6161
{% else %}
6262
) -> Union[
6363
{% for response in endpoint.responses %}
64-
{{ response.return_string() }},
64+
{{ response.return_string() }}{{ "," if not loop.last }}
6565
{% endfor %}
6666
]:
6767
{% endif %}

0 commit comments

Comments
 (0)