From 1aa4d5d8cf04c47528e5851e8385f164cf8d8d4f Mon Sep 17 00:00:00 2001 From: Daniel Grossmann-Kavanagh Date: Thu, 3 Sep 2020 01:01:08 -0700 Subject: [PATCH 1/2] Remove bad comma in endpoint_macros.pyi --- openapi_python_client/templates/endpoint_macros.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi_python_client/templates/endpoint_macros.pyi b/openapi_python_client/templates/endpoint_macros.pyi index 50529a197..6eecab45e 100644 --- a/openapi_python_client/templates/endpoint_macros.pyi +++ b/openapi_python_client/templates/endpoint_macros.pyi @@ -61,7 +61,7 @@ if {{ property.python_name }} is not None: {% else %} ) -> Union[ {% for response in endpoint.responses %} - {{ response.return_string() }}, + {{ response.return_string() }}{{ "," if not loop.last }} {% endfor %} ]: {% endif %} From a2337e8038caffba040a36829b0707e7f0fceb06 Mon Sep 17 00:00:00 2001 From: Daniel Grossmann-Kavanagh Date: Thu, 3 Sep 2020 01:22:02 -0700 Subject: [PATCH 2/2] Update golden-master to match expected output --- .../my_test_api_client/api/tests.py | 18 ++++-------------- .../my_test_api_client/async_api/tests.py | 18 ++++-------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/end_to_end_tests/golden-master/my_test_api_client/api/tests.py b/end_to_end_tests/golden-master/my_test_api_client/api/tests.py index 91ece074e..9ab80d6e2 100644 --- a/end_to_end_tests/golden-master/my_test_api_client/api/tests.py +++ b/end_to_end_tests/golden-master/my_test_api_client/api/tests.py @@ -14,9 +14,7 @@ def get_user_list( *, client: Client, an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime], -) -> Union[ - List[AModel], HTTPValidationError, -]: +) -> Union[List[AModel], HTTPValidationError]: """ Get a list of things """ url = "{}/tests/".format(client.base_url) @@ -112,9 +110,7 @@ def get_basic_list_of_booleans(*, client: Client,) -> List[bool]: def upload_file_tests_upload_post( *, client: Client, multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Optional[bool] = None, -) -> Union[ - None, HTTPValidationError, -]: +) -> Union[None, HTTPValidationError]: """ Upload a file """ url = "{}/tests/upload".format(client.base_url) @@ -133,11 +129,7 @@ def upload_file_tests_upload_post( raise ApiResponseError(response=response) -def json_body_tests_json_body_post( - *, client: Client, json_body: AModel, -) -> Union[ - None, HTTPValidationError, -]: +def json_body_tests_json_body_post(*, client: Client, json_body: AModel,) -> Union[None, HTTPValidationError]: """ Try sending a JSON body """ url = "{}/tests/json_body".format(client.base_url) @@ -171,9 +163,7 @@ def test_defaults_tests_test_defaults_post( ), union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float", enum_prop: Optional[AnEnum] = None, -) -> Union[ - None, HTTPValidationError, -]: +) -> Union[None, HTTPValidationError]: """ """ url = "{}/tests/test_defaults".format(client.base_url) diff --git a/end_to_end_tests/golden-master/my_test_api_client/async_api/tests.py b/end_to_end_tests/golden-master/my_test_api_client/async_api/tests.py index 3ea1ebc7c..5e3db0f46 100644 --- a/end_to_end_tests/golden-master/my_test_api_client/async_api/tests.py +++ b/end_to_end_tests/golden-master/my_test_api_client/async_api/tests.py @@ -14,9 +14,7 @@ async def get_user_list( *, client: Client, an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime], -) -> Union[ - List[AModel], HTTPValidationError, -]: +) -> Union[List[AModel], HTTPValidationError]: """ Get a list of things """ url = "{}/tests/".format(client.base_url,) @@ -117,9 +115,7 @@ async def get_basic_list_of_booleans(*, client: Client,) -> List[bool]: async def upload_file_tests_upload_post( *, client: Client, multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Optional[bool] = None, -) -> Union[ - None, HTTPValidationError, -]: +) -> Union[None, HTTPValidationError]: """ Upload a file """ url = "{}/tests/upload".format(client.base_url,) @@ -139,11 +135,7 @@ async def upload_file_tests_upload_post( raise ApiResponseError(response=response) -async def json_body_tests_json_body_post( - *, client: Client, json_body: AModel, -) -> Union[ - None, HTTPValidationError, -]: +async def json_body_tests_json_body_post(*, client: Client, json_body: AModel,) -> Union[None, HTTPValidationError]: """ Try sending a JSON body """ url = "{}/tests/json_body".format(client.base_url,) @@ -178,9 +170,7 @@ async def test_defaults_tests_test_defaults_post( ), union_prop: Optional[Union[Optional[float], Optional[str]]] = "not a float", enum_prop: Optional[AnEnum] = None, -) -> Union[ - None, HTTPValidationError, -]: +) -> Union[None, HTTPValidationError]: """ """ url = "{}/tests/test_defaults".format(client.base_url,)