From 663b6c50ebd54300e6cdc1d5a7dbd99ff2e39abf Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 05:32:35 -0700 Subject: [PATCH 01/18] initial attempt to improve docstrings --- .../parser/properties/__init__.py | 20 +++++ .../parser/properties/model_property.py | 1 + .../parser/properties/property.py | 10 +++ openapi_python_client/parser/responses.py | 2 + .../templates/endpoint_module.py.jinja | 90 ++++++++++++++++++- .../templates/model.py.jinja | 11 ++- tests/test_parser/test_responses.py | 6 +- 7 files changed, 133 insertions(+), 7 deletions(-) diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index ac9c0f4d5..4ba48bfaf 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -263,6 +263,8 @@ def _string_based_property( default=convert("datetime.datetime", data.default), nullable=data.nullable, python_name=python_name, + description=data.description, + example=data.example, ) if string_format == "date": return DateProperty( @@ -271,6 +273,8 @@ def _string_based_property( default=convert("datetime.date", data.default), nullable=data.nullable, python_name=python_name, + description=data.description, + example=data.example, ) if string_format == "binary": return FileProperty( @@ -279,6 +283,8 @@ def _string_based_property( default=None, nullable=data.nullable, python_name=python_name, + description=data.description, + example=data.example, ) return StringProperty( name=name, @@ -287,6 +293,8 @@ def _string_based_property( pattern=data.pattern, nullable=data.nullable, python_name=python_name, + description=data.description, + example=data.example, ) @@ -424,6 +432,8 @@ def build_union_property( inner_properties=sub_properties, nullable=data.nullable, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=data.description, + example=data.example, ), schemas, ) @@ -462,6 +472,8 @@ def build_list_property( inner_property=inner_prop, nullable=data.nullable, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=data.description, + example=data.example, ), schemas, ) @@ -545,6 +557,8 @@ def _property_from_data( required=required, nullable=data.nullable, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=data.description, + example=data.example, ), schemas, ) @@ -556,6 +570,8 @@ def _property_from_data( required=required, nullable=data.nullable, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=data.description, + example=data.example, ), schemas, ) @@ -567,6 +583,8 @@ def _property_from_data( default=convert("bool", data.default), nullable=data.nullable, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=data.description, + example=data.example, ), schemas, ) @@ -585,6 +603,8 @@ def _property_from_data( nullable=False, default=None, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=data.description, + example=data.example, ), schemas, ) diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py index 0cfb7a902..cfaea08b0 100644 --- a/openapi_python_client/parser/properties/model_property.py +++ b/openapi_python_client/parser/properties/model_property.py @@ -256,6 +256,7 @@ def build_model_property( name=name, additional_properties=additional_properties, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + example=data.example, ) if class_info.name in schemas.classes_by_name: error = PropertyError(data=data, detail=f'Attempted to generate duplicate models with name "{class_info.name}"') diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py index af1135bf6..12dedba79 100644 --- a/openapi_python_client/parser/properties/property.py +++ b/openapi_python_client/parser/properties/property.py @@ -30,6 +30,8 @@ class Property: _json_type_string: ClassVar[str] = "" # Type of the property after JSON serialization default: Optional[str] = attr.ib() python_name: PythonIdentifier + description: Optional[str] = attr.ib() + example: Optional[str] = attr.ib() template: ClassVar[Optional[str]] = None json_is_dict: ClassVar[bool] = False @@ -107,3 +109,11 @@ def to_string(self) -> str: if default is not None: return f"{self.python_name}: {self.get_type_string()} = {default}" return f"{self.python_name}: {self.get_type_string()}" + + def to_docstring(self): + doc = f"{self.python_name} ({self.get_type_string()}): {self.description}" + if self.default: + doc += f"|default: {self.default}" + if self.example: + doc += f"|ex: {self.example}" + return doc \ No newline at end of file diff --git a/openapi_python_client/parser/responses.py b/openapi_python_client/parser/responses.py index 98300640d..cdda1e4a1 100644 --- a/openapi_python_client/parser/responses.py +++ b/openapi_python_client/parser/responses.py @@ -38,6 +38,8 @@ def empty_response(*, status_code: int, response_name: str, config: Config) -> R nullable=False, required=True, python_name=PythonIdentifier(value=response_name, prefix=config.field_prefix), + description='', + example='', ), source="None", ) diff --git a/openapi_python_client/templates/endpoint_module.py.jinja b/openapi_python_client/templates/endpoint_module.py.jinja index 3339aa003..1a28abdea 100644 --- a/openapi_python_client/templates/endpoint_module.py.jinja +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -88,6 +88,27 @@ def _build_response(*, response: httpx.Response) -> Response[{{ return_string }} def sync_detailed( {{ arguments(endpoint) | indent(4) }} ) -> Response[{{ return_string }}]: + """ + {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + {% else %} + {{ endpoint.title | wordwrap(76)}} + {% endif %} + {{ endpoint.description | wordwrap(76)}} + {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} + Args: + {% for parameter in endpoint.query_parameters.values() %} + {{ parameter.to_docstring() }}: + {% endfor %} + {% for parameter in endpoint.header_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% for parameter in endpoint.cookie_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% endif %} + Returns: + Response[{{ return_string }}] + """ kwargs = _get_kwargs( {{ kwargs(endpoint) }} ) @@ -102,8 +123,27 @@ def sync_detailed( def sync( {{ arguments(endpoint) | indent(4) }} ) -> Optional[{{ return_string }}]: - """ {{ endpoint.description }} """ - + """ + {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + {% else %} + {{ endpoint.title | wordwrap(76)}} + {% endif %} + {{ endpoint.description | wordwrap(76)}} + {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} + Args: + {% for parameter in endpoint.query_parameters.values() %} + {{ parameter.to_docstring() }}: + {% endfor %} + {% for parameter in endpoint.header_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% for parameter in endpoint.cookie_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% endif %} + Returns: + Optional[{{ return_string }}] + """ return sync_detailed( {{ kwargs(endpoint) }} ).parsed @@ -112,6 +152,28 @@ def sync( async def asyncio_detailed( {{ arguments(endpoint) | indent(4) }} ) -> Response[{{ return_string }}]: + """ + {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + {% else %} + {{ endpoint.title | wordwrap(76)}} + {% endif %} + {{ endpoint.description | wordwrap(76)}} + {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} + Args: + {% for parameter in endpoint.query_parameters.values() %} + {{ parameter.to_docstring() }}: + {% endfor %} + {% for parameter in endpoint.header_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% for parameter in endpoint.cookie_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% endif %} + + Returns: + Response[{{ return_string }}] + """ kwargs = _get_kwargs( {{ kwargs(endpoint) }} ) @@ -127,9 +189,29 @@ async def asyncio_detailed( async def asyncio( {{ arguments(endpoint) | indent(4) }} ) -> Optional[{{ return_string }}]: - """ {{ endpoint.description }} """ - + """ + {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + {% else %} + {{ endpoint.title | wordwrap(76)}} + {% endif %} + {{ endpoint.description | wordwrap(76)}} + {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} + Args: + {% for parameter in endpoint.query_parameters.values() %} + {{ parameter.to_docstring() }}: + {% endfor %} + {% for parameter in endpoint.header_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% for parameter in endpoint.cookie_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% endif %} + Returns: + Optional[{{ return_string }}] + """ return (await asyncio_detailed( {{ kwargs(endpoint) }} )).parsed {% endif %} + diff --git a/openapi_python_client/templates/model.py.jinja b/openapi_python_client/templates/model.py.jinja index c4c23c878..bfd631491 100644 --- a/openapi_python_client/templates/model.py.jinja +++ b/openapi_python_client/templates/model.py.jinja @@ -28,7 +28,16 @@ T = TypeVar("T", bound="{{ class_name }}") @attr.s(auto_attribs=True) class {{ class_name }}: - """ {{ model.description }} """ + """ + {% if model.title %}{{ model.title | wordwrap(76) }}{% endif %} + {% if model.description %}{{ model.description | wordwrap(76) }}{% endif %} + {% if model.example %}Example:{{ model.example | string | wordwrap(76) }}{% endif %} + + Properties: + {% for property in model.required_properties + model.optional_properties %} + {{ property.to_docstring() | wordwrap(72) }} + {% endfor %} + """ {% for property in model.required_properties + model.optional_properties %} {% if property.default is none and property.required %} {{ property.to_string() }} diff --git a/tests/test_parser/test_responses.py b/tests/test_parser/test_responses.py index 8c35cea1f..f6ed6bc7d 100644 --- a/tests/test_parser/test_responses.py +++ b/tests/test_parser/test_responses.py @@ -20,7 +20,8 @@ def test_response_from_data_no_content(): assert response == Response( status_code=200, - prop=AnyProperty(name="response_200", default=None, nullable=False, required=True, python_name="response_200"), + prop=AnyProperty(name="response_200", default=None, nullable=False, required=True, python_name="response_200", + description='', example=''), source="None", ) @@ -46,7 +47,8 @@ def test_response_from_data_no_content_schema(): assert response == Response( status_code=200, - prop=AnyProperty(name="response_200", default=None, nullable=False, required=True, python_name="response_200"), + prop=AnyProperty(name="response_200", default=None, nullable=False, required=True, python_name="response_200", + description=data.description, example=data.example), source="None", ) From 18486d0f0bfd180e1b9bfaa40449267a58e6368d Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 05:33:45 -0700 Subject: [PATCH 02/18] add some whitespace --- openapi_python_client/templates/model.py.jinja | 1 + 1 file changed, 1 insertion(+) diff --git a/openapi_python_client/templates/model.py.jinja b/openapi_python_client/templates/model.py.jinja index bfd631491..cef54bd4f 100644 --- a/openapi_python_client/templates/model.py.jinja +++ b/openapi_python_client/templates/model.py.jinja @@ -31,6 +31,7 @@ class {{ class_name }}: """ {% if model.title %}{{ model.title | wordwrap(76) }}{% endif %} {% if model.description %}{{ model.description | wordwrap(76) }}{% endif %} + {% if model.example %}Example:{{ model.example | string | wordwrap(76) }}{% endif %} Properties: From 3ea51a082b1a90735e4dd158bfb26e5c91d2500b Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 05:52:31 -0700 Subject: [PATCH 03/18] pass new arguments to property --- openapi_python_client/parser/properties/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index 4ba48bfaf..d3557e24f 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -355,6 +355,8 @@ def build_enum_property( value_type=value_type, default=None, python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=data.description, + example=data.example, ) default = get_enum_default(prop, data) From 22ff9efc4750c0f260d5e6b03fef20aae6f56efb Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 05:56:52 -0700 Subject: [PATCH 04/18] fix template --- .../templates/endpoint_module.py.jinja | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/openapi_python_client/templates/endpoint_module.py.jinja b/openapi_python_client/templates/endpoint_module.py.jinja index 1a28abdea..32383db39 100644 --- a/openapi_python_client/templates/endpoint_module.py.jinja +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -90,10 +90,11 @@ def sync_detailed( ) -> Response[{{ return_string }}]: """ {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + + {{ endpoint.description | wordwrap(76)}} {% else %} - {{ endpoint.title | wordwrap(76)}} - {% endif %} {{ endpoint.description | wordwrap(76)}} + {% endif %} {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} Args: {% for parameter in endpoint.query_parameters.values() %} @@ -125,10 +126,12 @@ def sync( ) -> Optional[{{ return_string }}]: """ {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + + {{ endpoint.description | wordwrap(76)}} {% else %} - {{ endpoint.title | wordwrap(76)}} - {% endif %} {{ endpoint.description | wordwrap(76)}} + {% endif %} + {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} Args: {% for parameter in endpoint.query_parameters.values() %} @@ -154,10 +157,12 @@ async def asyncio_detailed( ) -> Response[{{ return_string }}]: """ {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + + {{ endpoint.description | wordwrap(76)}} {% else %} - {{ endpoint.title | wordwrap(76)}} + {{ endpoint.description | wordwrap(76)}} {% endif %} - {{ endpoint.description | wordwrap(76)}} + {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} Args: {% for parameter in endpoint.query_parameters.values() %} @@ -191,10 +196,12 @@ async def asyncio( ) -> Optional[{{ return_string }}]: """ {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + + {{ endpoint.description | wordwrap(76)}} {% else %} - {{ endpoint.title | wordwrap(76)}} + {{ endpoint.description | wordwrap(76)}} {% endif %} - {{ endpoint.description | wordwrap(76)}} + {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} Args: {% for parameter in endpoint.query_parameters.values() %} From 76bc9a9fd006170b797cb97f8bbb500377b65b0a Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 06:04:28 -0700 Subject: [PATCH 05/18] regen tests --- .../api/default/get_common_parameters.py | 16 ++++ .../api/default/post_common_parameters.py | 16 ++++ .../get_location_query_optionality.py | 22 +++++ ...lete_common_parameters_overriding_param.py | 16 ++++ .../get_common_parameters_overriding_param.py | 16 ++++ .../get_same_name_multiple_locations_param.py | 20 +++++ .../parameters/multiple_path_parameters.py | 12 +++ .../api/tag1/get_tag_with_number.py | 12 +++ .../api/tests/defaults_tests_defaults_post.py | 85 ++++++++++++++++++- .../api/tests/get_basic_list_of_booleans.py | 32 ++++++- .../api/tests/get_basic_list_of_floats.py | 32 ++++++- .../api/tests/get_basic_list_of_integers.py | 32 ++++++- .../api/tests/get_basic_list_of_strings.py | 32 ++++++- .../api/tests/get_user_list.py | 45 +++++++++- .../api/tests/int_enum_tests_int_enum_post.py | 41 ++++++++- .../tests/json_body_tests_json_body_post.py | 32 ++++++- .../no_response_tests_no_response_get.py | 16 ++++ .../octet_stream_tests_octet_stream_get.py | 32 ++++++- .../api/tests/post_form_data.py | 16 ++++ .../api/tests/test_inline_objects.py | 32 ++++++- ..._with_cookie_auth_token_with_cookie_get.py | 20 +++++ ...d_content_tests_unsupported_content_get.py | 16 ++++ .../tests/upload_file_tests_upload_post.py | 41 ++++++++- ...upload_multiple_files_tests_upload_post.py | 41 ++++++++- .../my_test_api_client/api/true_/false_.py | 16 ++++ .../my_test_api_client/models/a_form_data.py | 9 +- .../my_test_api_client/models/a_model.py | 35 +++++++- ...roperties_reference_that_are_not_object.py | 38 ++++++++- .../models/all_of_sub_model.py | 10 ++- .../models/another_all_of_sub_model.py | 10 ++- .../body_upload_file_tests_upload_post.py | 18 +++- ...e_tests_upload_post_additional_property.py | 8 +- ..._tests_upload_post_some_nullable_object.py | 8 +- ...load_file_tests_upload_post_some_object.py | 9 +- ..._tests_upload_post_some_optional_object.py | 8 +- .../models/free_form_model.py | 7 +- .../models/http_validation_error.py | 8 +- .../my_test_api_client/models/import_.py | 7 +- .../models/model_from_all_of.py | 11 ++- .../my_test_api_client/models/model_name.py | 7 +- ...odel_with_additional_properties_inlined.py | 8 +- ..._properties_inlined_additional_property.py | 8 +- .../model_with_additional_properties_refed.py | 7 +- .../models/model_with_any_json_properties.py | 7 +- ...n_properties_additional_property_type_0.py | 7 +- ...el_with_primitive_additional_properties.py | 9 +- ...ive_additional_properties_a_date_holder.py | 7 +- .../models/model_with_property_ref.py | 8 +- .../models/model_with_union_property.py | 8 +- .../model_with_union_property_inlined.py | 9 +- ...ith_union_property_inlined_fruit_type_0.py | 8 +- ...ith_union_property_inlined_fruit_type_1.py | 8 +- .../my_test_api_client/models/none.py | 7 +- .../models/test_inline_objects_json_body.py | 8 +- .../test_inline_objects_response_200.py | 8 +- .../models/validation_error.py | 10 ++- 56 files changed, 954 insertions(+), 57 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py index 8752954c9..411dbe24e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py @@ -45,6 +45,13 @@ def sync_detailed( client: Client, common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: + """ + + Args: + common (Union[Unset, None, str]): None: + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, common=common, @@ -62,6 +69,15 @@ async def asyncio_detailed( client: Client, common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: + """ + + + Args: + common (Union[Unset, None, str]): None: + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, common=common, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py index b64273249..5efa5b0ac 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py @@ -45,6 +45,13 @@ def sync_detailed( client: Client, common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: + """ + + Args: + common (Union[Unset, None, str]): None: + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, common=common, @@ -62,6 +69,15 @@ async def asyncio_detailed( client: Client, common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: + """ + + + Args: + common (Union[Unset, None, str]): None: + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, common=common, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py index 9503c2813..af2387375 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py @@ -69,6 +69,16 @@ def sync_detailed( null_not_required: Union[Unset, None, datetime.datetime] = UNSET, not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET, ) -> Response[Any]: + """ + + Args: + not_null_required (datetime.datetime): None: + null_required (Union[Unset, None, datetime.datetime]): None: + null_not_required (Union[Unset, None, datetime.datetime]): None: + not_null_not_required (Union[Unset, None, datetime.datetime]): None: + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, not_null_required=not_null_required, @@ -92,6 +102,18 @@ async def asyncio_detailed( null_not_required: Union[Unset, None, datetime.datetime] = UNSET, not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET, ) -> Response[Any]: + """ + + + Args: + not_null_required (datetime.datetime): None: + null_required (Union[Unset, None, datetime.datetime]): None: + null_not_required (Union[Unset, None, datetime.datetime]): None: + not_null_not_required (Union[Unset, None, datetime.datetime]): None: + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, not_null_required=not_null_required, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index 724459e60..06958ee8f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -47,6 +47,13 @@ def sync_detailed( client: Client, param_query: Union[Unset, None, str] = UNSET, ) -> Response[Any]: + """ + + Args: + param_query (Union[Unset, None, str]): None: + Returns: + Response[Any] + """ kwargs = _get_kwargs( param_path=param_path, client=client, @@ -66,6 +73,15 @@ async def asyncio_detailed( client: Client, param_query: Union[Unset, None, str] = UNSET, ) -> Response[Any]: + """ + + + Args: + param_query (Union[Unset, None, str]): None: + + Returns: + Response[Any] + """ kwargs = _get_kwargs( param_path=param_path, client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index 127a802ba..84b0f3bcd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -47,6 +47,13 @@ def sync_detailed( client: Client, param_query: str = "overriden_in_GET", ) -> Response[Any]: + """ + + Args: + param_query (str): None|default: 'overriden_in_GET': + Returns: + Response[Any] + """ kwargs = _get_kwargs( param_path=param_path, client=client, @@ -66,6 +73,15 @@ async def asyncio_detailed( client: Client, param_query: str = "overriden_in_GET", ) -> Response[Any]: + """ + + + Args: + param_query (str): None|default: 'overriden_in_GET': + + Returns: + Response[Any] + """ kwargs = _get_kwargs( param_path=param_path, client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index 6008f66bd..42138a255 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -57,6 +57,15 @@ def sync_detailed( param_header: Union[Unset, str] = UNSET, param_cookie: Union[Unset, str] = UNSET, ) -> Response[Any]: + """ + + Args: + param_query (Union[Unset, None, str]): None: + param_header (Union[Unset, str]): None, + param_cookie (Union[Unset, str]): None, + Returns: + Response[Any] + """ kwargs = _get_kwargs( param_path=param_path, client=client, @@ -80,6 +89,17 @@ async def asyncio_detailed( param_header: Union[Unset, str] = UNSET, param_cookie: Union[Unset, str] = UNSET, ) -> Response[Any]: + """ + + + Args: + param_query (Union[Unset, None, str]): None: + param_header (Union[Unset, str]): None, + param_cookie (Union[Unset, str]): None, + + Returns: + Response[Any] + """ kwargs = _get_kwargs( param_path=param_path, client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py index ef0656b26..b46f17466 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -47,6 +47,11 @@ def sync_detailed( *, client: Client, ) -> Response[Any]: + """ + + Returns: + Response[Any] + """ kwargs = _get_kwargs( param4=param4, param2=param2, @@ -70,6 +75,13 @@ async def asyncio_detailed( *, client: Client, ) -> Response[Any]: + """ + + + + Returns: + Response[Any] + """ kwargs = _get_kwargs( param4=param4, param2=param2, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py index 51613b806..9f355a2c4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py @@ -37,6 +37,11 @@ def sync_detailed( *, client: Client, ) -> Response[Any]: + """ + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, ) @@ -52,6 +57,13 @@ async def asyncio_detailed( *, client: Client, ) -> Response[Any]: + """ + + + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, ) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py index 9f9fcc088..85d2de782 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py @@ -120,6 +120,25 @@ def sync_detailed( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Defaults + + + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, string_prop=string_prop, @@ -157,8 +176,26 @@ def sync( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Optional[Union[Any, HTTPValidationError]]: - """ """ - + """ + Defaults + + + + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return sync_detailed( client=client, string_prop=string_prop, @@ -190,6 +227,27 @@ async def asyncio_detailed( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Defaults + + + + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : + + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, string_prop=string_prop, @@ -226,8 +284,27 @@ async def asyncio( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Optional[Union[Any, HTTPValidationError]]: - """ """ - + """ + Defaults + + + + + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py index 7776c56f7..ca1a2fca3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py @@ -45,6 +45,13 @@ def sync_detailed( *, client: Client, ) -> Response[List[bool]]: + """ + Get Basic List Of Booleans + + Get a list of booleans + Returns: + Response[List[bool]] + """ kwargs = _get_kwargs( client=client, ) @@ -60,8 +67,14 @@ def sync( *, client: Client, ) -> Optional[List[bool]]: - """Get a list of booleans""" + """ + Get Basic List Of Booleans + + Get a list of booleans + Returns: + Optional[List[bool]] + """ return sync_detailed( client=client, ).parsed @@ -71,6 +84,15 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[bool]]: + """ + Get Basic List Of Booleans + + Get a list of booleans + + + Returns: + Response[List[bool]] + """ kwargs = _get_kwargs( client=client, ) @@ -85,8 +107,14 @@ async def asyncio( *, client: Client, ) -> Optional[List[bool]]: - """Get a list of booleans""" + """ + Get Basic List Of Booleans + + Get a list of booleans + Returns: + Optional[List[bool]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py index d652f39c7..2e0ba7d18 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py @@ -45,6 +45,13 @@ def sync_detailed( *, client: Client, ) -> Response[List[float]]: + """ + Get Basic List Of Floats + + Get a list of floats + Returns: + Response[List[float]] + """ kwargs = _get_kwargs( client=client, ) @@ -60,8 +67,14 @@ def sync( *, client: Client, ) -> Optional[List[float]]: - """Get a list of floats""" + """ + Get Basic List Of Floats + + Get a list of floats + Returns: + Optional[List[float]] + """ return sync_detailed( client=client, ).parsed @@ -71,6 +84,15 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[float]]: + """ + Get Basic List Of Floats + + Get a list of floats + + + Returns: + Response[List[float]] + """ kwargs = _get_kwargs( client=client, ) @@ -85,8 +107,14 @@ async def asyncio( *, client: Client, ) -> Optional[List[float]]: - """Get a list of floats""" + """ + Get Basic List Of Floats + + Get a list of floats + Returns: + Optional[List[float]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py index 49f854186..b0184da7b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py @@ -45,6 +45,13 @@ def sync_detailed( *, client: Client, ) -> Response[List[int]]: + """ + Get Basic List Of Integers + + Get a list of integers + Returns: + Response[List[int]] + """ kwargs = _get_kwargs( client=client, ) @@ -60,8 +67,14 @@ def sync( *, client: Client, ) -> Optional[List[int]]: - """Get a list of integers""" + """ + Get Basic List Of Integers + + Get a list of integers + Returns: + Optional[List[int]] + """ return sync_detailed( client=client, ).parsed @@ -71,6 +84,15 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[int]]: + """ + Get Basic List Of Integers + + Get a list of integers + + + Returns: + Response[List[int]] + """ kwargs = _get_kwargs( client=client, ) @@ -85,8 +107,14 @@ async def asyncio( *, client: Client, ) -> Optional[List[int]]: - """Get a list of integers""" + """ + Get Basic List Of Integers + + Get a list of integers + Returns: + Optional[List[int]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py index 21b7a340f..623bb0ba3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py @@ -45,6 +45,13 @@ def sync_detailed( *, client: Client, ) -> Response[List[str]]: + """ + Get Basic List Of Strings + + Get a list of strings + Returns: + Response[List[str]] + """ kwargs = _get_kwargs( client=client, ) @@ -60,8 +67,14 @@ def sync( *, client: Client, ) -> Optional[List[str]]: - """Get a list of strings""" + """ + Get Basic List Of Strings + + Get a list of strings + Returns: + Optional[List[str]] + """ return sync_detailed( client=client, ).parsed @@ -71,6 +84,15 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[str]]: + """ + Get Basic List Of Strings + + Get a list of strings + + + Returns: + Response[List[str]] + """ kwargs = _get_kwargs( client=client, ) @@ -85,8 +107,14 @@ async def asyncio( *, client: Client, ) -> Optional[List[str]]: - """Get a list of strings""" + """ + Get Basic List Of Strings + + Get a list of strings + Returns: + Optional[List[str]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py index accd2378b..5e0344828 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py @@ -84,6 +84,16 @@ def sync_detailed( an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime], ) -> Response[Union[HTTPValidationError, List[AModel]]]: + """ + Get List + + Get a list of things + Args: + an_enum_value (List[AnEnum]): None: + some_date (Union[datetime.date, datetime.datetime]): None: + Returns: + Response[Union[HTTPValidationError, List[AModel]]] + """ kwargs = _get_kwargs( client=client, an_enum_value=an_enum_value, @@ -103,8 +113,17 @@ def sync( an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime], ) -> Optional[Union[HTTPValidationError, List[AModel]]]: - """Get a list of things""" + """ + Get List + Get a list of things + + Args: + an_enum_value (List[AnEnum]): None: + some_date (Union[datetime.date, datetime.datetime]): None: + Returns: + Optional[Union[HTTPValidationError, List[AModel]]] + """ return sync_detailed( client=client, an_enum_value=an_enum_value, @@ -118,6 +137,18 @@ async def asyncio_detailed( an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime], ) -> Response[Union[HTTPValidationError, List[AModel]]]: + """ + Get List + + Get a list of things + + Args: + an_enum_value (List[AnEnum]): None: + some_date (Union[datetime.date, datetime.datetime]): None: + + Returns: + Response[Union[HTTPValidationError, List[AModel]]] + """ kwargs = _get_kwargs( client=client, an_enum_value=an_enum_value, @@ -136,8 +167,18 @@ async def asyncio( an_enum_value: List[AnEnum], some_date: Union[datetime.date, datetime.datetime], ) -> Optional[Union[HTTPValidationError, List[AModel]]]: - """Get a list of things""" + """ + Get List + + Get a list of things + + Args: + an_enum_value (List[AnEnum]): None: + some_date (Union[datetime.date, datetime.datetime]): None: + Returns: + Optional[Union[HTTPValidationError, List[AModel]]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py index 084892c6f..80ef4c1e2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py @@ -61,6 +61,15 @@ def sync_detailed( client: Client, int_enum: AnIntEnum, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Int Enum + + + Args: + int_enum (AnIntEnum): An enumeration.: + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, int_enum=int_enum, @@ -78,8 +87,16 @@ def sync( client: Client, int_enum: AnIntEnum, ) -> Optional[Union[Any, HTTPValidationError]]: - """ """ + """ + Int Enum + + + Args: + int_enum (AnIntEnum): An enumeration.: + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return sync_detailed( client=client, int_enum=int_enum, @@ -91,6 +108,17 @@ async def asyncio_detailed( client: Client, int_enum: AnIntEnum, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Int Enum + + + + Args: + int_enum (AnIntEnum): An enumeration.: + + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, int_enum=int_enum, @@ -107,8 +135,17 @@ async def asyncio( client: Client, int_enum: AnIntEnum, ) -> Optional[Union[Any, HTTPValidationError]]: - """ """ + """ + Int Enum + + + + Args: + int_enum (AnIntEnum): An enumeration.: + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py index 296685d07..21feb41da 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -56,6 +56,13 @@ def sync_detailed( client: Client, json_body: AModel, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Json Body + + Try sending a JSON body + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, json_body=json_body, @@ -73,8 +80,14 @@ def sync( client: Client, json_body: AModel, ) -> Optional[Union[Any, HTTPValidationError]]: - """Try sending a JSON body""" + """ + Json Body + + Try sending a JSON body + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return sync_detailed( client=client, json_body=json_body, @@ -86,6 +99,15 @@ async def asyncio_detailed( client: Client, json_body: AModel, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Json Body + + Try sending a JSON body + + + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, json_body=json_body, @@ -102,8 +124,14 @@ async def asyncio( client: Client, json_body: AModel, ) -> Optional[Union[Any, HTTPValidationError]]: - """Try sending a JSON body""" + """ + Json Body + + Try sending a JSON body + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py index 71b3f46ba..8ea4a9c49 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py @@ -37,6 +37,13 @@ def sync_detailed( *, client: Client, ) -> Response[Any]: + """ + No Response + + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, ) @@ -52,6 +59,15 @@ async def asyncio_detailed( *, client: Client, ) -> Response[Any]: + """ + No Response + + + + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, ) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py index 6741306a4..610bc75bf 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py @@ -46,6 +46,13 @@ def sync_detailed( *, client: Client, ) -> Response[File]: + """ + Octet Stream + + + Returns: + Response[File] + """ kwargs = _get_kwargs( client=client, ) @@ -61,8 +68,14 @@ def sync( *, client: Client, ) -> Optional[File]: - """ """ + """ + Octet Stream + + + Returns: + Optional[File] + """ return sync_detailed( client=client, ).parsed @@ -72,6 +85,15 @@ async def asyncio_detailed( *, client: Client, ) -> Response[File]: + """ + Octet Stream + + + + + Returns: + Response[File] + """ kwargs = _get_kwargs( client=client, ) @@ -86,8 +108,14 @@ async def asyncio( *, client: Client, ) -> Optional[File]: - """ """ + """ + Octet Stream + + + Returns: + Optional[File] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py index a92f4e8f8..420e38865 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py @@ -41,6 +41,13 @@ def sync_detailed( client: Client, form_data: AFormData, ) -> Response[Any]: + """ + Post from data + + Post form data + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, form_data=form_data, @@ -58,6 +65,15 @@ async def asyncio_detailed( client: Client, form_data: AFormData, ) -> Response[Any]: + """ + Post from data + + Post form data + + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, form_data=form_data, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py index a4d1919c7..a37b34c1b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py @@ -52,6 +52,13 @@ def sync_detailed( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Response[TestInlineObjectsResponse200]: + """ + Test Inline Objects + + + Returns: + Response[TestInlineObjectsResponse200] + """ kwargs = _get_kwargs( client=client, json_body=json_body, @@ -69,8 +76,14 @@ def sync( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Optional[TestInlineObjectsResponse200]: - """ """ + """ + Test Inline Objects + + + Returns: + Optional[TestInlineObjectsResponse200] + """ return sync_detailed( client=client, json_body=json_body, @@ -82,6 +95,15 @@ async def asyncio_detailed( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Response[TestInlineObjectsResponse200]: + """ + Test Inline Objects + + + + + Returns: + Response[TestInlineObjectsResponse200] + """ kwargs = _get_kwargs( client=client, json_body=json_body, @@ -98,8 +120,14 @@ async def asyncio( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Optional[TestInlineObjectsResponse200]: - """ """ + """ + Test Inline Objects + + + Returns: + Optional[TestInlineObjectsResponse200] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index 2e3a5cbfc..8fa21d81d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -41,6 +41,15 @@ def sync_detailed( client: Client, my_token: str, ) -> Response[Any]: + """ + TOKEN_WITH_COOKIE + + Test optional cookie parameters + Args: + my_token (str): None, + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, my_token=my_token, @@ -58,6 +67,17 @@ async def asyncio_detailed( client: Client, my_token: str, ) -> Response[Any]: + """ + TOKEN_WITH_COOKIE + + Test optional cookie parameters + + Args: + my_token (str): None, + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, my_token=my_token, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py index 0fdb4ff2c..c1c48226d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py @@ -37,6 +37,13 @@ def sync_detailed( *, client: Client, ) -> Response[Any]: + """ + Unsupported Content + + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, ) @@ -52,6 +59,15 @@ async def asyncio_detailed( *, client: Client, ) -> Response[Any]: + """ + Unsupported Content + + + + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, ) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py index 6db011608..a410d5726 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -61,6 +61,15 @@ def sync_detailed( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Upload File + + Upload a file + Args: + keep_alive (Union[Unset, bool]): None, + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -80,8 +89,16 @@ def sync( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """Upload a file""" + """ + Upload File + Upload a file + + Args: + keep_alive (Union[Unset, bool]): None, + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return sync_detailed( client=client, multipart_data=multipart_data, @@ -95,6 +112,17 @@ async def asyncio_detailed( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Upload File + + Upload a file + + Args: + keep_alive (Union[Unset, bool]): None, + + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -113,8 +141,17 @@ async def asyncio( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """Upload a file""" + """ + Upload File + + Upload a file + + Args: + keep_alive (Union[Unset, bool]): None, + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py index 690d52ede..4cf01a8fb 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py @@ -64,6 +64,15 @@ def sync_detailed( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Upload multiple files + + Upload several files in the same request + Args: + keep_alive (Union[Unset, bool]): None, + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -83,8 +92,16 @@ def sync( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """Upload several files in the same request""" + """ + Upload multiple files + Upload several files in the same request + + Args: + keep_alive (Union[Unset, bool]): None, + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return sync_detailed( client=client, multipart_data=multipart_data, @@ -98,6 +115,17 @@ async def asyncio_detailed( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: + """ + Upload multiple files + + Upload several files in the same request + + Args: + keep_alive (Union[Unset, bool]): None, + + Returns: + Response[Union[Any, HTTPValidationError]] + """ kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -116,8 +144,17 @@ async def asyncio( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """Upload several files in the same request""" + """ + Upload multiple files + + Upload several files in the same request + + Args: + keep_alive (Union[Unset, bool]): None, + Returns: + Optional[Union[Any, HTTPValidationError]] + """ return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py index c5c172900..2a2f4702e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py @@ -45,6 +45,13 @@ def sync_detailed( client: Client, import_: str, ) -> Response[Any]: + """ + + Args: + import_ (str): None: + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, import_=import_, @@ -62,6 +69,15 @@ async def asyncio_detailed( client: Client, import_: str, ) -> Response[Any]: + """ + + + Args: + import_ (str): None: + + Returns: + Response[Any] + """ kwargs = _get_kwargs( client=client, import_=import_, diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py index f5c34f5be..17ff2ec74 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py @@ -9,7 +9,14 @@ @attr.s(auto_attribs=True) class AFormData: - """ """ + """ + + + Properties: + an_required_field (str): None + an_optional_field (Union[Unset, str]): None + + """ an_required_field: str an_optional_field: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py index a7a68874a..0161116b5 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py @@ -16,7 +16,40 @@ @attr.s(auto_attribs=True) class AModel: - """A Model for testing all the ways custom objects can be used""" + """ + A Model for testing all the ways custom objects can be used + + Properties: + an_enum_value (AnEnum): For testing Enums in all the ways they can be + used + an_allof_enum_with_overridden_default (AnAllOfEnum): None|default: + AnAllOfEnum.OVERRIDDEN_DEFAULT + a_camel_date_time (Union[datetime.date, datetime.datetime]): None + a_date (datetime.date): None + required_not_nullable (str): None + one_of_models (Union[Any, FreeFormModel, ModelWithUnionProperty]): None + model (ModelWithUnionProperty): + any_value (Union[Unset, Any]): None + an_optional_allof_enum (Union[Unset, AnAllOfEnum]): None + nested_list_of_enums (Union[Unset, List[List[DifferentEnum]]]): None + a_nullable_date (Optional[datetime.date]): None + a_not_required_date (Union[Unset, datetime.date]): None + attr_1_leading_digit (Union[Unset, str]): None + required_nullable (Optional[str]): None + not_required_nullable (Union[Unset, None, str]): None + not_required_not_nullable (Union[Unset, str]): None + nullable_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, + None]): None + not_required_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, + Unset]): None + not_required_nullable_one_of_models (Union[FreeFormModel, + ModelWithUnionProperty, None, Unset, str]): None + nullable_model (Optional[ModelWithUnionProperty]): + not_required_model (Union[Unset, ModelWithUnionProperty]): + not_required_nullable_model (Union[Unset, None, + ModelWithUnionProperty]): + + """ an_enum_value: AnEnum a_camel_date_time: Union[datetime.date, datetime.datetime] diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py index c71bf8dcf..423d420af 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py @@ -13,7 +13,43 @@ @attr.s(auto_attribs=True) class AModelWithPropertiesReferenceThatAreNotObject: - """ """ + """ + + + Properties: + enum_properties_ref (List[AnEnum]): None + str_properties_ref (List[str]): None + date_properties_ref (List[datetime.date]): None + datetime_properties_ref (List[datetime.datetime]): None + int32_properties_ref (List[int]): None + int64_properties_ref (List[int]): None + float_properties_ref (List[float]): None + double_properties_ref (List[float]): None + file_properties_ref (List[File]): None + bytestream_properties_ref (List[str]): None + enum_properties (List[AnEnum]): None + str_properties (List[str]): None + date_properties (List[datetime.date]): None + datetime_properties (List[datetime.datetime]): None + int32_properties (List[int]): None + int64_properties (List[int]): None + float_properties (List[float]): None + double_properties (List[float]): None + file_properties (List[File]): None + bytestream_properties (List[str]): None + enum_property_ref (AnEnum): For testing Enums in all the ways they can + be used + str_property_ref (str): None + date_property_ref (datetime.date): None + datetime_property_ref (datetime.datetime): None + int32_property_ref (int): None + int64_property_ref (int): None + float_property_ref (float): None + double_property_ref (float): None + file_property_ref (File): None + bytestream_property_ref (str): None + + """ enum_properties_ref: List[AnEnum] str_properties_ref: List[str] diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py index 515374d19..d95154275 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py @@ -10,7 +10,15 @@ @attr.s(auto_attribs=True) class AllOfSubModel: - """ """ + """ + + + Properties: + a_sub_property (Union[Unset, str]): None + type (Union[Unset, str]): None + type_enum (Union[Unset, AllOfSubModelTypeEnum]): None + + """ a_sub_property: Union[Unset, str] = UNSET type: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py index 5fabb03e4..4b3642bb9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py @@ -11,7 +11,15 @@ @attr.s(auto_attribs=True) class AnotherAllOfSubModel: - """ """ + """ + + + Properties: + another_sub_property (Union[Unset, str]): None + type (Union[Unset, AnotherAllOfSubModelType]): None + type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): None + + """ another_sub_property: Union[Unset, str] = UNSET type: Union[Unset, AnotherAllOfSubModelType] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py index 683025d4e..585496f23 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py @@ -22,7 +22,23 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPost: - """ """ + """ + + + Properties: + some_file (File): None + some_object (BodyUploadFileTestsUploadPostSomeObject): + some_optional_file (Union[Unset, File]): None + some_string (Union[Unset, str]): None|default: 'some_default_string' + some_number (Union[Unset, float]): None + some_array (Union[Unset, List[float]]): None + some_optional_object (Union[Unset, + BodyUploadFileTestsUploadPostSomeOptionalObject]): + some_nullable_object + (Optional[BodyUploadFileTestsUploadPostSomeNullableObject]): + some_enum (Union[Unset, DifferentEnum]): An enumeration. + + """ some_file: File some_object: BodyUploadFileTestsUploadPostSomeObject diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py index b2ce8457e..b9f0f5e6b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py @@ -9,7 +9,13 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostAdditionalProperty: - """ """ + """ + + + Properties: + foo (Union[Unset, str]): None + + """ foo: Union[Unset, str] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py index f97e865aa..e882c1d3c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py @@ -9,7 +9,13 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostSomeNullableObject: - """ """ + """ + + + Properties: + bar (Union[Unset, str]): None + + """ bar: Union[Unset, str] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py index 85eaba04e..e12cdf246 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py @@ -7,7 +7,14 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostSomeObject: - """ """ + """ + + + Properties: + num (float): None + text (str): None + + """ num: float text: str diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py index f983f83f4..01800cff5 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py @@ -7,7 +7,13 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostSomeOptionalObject: - """ """ + """ + + + Properties: + foo (str): None + + """ foo: str additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py index f8cc2151c..49de8ca6e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py @@ -7,7 +7,12 @@ @attr.s(auto_attribs=True) class FreeFormModel: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py index e777fcc87..976cfb90f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py @@ -10,7 +10,13 @@ @attr.s(auto_attribs=True) class HTTPValidationError: - """ """ + """ + + + Properties: + detail (Union[Unset, List[ValidationError]]): None + + """ detail: Union[Unset, List[ValidationError]] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/import_.py b/end_to_end_tests/golden-record/my_test_api_client/models/import_.py index 276a4f21b..cd6efcc93 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/import_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/import_.py @@ -7,7 +7,12 @@ @attr.s(auto_attribs=True) class Import: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py index 415f27486..2b7d082bb 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py @@ -11,7 +11,16 @@ @attr.s(auto_attribs=True) class ModelFromAllOf: - """ """ + """ + + + Properties: + a_sub_property (Union[Unset, str]): None + type (Union[Unset, AnotherAllOfSubModelType]): None + type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): None + another_sub_property (Union[Unset, str]): None + + """ a_sub_property: Union[Unset, str] = UNSET type: Union[Unset, AnotherAllOfSubModelType] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py index c87d4c208..3b34c15d1 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py @@ -7,7 +7,12 @@ @attr.s(auto_attribs=True) class ModelName: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py index a2e168758..3d028ce80 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py @@ -12,7 +12,13 @@ @attr.s(auto_attribs=True) class ModelWithAdditionalPropertiesInlined: - """ """ + """ + + + Properties: + a_number (Union[Unset, float]): None + + """ a_number: Union[Unset, float] = UNSET additional_properties: Dict[str, ModelWithAdditionalPropertiesInlinedAdditionalProperty] = attr.ib( diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py index 490f6e34c..1fe76fae9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py @@ -9,7 +9,13 @@ @attr.s(auto_attribs=True) class ModelWithAdditionalPropertiesInlinedAdditionalProperty: - """ """ + """ + + + Properties: + extra_props_prop (Union[Unset, str]): None + + """ extra_props_prop: Union[Unset, str] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py index d51c5d72c..6b6a3d8a8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py @@ -9,7 +9,12 @@ @attr.s(auto_attribs=True) class ModelWithAdditionalPropertiesRefed: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[str, AnEnum] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py index 08a016dd8..fe2ceabd0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py @@ -11,7 +11,12 @@ @attr.s(auto_attribs=True) class ModelWithAnyJsonProperties: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[ str, Union[List[str], ModelWithAnyJsonPropertiesAdditionalPropertyType0, bool, float, int, str] diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py index 19e863fc4..bcb227b5e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py @@ -7,7 +7,12 @@ @attr.s(auto_attribs=True) class ModelWithAnyJsonPropertiesAdditionalPropertyType0: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[str, str] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py index ee28313bd..1b151ca23 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py @@ -12,7 +12,14 @@ @attr.s(auto_attribs=True) class ModelWithPrimitiveAdditionalProperties: - """ """ + """ + + + Properties: + a_date_holder (Union[Unset, + ModelWithPrimitiveAdditionalPropertiesADateHolder]): + + """ a_date_holder: Union[Unset, ModelWithPrimitiveAdditionalPropertiesADateHolder] = UNSET additional_properties: Dict[str, str] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py index aa8a25252..74397fe2c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py @@ -9,7 +9,12 @@ @attr.s(auto_attribs=True) class ModelWithPrimitiveAdditionalPropertiesADateHolder: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[str, datetime.datetime] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py index e28a14e91..36fab63ef 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py @@ -10,7 +10,13 @@ @attr.s(auto_attribs=True) class ModelWithPropertyRef: - """ """ + """ + + + Properties: + inner (Union[Unset, ModelName]): + + """ inner: Union[Unset, ModelName] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py index b7fa116e3..a15a4c5d3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py @@ -11,7 +11,13 @@ @attr.s(auto_attribs=True) class ModelWithUnionProperty: - """ """ + """ + + + Properties: + a_property (Union[AnEnum, AnIntEnum, Unset]): None + + """ a_property: Union[AnEnum, AnIntEnum, Unset] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py index 27e91a80a..c9512e3fe 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py @@ -11,7 +11,14 @@ @attr.s(auto_attribs=True) class ModelWithUnionPropertyInlined: - """ """ + """ + + + Properties: + fruit (Union[ModelWithUnionPropertyInlinedFruitType0, + ModelWithUnionPropertyInlinedFruitType1, Unset]): None + + """ fruit: Union[ModelWithUnionPropertyInlinedFruitType0, ModelWithUnionPropertyInlinedFruitType1, Unset] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py index 333d822c7..eec99c8f9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py @@ -9,7 +9,13 @@ @attr.s(auto_attribs=True) class ModelWithUnionPropertyInlinedFruitType0: - """ """ + """ + + + Properties: + apples (Union[Unset, str]): None + + """ apples: Union[Unset, str] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py index d2020747c..2d9e5c8a0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py @@ -9,7 +9,13 @@ @attr.s(auto_attribs=True) class ModelWithUnionPropertyInlinedFruitType1: - """ """ + """ + + + Properties: + bananas (Union[Unset, str]): None + + """ bananas: Union[Unset, str] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/none.py b/end_to_end_tests/golden-record/my_test_api_client/models/none.py index e1722f094..77ad48334 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/none.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/none.py @@ -7,7 +7,12 @@ @attr.s(auto_attribs=True) class None_: - """ """ + """ + + + Properties: + + """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py index e74ed557b..a831b558e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py @@ -9,7 +9,13 @@ @attr.s(auto_attribs=True) class TestInlineObjectsJsonBody: - """ """ + """ + + + Properties: + a_property (Union[Unset, str]): None + + """ a_property: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py index 7c6aa6fb2..535fcaa72 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py @@ -9,7 +9,13 @@ @attr.s(auto_attribs=True) class TestInlineObjectsResponse200: - """ """ + """ + + + Properties: + a_property (Union[Unset, str]): None + + """ a_property: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py index 8bbb20c76..e80e9790a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py @@ -7,7 +7,15 @@ @attr.s(auto_attribs=True) class ValidationError: - """ """ + """ + + + Properties: + loc (List[str]): None + msg (str): None + type (str): None + + """ loc: List[str] msg: str From ed269c7e6d860ca4bff87f2bbe2e23837329fa5b Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 06:11:11 -0700 Subject: [PATCH 06/18] reformatted code --- .../parser/properties/property.py | 2 +- openapi_python_client/parser/responses.py | 4 ++-- tests/test_parser/test_responses.py | 22 +++++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py index 12dedba79..45c83c412 100644 --- a/openapi_python_client/parser/properties/property.py +++ b/openapi_python_client/parser/properties/property.py @@ -116,4 +116,4 @@ def to_docstring(self): doc += f"|default: {self.default}" if self.example: doc += f"|ex: {self.example}" - return doc \ No newline at end of file + return doc diff --git a/openapi_python_client/parser/responses.py b/openapi_python_client/parser/responses.py index cdda1e4a1..d5bf1a3db 100644 --- a/openapi_python_client/parser/responses.py +++ b/openapi_python_client/parser/responses.py @@ -38,8 +38,8 @@ def empty_response(*, status_code: int, response_name: str, config: Config) -> R nullable=False, required=True, python_name=PythonIdentifier(value=response_name, prefix=config.field_prefix), - description='', - example='', + description="", + example="", ), source="None", ) diff --git a/tests/test_parser/test_responses.py b/tests/test_parser/test_responses.py index f6ed6bc7d..547e2f7a3 100644 --- a/tests/test_parser/test_responses.py +++ b/tests/test_parser/test_responses.py @@ -20,8 +20,15 @@ def test_response_from_data_no_content(): assert response == Response( status_code=200, - prop=AnyProperty(name="response_200", default=None, nullable=False, required=True, python_name="response_200", - description='', example=''), + prop=AnyProperty( + name="response_200", + default=None, + nullable=False, + required=True, + python_name="response_200", + description="", + example="", + ), source="None", ) @@ -47,8 +54,15 @@ def test_response_from_data_no_content_schema(): assert response == Response( status_code=200, - prop=AnyProperty(name="response_200", default=None, nullable=False, required=True, python_name="response_200", - description=data.description, example=data.example), + prop=AnyProperty( + name="response_200", + default=None, + nullable=False, + required=True, + python_name="response_200", + description=data.description, + example=data.example, + ), source="None", ) From bc5f51daa55f6148cacbc84a15fa350730f23e5e Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 06:17:28 -0700 Subject: [PATCH 07/18] fix untyped function --- openapi_python_client/parser/properties/property.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py index 45c83c412..9b72aaab6 100644 --- a/openapi_python_client/parser/properties/property.py +++ b/openapi_python_client/parser/properties/property.py @@ -110,7 +110,8 @@ def to_string(self) -> str: return f"{self.python_name}: {self.get_type_string()} = {default}" return f"{self.python_name}: {self.get_type_string()}" - def to_docstring(self): + def to_docstring(self) -> str: + """Returns property docstring""" doc = f"{self.python_name} ({self.get_type_string()}): {self.description}" if self.default: doc += f"|default: {self.default}" From ec94e8f38cad5daad9548e6d9277670a2b6a3073 Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 06:32:14 -0700 Subject: [PATCH 08/18] fix test --- tests/test_parser/test_properties/test_model_property.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_parser/test_properties/test_model_property.py b/tests/test_parser/test_properties/test_model_property.py index 6e1d98166..7d66e7ddc 100644 --- a/tests/test_parser/test_properties/test_model_property.py +++ b/tests/test_parser/test_properties/test_model_property.py @@ -61,6 +61,8 @@ class TestBuildModelProperty: nullable=False, default=None, python_name="additional_property", + description="", + example="", ), ), ], From 00c6d2ea121e84f364960d8b3ec43497a02fd0b6 Mon Sep 17 00:00:00 2001 From: "Roman A. Taycher" Date: Wed, 29 Sep 2021 06:42:39 -0700 Subject: [PATCH 09/18] fix test properties --- tests/conftest.py | 4 ++++ .../test_date_property/test_date_property.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index dfa885c23..2c99a531c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -36,6 +36,8 @@ def _factory(**kwargs): "relative_imports": set(), "additional_properties": False, "python_name": "", + "description": "", + "example": "", **kwargs, } return ModelProperty(**kwargs) @@ -210,6 +212,8 @@ def _common_kwargs(kwargs: Dict[str, Any]) -> Dict[str, Any]: "required": True, "nullable": False, "default": None, + "description": "", + "example": "", **kwargs, } if not kwargs.get("python_name"): diff --git a/tests/test_templates/test_property_templates/test_date_property/test_date_property.py b/tests/test_templates/test_property_templates/test_date_property/test_date_property.py index 02137add4..f5d4aa798 100644 --- a/tests/test_templates/test_property_templates/test_date_property/test_date_property.py +++ b/tests/test_templates/test_property_templates/test_date_property/test_date_property.py @@ -12,6 +12,8 @@ def date_property(required=True, nullable=True, default=None) -> DateProperty: nullable=nullable, default=default, python_name="a_prop", + description="", + example="", ) From 63c1eae643ad80a3f77468da96454ab77c64006f Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 15:20:09 -0700 Subject: [PATCH 10/18] chore: Fix failing tests and refactor endpoint docstrings to reusable macro --- .../api/default/get_common_parameters.py | 4 + .../api/default/post_common_parameters.py | 4 + .../get_location_query_optionality.py | 4 + ...lete_common_parameters_overriding_param.py | 4 + .../get_common_parameters_overriding_param.py | 4 + .../get_same_name_multiple_locations_param.py | 4 + .../parameters/multiple_path_parameters.py | 4 + .../api/tag1/get_tag_with_number.py | 4 + .../api/tests/defaults_tests_defaults_post.py | 119 +++++++++--------- .../api/tests/get_basic_list_of_booleans.py | 32 +++-- .../api/tests/get_basic_list_of_floats.py | 32 +++-- .../api/tests/get_basic_list_of_integers.py | 32 +++-- .../api/tests/get_basic_list_of_strings.py | 32 +++-- .../api/tests/get_user_list.py | 63 ++++++---- .../api/tests/int_enum_tests_int_enum_post.py | 39 +++--- .../tests/json_body_tests_json_body_post.py | 32 +++-- .../no_response_tests_no_response_get.py | 12 +- .../octet_stream_tests_octet_stream_get.py | 24 ++-- .../api/tests/post_form_data.py | 16 ++- .../api/tests/post_tests_json_body_string.py | 40 +++++- .../api/tests/test_inline_objects.py | 24 ++-- ..._with_cookie_auth_token_with_cookie_get.py | 24 ++-- ...d_content_tests_unsupported_content_get.py | 12 +- .../tests/upload_file_tests_upload_post.py | 47 ++++--- ...upload_multiple_files_tests_upload_post.py | 47 ++++--- .../my_test_api_client/api/true_/false_.py | 4 + .../parser/properties/__init__.py | 2 + openapi_python_client/parser/responses.py | 24 ++-- .../templates/endpoint_macros.py.jinja | 27 ++++ .../templates/endpoint_module.py.jinja | 103 ++------------- tests/conftest.py | 20 ++- tests/test_parser/test_openapi.py | 30 ++--- .../test_parser/test_properties/test_init.py | 44 +++++-- .../test_properties/test_model_property.py | 4 +- tests/test_parser/test_responses.py | 12 +- 35 files changed, 549 insertions(+), 380 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py index b0d1b43c0..cc66feaed 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py @@ -46,11 +46,14 @@ def sync_detailed( ) -> Response[Any]: """ + Args: common (Union[Unset, None, str]): None: + Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, common=common, @@ -78,6 +81,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, common=common, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py index 1d7b97879..b5189234a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py @@ -46,11 +46,14 @@ def sync_detailed( ) -> Response[Any]: """ + Args: common (Union[Unset, None, str]): None: + Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, common=common, @@ -78,6 +81,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, common=common, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py index a6032fb58..fe3c70a01 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py @@ -70,14 +70,17 @@ def sync_detailed( ) -> Response[Any]: """ + Args: not_null_required (datetime.datetime): None: null_required (Union[Unset, None, datetime.datetime]): None: null_not_required (Union[Unset, None, datetime.datetime]): None: not_null_not_required (Union[Unset, None, datetime.datetime]): None: + Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, not_null_required=not_null_required, @@ -114,6 +117,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, not_null_required=not_null_required, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index 8b30c0fdd..80212931c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -48,11 +48,14 @@ def sync_detailed( ) -> Response[Any]: """ + Args: param_query (Union[Unset, None, str]): None: + Returns: Response[Any] """ + kwargs = _get_kwargs( param_path=param_path, client=client, @@ -82,6 +85,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( param_path=param_path, client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index 9c93ec204..95c524e90 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -48,11 +48,14 @@ def sync_detailed( ) -> Response[Any]: """ + Args: param_query (str): None|default: 'overriden_in_GET': + Returns: Response[Any] """ + kwargs = _get_kwargs( param_path=param_path, client=client, @@ -82,6 +85,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( param_path=param_path, client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index c95022ebd..6a5ce85c1 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -58,13 +58,16 @@ def sync_detailed( ) -> Response[Any]: """ + Args: param_query (Union[Unset, None, str]): None: param_header (Union[Unset, str]): None, param_cookie (Union[Unset, str]): None, + Returns: Response[Any] """ + kwargs = _get_kwargs( param_path=param_path, client=client, @@ -100,6 +103,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( param_path=param_path, client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py index 9fc68ef7c..058f2eec0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -48,9 +48,12 @@ def sync_detailed( ) -> Response[Any]: """ + + Returns: Response[Any] """ + kwargs = _get_kwargs( param4=param4, param2=param2, @@ -82,6 +85,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( param4=param4, param2=param2, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py index 12d89fab3..e426dcc75 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py @@ -38,9 +38,12 @@ def sync_detailed( ) -> Response[Any]: """ + + Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, ) @@ -64,6 +67,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, ) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py index 9c36c5fb4..c9e434732 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py @@ -123,21 +123,24 @@ def sync_detailed( Defaults - Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : - Returns: - Response[Union[Any, HTTPValidationError]] + + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : + + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, string_prop=string_prop, @@ -181,21 +184,23 @@ def sync( - Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : - Returns: - Optional[Union[Any, HTTPValidationError]] + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : + + Returns: + Response[Union[Any, HTTPValidationError]] """ + return sync_detailed( client=client, string_prop=string_prop, @@ -232,22 +237,23 @@ async def asyncio_detailed( - Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : - Returns: - Response[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, string_prop=string_prop, @@ -289,22 +295,23 @@ async def asyncio( + Args: + string_prop (str): None|default: 'the default string': + date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): + float_prop (float): None|default: 3.14: + int_prop (int): None|default: 7: + boolean_prop (bool): None: + list_prop (List[AnEnum]): None: + union_prop (Union[float, str]): None|default: 'not a float': + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: + enum_prop (AnEnum): For testing Enums in all the ways they can be used : + model_prop (ModelWithUnionProperty): : + required_model_prop (ModelWithUnionProperty): : - Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : - Returns: - Optional[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py index 9a8bced9c..280f9ec0a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py @@ -47,10 +47,13 @@ def sync_detailed( """ Get Basic List Of Booleans - Get a list of booleans - Returns: - Response[List[bool]] + Get a list of booleans + + + Returns: + Response[List[bool]] """ + kwargs = _get_kwargs( client=client, ) @@ -70,11 +73,13 @@ def sync( """ Get Basic List Of Booleans - Get a list of booleans + Get a list of booleans + - Returns: - Optional[List[bool]] + Returns: + Response[List[bool]] """ + return sync_detailed( client=client, ).parsed @@ -87,12 +92,13 @@ async def asyncio_detailed( """ Get Basic List Of Booleans - Get a list of booleans + Get a list of booleans - Returns: - Response[List[bool]] + Returns: + Response[List[bool]] """ + kwargs = _get_kwargs( client=client, ) @@ -110,11 +116,13 @@ async def asyncio( """ Get Basic List Of Booleans - Get a list of booleans + Get a list of booleans - Returns: - Optional[List[bool]] + + Returns: + Response[List[bool]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py index 5e798351b..d57bd5dcb 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py @@ -47,10 +47,13 @@ def sync_detailed( """ Get Basic List Of Floats - Get a list of floats - Returns: - Response[List[float]] + Get a list of floats + + + Returns: + Response[List[float]] """ + kwargs = _get_kwargs( client=client, ) @@ -70,11 +73,13 @@ def sync( """ Get Basic List Of Floats - Get a list of floats + Get a list of floats + - Returns: - Optional[List[float]] + Returns: + Response[List[float]] """ + return sync_detailed( client=client, ).parsed @@ -87,12 +92,13 @@ async def asyncio_detailed( """ Get Basic List Of Floats - Get a list of floats + Get a list of floats - Returns: - Response[List[float]] + Returns: + Response[List[float]] """ + kwargs = _get_kwargs( client=client, ) @@ -110,11 +116,13 @@ async def asyncio( """ Get Basic List Of Floats - Get a list of floats + Get a list of floats - Returns: - Optional[List[float]] + + Returns: + Response[List[float]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py index 3c4c8ad37..5e6d4a350 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py @@ -47,10 +47,13 @@ def sync_detailed( """ Get Basic List Of Integers - Get a list of integers - Returns: - Response[List[int]] + Get a list of integers + + + Returns: + Response[List[int]] """ + kwargs = _get_kwargs( client=client, ) @@ -70,11 +73,13 @@ def sync( """ Get Basic List Of Integers - Get a list of integers + Get a list of integers + - Returns: - Optional[List[int]] + Returns: + Response[List[int]] """ + return sync_detailed( client=client, ).parsed @@ -87,12 +92,13 @@ async def asyncio_detailed( """ Get Basic List Of Integers - Get a list of integers + Get a list of integers - Returns: - Response[List[int]] + Returns: + Response[List[int]] """ + kwargs = _get_kwargs( client=client, ) @@ -110,11 +116,13 @@ async def asyncio( """ Get Basic List Of Integers - Get a list of integers + Get a list of integers - Returns: - Optional[List[int]] + + Returns: + Response[List[int]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py index 2f53bd8e8..5eefed4a0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py @@ -47,10 +47,13 @@ def sync_detailed( """ Get Basic List Of Strings - Get a list of strings - Returns: - Response[List[str]] + Get a list of strings + + + Returns: + Response[List[str]] """ + kwargs = _get_kwargs( client=client, ) @@ -70,11 +73,13 @@ def sync( """ Get Basic List Of Strings - Get a list of strings + Get a list of strings + - Returns: - Optional[List[str]] + Returns: + Response[List[str]] """ + return sync_detailed( client=client, ).parsed @@ -87,12 +92,13 @@ async def asyncio_detailed( """ Get Basic List Of Strings - Get a list of strings + Get a list of strings - Returns: - Response[List[str]] + Returns: + Response[List[str]] """ + kwargs = _get_kwargs( client=client, ) @@ -110,11 +116,13 @@ async def asyncio( """ Get Basic List Of Strings - Get a list of strings + Get a list of strings - Returns: - Optional[List[str]] + + Returns: + Response[List[str]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py index 0b13f3c05..e4187f451 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py @@ -103,13 +103,18 @@ def sync_detailed( """ Get List - Get a list of things - Args: - an_enum_value (List[AnEnum]): None: - some_date (Union[datetime.date, datetime.datetime]): None: - Returns: - Response[Union[HTTPValidationError, List[AModel]]] + Get a list of things + + Args: + an_enum_value (List[AnEnum]): None: + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: + an_enum_value_with_only_null (List[None]): None: + some_date (Union[datetime.date, datetime.datetime]): None: + + Returns: + Response[Union[HTTPValidationError, List[AModel]]] """ + kwargs = _get_kwargs( client=client, an_enum_value=an_enum_value, @@ -137,14 +142,18 @@ def sync( """ Get List - Get a list of things + Get a list of things + + Args: + an_enum_value (List[AnEnum]): None: + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: + an_enum_value_with_only_null (List[None]): None: + some_date (Union[datetime.date, datetime.datetime]): None: - Args: - an_enum_value (List[AnEnum]): None: - some_date (Union[datetime.date, datetime.datetime]): None: - Returns: - Optional[Union[HTTPValidationError, List[AModel]]] + Returns: + Response[Union[HTTPValidationError, List[AModel]]] """ + return sync_detailed( client=client, an_enum_value=an_enum_value, @@ -165,15 +174,18 @@ async def asyncio_detailed( """ Get List - Get a list of things + Get a list of things - Args: - an_enum_value (List[AnEnum]): None: - some_date (Union[datetime.date, datetime.datetime]): None: + Args: + an_enum_value (List[AnEnum]): None: + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: + an_enum_value_with_only_null (List[None]): None: + some_date (Union[datetime.date, datetime.datetime]): None: - Returns: - Response[Union[HTTPValidationError, List[AModel]]] + Returns: + Response[Union[HTTPValidationError, List[AModel]]] """ + kwargs = _get_kwargs( client=client, an_enum_value=an_enum_value, @@ -199,15 +211,18 @@ async def asyncio( """ Get List - Get a list of things + Get a list of things + Args: + an_enum_value (List[AnEnum]): None: + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: + an_enum_value_with_only_null (List[None]): None: + some_date (Union[datetime.date, datetime.datetime]): None: - Args: - an_enum_value (List[AnEnum]): None: - some_date (Union[datetime.date, datetime.datetime]): None: - Returns: - Optional[Union[HTTPValidationError, List[AModel]]] + Returns: + Response[Union[HTTPValidationError, List[AModel]]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py index 6734c5d00..2209ad710 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py @@ -64,11 +64,14 @@ def sync_detailed( Int Enum - Args: - int_enum (AnIntEnum): An enumeration.: - Returns: - Response[Union[Any, HTTPValidationError]] + + Args: + int_enum (AnIntEnum): An enumeration.: + + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, int_enum=int_enum, @@ -92,11 +95,13 @@ def sync( - Args: - int_enum (AnIntEnum): An enumeration.: - Returns: - Optional[Union[Any, HTTPValidationError]] + Args: + int_enum (AnIntEnum): An enumeration.: + + Returns: + Response[Union[Any, HTTPValidationError]] """ + return sync_detailed( client=client, int_enum=int_enum, @@ -113,12 +118,13 @@ async def asyncio_detailed( - Args: - int_enum (AnIntEnum): An enumeration.: + Args: + int_enum (AnIntEnum): An enumeration.: - Returns: - Response[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, int_enum=int_enum, @@ -140,12 +146,13 @@ async def asyncio( + Args: + int_enum (AnIntEnum): An enumeration.: - Args: - int_enum (AnIntEnum): An enumeration.: - Returns: - Optional[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py index be15601a0..cbfa4cbaa 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -58,10 +58,13 @@ def sync_detailed( """ Json Body - Try sending a JSON body - Returns: - Response[Union[Any, HTTPValidationError]] + Try sending a JSON body + + + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, json_body=json_body, @@ -83,11 +86,13 @@ def sync( """ Json Body - Try sending a JSON body + Try sending a JSON body + - Returns: - Optional[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + return sync_detailed( client=client, json_body=json_body, @@ -102,12 +107,13 @@ async def asyncio_detailed( """ Json Body - Try sending a JSON body + Try sending a JSON body - Returns: - Response[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, json_body=json_body, @@ -127,11 +133,13 @@ async def asyncio( """ Json Body - Try sending a JSON body + Try sending a JSON body - Returns: - Optional[Union[Any, HTTPValidationError]] + + Returns: + Response[Union[Any, HTTPValidationError]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py index c629f3de2..ceaf9e57a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py @@ -40,9 +40,12 @@ def sync_detailed( No Response - Returns: - Response[Any] + + + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, ) @@ -65,9 +68,10 @@ async def asyncio_detailed( - Returns: - Response[Any] + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, ) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py index f788550fe..9cd15ed95 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py @@ -49,9 +49,12 @@ def sync_detailed( Octet Stream - Returns: - Response[File] + + + Returns: + Response[File] """ + kwargs = _get_kwargs( client=client, ) @@ -73,9 +76,11 @@ def sync( - Returns: - Optional[File] + + Returns: + Response[File] """ + return sync_detailed( client=client, ).parsed @@ -91,9 +96,10 @@ async def asyncio_detailed( - Returns: - Response[File] + Returns: + Response[File] """ + kwargs = _get_kwargs( client=client, ) @@ -113,9 +119,11 @@ async def asyncio( - Returns: - Optional[File] + + Returns: + Response[File] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py index 98bde1383..84152ccec 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py @@ -43,10 +43,13 @@ def sync_detailed( """ Post from data - Post form data - Returns: - Response[Any] + Post form data + + + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, form_data=form_data, @@ -68,12 +71,13 @@ async def asyncio_detailed( """ Post from data - Post form data + Post form data - Returns: - Response[Any] + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, form_data=form_data, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py index 8b076b59c..c4c0ad84e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py @@ -53,6 +53,16 @@ def sync_detailed( client: Client, json_body: str, ) -> Response[Union[HTTPValidationError, str]]: + """ + Json Body Which is String + + + + + Returns: + Response[Union[HTTPValidationError, str]] + """ + kwargs = _get_kwargs( client=client, json_body=json_body, @@ -71,7 +81,15 @@ def sync( client: Client, json_body: str, ) -> Optional[Union[HTTPValidationError, str]]: - """ """ + """ + Json Body Which is String + + + + + Returns: + Response[Union[HTTPValidationError, str]] + """ return sync_detailed( client=client, @@ -84,6 +102,16 @@ async def asyncio_detailed( client: Client, json_body: str, ) -> Response[Union[HTTPValidationError, str]]: + """ + Json Body Which is String + + + + + Returns: + Response[Union[HTTPValidationError, str]] + """ + kwargs = _get_kwargs( client=client, json_body=json_body, @@ -100,7 +128,15 @@ async def asyncio( client: Client, json_body: str, ) -> Optional[Union[HTTPValidationError, str]]: - """ """ + """ + Json Body Which is String + + + + + Returns: + Response[Union[HTTPValidationError, str]] + """ return ( await asyncio_detailed( diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py index 6bc0fa5e7..94bac7eed 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py @@ -55,9 +55,12 @@ def sync_detailed( Test Inline Objects - Returns: - Response[TestInlineObjectsResponse200] + + + Returns: + Response[TestInlineObjectsResponse200] """ + kwargs = _get_kwargs( client=client, json_body=json_body, @@ -81,9 +84,11 @@ def sync( - Returns: - Optional[TestInlineObjectsResponse200] + + Returns: + Response[TestInlineObjectsResponse200] """ + return sync_detailed( client=client, json_body=json_body, @@ -101,9 +106,10 @@ async def asyncio_detailed( - Returns: - Response[TestInlineObjectsResponse200] + Returns: + Response[TestInlineObjectsResponse200] """ + kwargs = _get_kwargs( client=client, json_body=json_body, @@ -125,9 +131,11 @@ async def asyncio( - Returns: - Optional[TestInlineObjectsResponse200] + + Returns: + Response[TestInlineObjectsResponse200] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index 6c70e2833..605b09269 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -43,12 +43,15 @@ def sync_detailed( """ TOKEN_WITH_COOKIE - Test optional cookie parameters - Args: - my_token (str): None, - Returns: - Response[Any] + Test optional cookie parameters + + Args: + my_token (str): None, + + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, my_token=my_token, @@ -70,14 +73,15 @@ async def asyncio_detailed( """ TOKEN_WITH_COOKIE - Test optional cookie parameters + Test optional cookie parameters - Args: - my_token (str): None, + Args: + my_token (str): None, - Returns: - Response[Any] + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, my_token=my_token, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py index ee7318dce..39db731cf 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py @@ -40,9 +40,12 @@ def sync_detailed( Unsupported Content - Returns: - Response[Any] + + + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, ) @@ -65,9 +68,10 @@ async def asyncio_detailed( - Returns: - Response[Any] + Returns: + Response[Any] """ + kwargs = _get_kwargs( client=client, ) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py index 0a1f821fa..ab2b0ec44 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -63,12 +63,15 @@ def sync_detailed( """ Upload File - Upload a file - Args: - keep_alive (Union[Unset, bool]): None, - Returns: - Response[Union[Any, HTTPValidationError]] + Upload a file + + Args: + keep_alive (Union[Unset, bool]): None, + + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -92,13 +95,15 @@ def sync( """ Upload File - Upload a file + Upload a file + + Args: + keep_alive (Union[Unset, bool]): None, - Args: - keep_alive (Union[Unset, bool]): None, - Returns: - Optional[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + return sync_detailed( client=client, multipart_data=multipart_data, @@ -115,14 +120,15 @@ async def asyncio_detailed( """ Upload File - Upload a file + Upload a file - Args: - keep_alive (Union[Unset, bool]): None, + Args: + keep_alive (Union[Unset, bool]): None, - Returns: - Response[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -144,14 +150,15 @@ async def asyncio( """ Upload File - Upload a file + Upload a file + Args: + keep_alive (Union[Unset, bool]): None, - Args: - keep_alive (Union[Unset, bool]): None, - Returns: - Optional[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py index 357faec3f..ccc159e1f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py @@ -66,12 +66,15 @@ def sync_detailed( """ Upload multiple files - Upload several files in the same request - Args: - keep_alive (Union[Unset, bool]): None, - Returns: - Response[Union[Any, HTTPValidationError]] + Upload several files in the same request + + Args: + keep_alive (Union[Unset, bool]): None, + + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -95,13 +98,15 @@ def sync( """ Upload multiple files - Upload several files in the same request + Upload several files in the same request + + Args: + keep_alive (Union[Unset, bool]): None, - Args: - keep_alive (Union[Unset, bool]): None, - Returns: - Optional[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + return sync_detailed( client=client, multipart_data=multipart_data, @@ -118,14 +123,15 @@ async def asyncio_detailed( """ Upload multiple files - Upload several files in the same request + Upload several files in the same request - Args: - keep_alive (Union[Unset, bool]): None, + Args: + keep_alive (Union[Unset, bool]): None, - Returns: - Response[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + kwargs = _get_kwargs( client=client, multipart_data=multipart_data, @@ -147,14 +153,15 @@ async def asyncio( """ Upload multiple files - Upload several files in the same request + Upload several files in the same request + Args: + keep_alive (Union[Unset, bool]): None, - Args: - keep_alive (Union[Unset, bool]): None, - Returns: - Optional[Union[Any, HTTPValidationError]] + Returns: + Response[Union[Any, HTTPValidationError]] """ + return ( await asyncio_detailed( client=client, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py index 5f1eece71..a94d4cac2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py @@ -46,11 +46,14 @@ def sync_detailed( ) -> Response[Any]: """ + Args: import_ (str): None: + Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, import_=import_, @@ -78,6 +81,7 @@ async def asyncio_detailed( Returns: Response[Any] """ + kwargs = _get_kwargs( client=client, import_=import_, diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index 17660b65f..d6e1457c0 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -356,6 +356,8 @@ def build_enum_property( nullable=False, default="None", python_name=utils.PythonIdentifier(value=name, prefix=config.field_prefix), + description=None, + example=None, ), schemas, ) diff --git a/openapi_python_client/parser/responses.py b/openapi_python_client/parser/responses.py index d5bf1a3db..2aaa112d5 100644 --- a/openapi_python_client/parser/responses.py +++ b/openapi_python_client/parser/responses.py @@ -1,6 +1,6 @@ __all__ = ["Response", "response_from_data"] -from typing import Tuple, Union +from typing import Optional, Tuple, Union import attr @@ -28,7 +28,7 @@ class Response: } -def empty_response(*, status_code: int, response_name: str, config: Config) -> Response: +def empty_response(*, status_code: int, response_name: str, config: Config, description: Optional[str]) -> Response: """Return an untyped response, for when no response type is defined""" return Response( status_code=status_code, @@ -38,8 +38,8 @@ def empty_response(*, status_code: int, response_name: str, config: Config) -> R nullable=False, required=True, python_name=PythonIdentifier(value=response_name, prefix=config.field_prefix), - description="", - example="", + description=description, + example=None, ), source="None", ) @@ -51,13 +51,21 @@ def response_from_data( """Generate a Response from the OpenAPI dictionary representation of it""" response_name = f"response_{status_code}" - if isinstance(data, oai.Reference) or data.content is None: + if isinstance(data, oai.Reference): return ( - empty_response(status_code=status_code, response_name=response_name, config=config), + empty_response(status_code=status_code, response_name=response_name, config=config, description=None), schemas, ) content = data.content + if not content: + return ( + empty_response( + status_code=status_code, response_name=response_name, config=config, description=data.description + ), + schemas, + ) + for content_type, media_type in content.items(): if content_type in _SOURCE_BY_CONTENT_TYPE: source = _SOURCE_BY_CONTENT_TYPE[content_type] @@ -68,7 +76,9 @@ def response_from_data( if schema_data is None: return ( - empty_response(status_code=status_code, response_name=response_name, config=config), + empty_response( + status_code=status_code, response_name=response_name, config=config, description=data.description + ), schemas, ) diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index a0d1aa32f..fe293677e 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -147,3 +147,30 @@ json_body=json_body, {{ parameter.python_name }}={{ parameter.python_name }}, {% endfor %} {% endmacro %} + +{% macro docstring(endpoint, return_string) %} +""" +{% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + +{{ endpoint.description | wordwrap(76)}} +{% else %} +{{ endpoint.description | wordwrap(76)}} +{% endif %} + +{% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} +Args: + {% for parameter in endpoint.query_parameters.values() %} + {{ parameter.to_docstring() }}: + {% endfor %} + {% for parameter in endpoint.header_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} + {% for parameter in endpoint.cookie_parameters.values() %} + {{ parameter.to_docstring() }}, + {% endfor %} +{% endif %} + +Returns: + Response[{{ return_string }}] +""" +{% endmacro %} diff --git a/openapi_python_client/templates/endpoint_module.py.jinja b/openapi_python_client/templates/endpoint_module.py.jinja index e2e2b1265..02235516b 100644 --- a/openapi_python_client/templates/endpoint_module.py.jinja +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -9,7 +9,8 @@ from ...types import Response, UNSET {{ relative }} {% endfor %} -{% from "endpoint_macros.py.jinja" import header_params, cookie_params, query_params, json_body, multipart_body, arguments, client, kwargs, parse_response %} +{% from "endpoint_macros.py.jinja" import header_params, cookie_params, query_params, json_body, multipart_body, + arguments, client, kwargs, parse_response, docstring %} {% set return_string = endpoint.response_type() %} {% set parsed_responses = (endpoint.responses | length > 0) and return_string != "Any" %} @@ -87,28 +88,8 @@ def _build_response(*, response: httpx.Response) -> Response[{{ return_string }} def sync_detailed( {{ arguments(endpoint) | indent(4) }} ) -> Response[{{ return_string }}]: - """ - {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} - - {{ endpoint.description | wordwrap(76)}} - {% else %} - {{ endpoint.description | wordwrap(76)}} - {% endif %} - {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} - Args: - {% for parameter in endpoint.query_parameters.values() %} - {{ parameter.to_docstring() }}: - {% endfor %} - {% for parameter in endpoint.header_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% for parameter in endpoint.cookie_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% endif %} - Returns: - Response[{{ return_string }}] - """ + {{ docstring(endpoint, return_string) | indent(4) }} + kwargs = _get_kwargs( {{ kwargs(endpoint) }} ) @@ -124,29 +105,8 @@ def sync_detailed( def sync( {{ arguments(endpoint) | indent(4) }} ) -> Optional[{{ return_string }}]: - """ - {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} - - {{ endpoint.description | wordwrap(76)}} - {% else %} - {{ endpoint.description | wordwrap(76)}} - {% endif %} - - {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} - Args: - {% for parameter in endpoint.query_parameters.values() %} - {{ parameter.to_docstring() }}: - {% endfor %} - {% for parameter in endpoint.header_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% for parameter in endpoint.cookie_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% endif %} - Returns: - Optional[{{ return_string }}] - """ + {{ docstring(endpoint, return_string) | indent(4) }} + return sync_detailed( {{ kwargs(endpoint) }} ).parsed @@ -155,30 +115,8 @@ def sync( async def asyncio_detailed( {{ arguments(endpoint) | indent(4) }} ) -> Response[{{ return_string }}]: - """ - {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} - - {{ endpoint.description | wordwrap(76)}} - {% else %} - {{ endpoint.description | wordwrap(76)}} - {% endif %} - - {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} - Args: - {% for parameter in endpoint.query_parameters.values() %} - {{ parameter.to_docstring() }}: - {% endfor %} - {% for parameter in endpoint.header_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% for parameter in endpoint.cookie_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% endif %} - - Returns: - Response[{{ return_string }}] - """ + {{ docstring(endpoint, return_string) | indent(4) }} + kwargs = _get_kwargs( {{ kwargs(endpoint) }} ) @@ -194,29 +132,8 @@ async def asyncio_detailed( async def asyncio( {{ arguments(endpoint) | indent(4) }} ) -> Optional[{{ return_string }}]: - """ - {% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} - - {{ endpoint.description | wordwrap(76)}} - {% else %} - {{ endpoint.description | wordwrap(76)}} - {% endif %} - - {% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} - Args: - {% for parameter in endpoint.query_parameters.values() %} - {{ parameter.to_docstring() }}: - {% endfor %} - {% for parameter in endpoint.header_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% for parameter in endpoint.cookie_parameters.values() %} - {{ parameter.to_docstring() }}, - {% endfor %} - {% endif %} - Returns: - Optional[{{ return_string }}] - """ + {{ docstring(endpoint, return_string) | indent(4) }} + return (await asyncio_detailed( {{ kwargs(endpoint) }} )).parsed diff --git a/tests/conftest.py b/tests/conftest.py index 2c99a531c..2a683f102 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,6 +11,7 @@ IntProperty, ListProperty, ModelProperty, + NoneProperty, Property, StringProperty, UnionProperty, @@ -127,6 +128,21 @@ def _factory(**kwargs): return _factory +@pytest.fixture +def none_property_factory() -> Callable[..., NoneProperty]: + """ + This fixture surfaces in the test as a function which manufactures StringProperties with defaults. + + You can pass the same params into this as the StringProperty constructor to override defaults. + """ + + def _factory(**kwargs): + kwargs = _common_kwargs(kwargs) + return NoneProperty(**kwargs) + + return _factory + + @pytest.fixture def date_time_property_factory() -> Callable[..., DateTimeProperty]: """ @@ -212,8 +228,8 @@ def _common_kwargs(kwargs: Dict[str, Any]) -> Dict[str, Any]: "required": True, "nullable": False, "default": None, - "description": "", - "example": "", + "description": None, + "example": None, **kwargs, } if not kwargs.get("python_name"): diff --git a/tests/test_parser/test_openapi.py b/tests/test_parser/test_openapi.py index fc5824201..53d96596a 100644 --- a/tests/test_parser/test_openapi.py +++ b/tests/test_parser/test_openapi.py @@ -427,9 +427,8 @@ def test__add_responses_error(self, mocker): ), ] - def test__add_responses(self, mocker): + def test__add_responses(self, mocker, date_time_property_factory, date_property_factory): from openapi_python_client.parser.openapi import Endpoint, Response - from openapi_python_client.parser.properties import DateProperty, DateTimeProperty response_1_data = mocker.MagicMock() response_2_data = mocker.MagicMock() @@ -444,12 +443,12 @@ def test__add_responses(self, mocker): response_1 = Response( status_code=200, source="source", - prop=DateTimeProperty(name="datetime", required=True, nullable=False, default=None, python_name="datetime"), + prop=date_time_property_factory(name="datetime"), ) response_2 = Response( status_code=404, source="source", - prop=DateProperty(name="date", required=True, nullable=False, default=None, python_name="date"), + prop=date_property_factory(name="date"), ) response_from_data = mocker.patch( f"{MODULE_NAME}.response_from_data", side_effect=[(response_1, schemas_1), (response_2, schemas_2)] @@ -532,23 +531,21 @@ def test_validation_error_when_location_not_supported(self, mocker): with pytest.raises(pydantic.ValidationError): oai.Parameter(name="test", required=True, param_schema=mocker.MagicMock(), param_in="error_location") - def test__add_parameters_with_location_postfix_conflict1(self, mocker): + def test__add_parameters_with_location_postfix_conflict1(self, mocker, property_factory): """Checks when the PythonIdentifier of new parameter already used.""" from openapi_python_client.parser.openapi import Endpoint from openapi_python_client.parser.properties import Property endpoint = self.make_endpoint() - path_prop_conflicted = Property( - name="prop_name_path", required=False, nullable=False, default=None, python_name="prop_name_path" - ) - query_prop = Property(name="prop_name", required=False, nullable=False, default=None, python_name="prop_name") - path_prop = Property(name="prop_name", required=False, nullable=False, default=None, python_name="prop_name") + path_prop_conflicted = property_factory(name="prop_name_path", required=False, nullable=False, default=None) + query_prop = property_factory(name="prop_name", required=False, nullable=False, default=None) + path_prop = property_factory(name="prop_name", required=False, nullable=False, default=None) schemas_1 = mocker.MagicMock() schemas_2 = mocker.MagicMock() schemas_3 = mocker.MagicMock() - property_from_data = mocker.patch( + mocker.patch( f"{MODULE_NAME}.property_from_data", side_effect=[ (path_prop_conflicted, schemas_1), @@ -580,17 +577,14 @@ def test__add_parameters_with_location_postfix_conflict1(self, mocker): assert isinstance(result, ParseError) assert result.detail == "Parameters with same Python identifier `prop_name_path` detected" - def test__add_parameters_with_location_postfix_conflict2(self, mocker): + def test__add_parameters_with_location_postfix_conflict2(self, mocker, property_factory): """Checks when an existing parameter has a conflicting PythonIdentifier after renaming.""" from openapi_python_client.parser.openapi import Endpoint - from openapi_python_client.parser.properties import Property endpoint = self.make_endpoint() - path_prop_conflicted = Property( - name="prop_name_path", required=False, nullable=False, default=None, python_name="prop_name_path" - ) - path_prop = Property(name="prop_name", required=False, nullable=False, default=None, python_name="prop_name") - query_prop = Property(name="prop_name", required=False, nullable=False, default=None, python_name="prop_name") + path_prop_conflicted = property_factory(name="prop_name_path", required=False, nullable=False, default=None) + path_prop = property_factory(name="prop_name", required=False, nullable=False, default=None) + query_prop = property_factory(name="prop_name", required=False, nullable=False, default=None) schemas_1 = mocker.MagicMock() schemas_2 = mocker.MagicMock() schemas_3 = mocker.MagicMock() diff --git a/tests/test_parser/test_properties/test_init.py b/tests/test_parser/test_properties/test_init.py index 91f85435b..3d2de6519 100644 --- a/tests/test_parser/test_properties/test_init.py +++ b/tests/test_parser/test_properties/test_init.py @@ -1,3 +1,4 @@ +from typing import Type from unittest.mock import MagicMock, call import attr @@ -6,7 +7,14 @@ import openapi_python_client.schema as oai from openapi_python_client import Config from openapi_python_client.parser.errors import PropertyError, ValidationError -from openapi_python_client.parser.properties import BooleanProperty, FloatProperty, IntProperty, NoneProperty, Schemas +from openapi_python_client.parser.properties import ( + BooleanProperty, + FloatProperty, + IntProperty, + NoneProperty, + Property, + Schemas, +) MODULE_NAME = "openapi_python_client.parser.properties" @@ -336,7 +344,7 @@ def test_property_from_data_str_enum_with_null(self, enum_property_factory): "ParentAnEnum": prop, } - def test_property_from_data_null_enum(self, enum_property_factory): + def test_property_from_data_null_enum(self, enum_property_factory, none_property_factory): from openapi_python_client.parser.properties import Class, Schemas, property_from_data from openapi_python_client.schema import Schema @@ -350,9 +358,7 @@ def test_property_from_data_null_enum(self, enum_property_factory): name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=Config() ) - assert prop == NoneProperty( - name="my_enum", required=required, nullable=False, default="None", python_name="my_enum" - ) + assert prop == none_property_factory(name="my_enum", required=required, nullable=False, default="None") def test_property_from_data_int_enum(self, enum_property_factory): from openapi_python_client.parser.properties import Class, Schemas, property_from_data @@ -527,12 +533,14 @@ def test_property_from_data_invalid_ref(self, mocker): ("boolean", BooleanProperty, bool), ], ) - def test_property_from_data_simple_types(self, openapi_type, prop_type, python_type): + def test_property_from_data_simple_types(self, openapi_type: str, prop_type: Type[Property], python_type): from openapi_python_client.parser.properties import Schemas, property_from_data name = "test_prop" required = True - data = oai.Schema.construct(type=openapi_type, default=1) + description = "a description" + example = "an example" + data = oai.Schema.construct(type=openapi_type, default=1, description=description, example=example) schemas = Schemas() p, new_schemas = property_from_data( @@ -540,7 +548,13 @@ def test_property_from_data_simple_types(self, openapi_type, prop_type, python_t ) assert p == prop_type( - name=name, required=required, default=python_type(data.default), nullable=False, python_name=name + name=name, + required=required, + default=python_type(data.default), + nullable=False, + python_name=name, + description=description, + example=example, ) assert new_schemas == schemas @@ -552,7 +566,13 @@ def test_property_from_data_simple_types(self, openapi_type, prop_type, python_t name=name, required=required, data=data, schemas=schemas, parent_name="parent", config=MagicMock() ) assert p == prop_type( - name=name, required=required, default=python_type(data.default), nullable=True, python_name=name + name=name, + required=required, + default=python_type(data.default), + nullable=True, + python_name=name, + description=description, + example=example, ) # Test bad default value @@ -655,8 +675,8 @@ def test_property_from_data_union_of_one_element(self, mocker, model_property_fa assert prop == attr.evolve(existing_model, name=name, required=required, nullable=nullable, python_name=name) build_union_property.assert_not_called() - def test_property_from_data_no_valid_props_in_data(self): - from openapi_python_client.parser.properties import AnyProperty, Schemas, property_from_data + def test_property_from_data_no_valid_props_in_data(self, any_property_factory): + from openapi_python_client.parser.properties import Schemas, property_from_data schemas = Schemas() data = oai.Schema() @@ -666,7 +686,7 @@ def test_property_from_data_no_valid_props_in_data(self): name=name, required=True, data=data, schemas=schemas, parent_name="parent", config=MagicMock() ) - assert prop == AnyProperty(name=name, required=True, nullable=False, default=None, python_name=name) + assert prop == any_property_factory(name=name, required=True, nullable=False, default=None) assert new_schemas == schemas def test_property_from_data_validation_error(self, mocker): diff --git a/tests/test_parser/test_properties/test_model_property.py b/tests/test_parser/test_properties/test_model_property.py index 7d66e7ddc..7b96cb687 100644 --- a/tests/test_parser/test_properties/test_model_property.py +++ b/tests/test_parser/test_properties/test_model_property.py @@ -61,8 +61,8 @@ class TestBuildModelProperty: nullable=False, default=None, python_name="additional_property", - description="", - example="", + description=None, + example=None, ), ), ], diff --git a/tests/test_parser/test_responses.py b/tests/test_parser/test_responses.py index 547e2f7a3..35d6bab13 100644 --- a/tests/test_parser/test_responses.py +++ b/tests/test_parser/test_responses.py @@ -7,7 +7,7 @@ MODULE_NAME = "openapi_python_client.parser.responses" -def test_response_from_data_no_content(): +def test_response_from_data_no_content(any_property_factory): from openapi_python_client.parser.responses import Response, response_from_data response, schemas = response_from_data( @@ -20,14 +20,12 @@ def test_response_from_data_no_content(): assert response == Response( status_code=200, - prop=AnyProperty( + prop=any_property_factory( name="response_200", default=None, nullable=False, required=True, - python_name="response_200", description="", - example="", ), source="None", ) @@ -44,7 +42,7 @@ def test_response_from_data_unsupported_content_type(): assert response == ParseError(data=data, detail="Unsupported content_type {'blah': None}") -def test_response_from_data_no_content_schema(): +def test_response_from_data_no_content_schema(any_property_factory): from openapi_python_client.parser.responses import Response, response_from_data data = oai.Response.construct(description="", content={"application/json": oai.MediaType.construct()}) @@ -54,14 +52,12 @@ def test_response_from_data_no_content_schema(): assert response == Response( status_code=200, - prop=AnyProperty( + prop=any_property_factory( name="response_200", default=None, nullable=False, required=True, - python_name="response_200", description=data.description, - example=data.example, ), source="None", ) From c2fe67f831541c3e3683d0c8cb6d8d93e6ed5cbc Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 18:57:42 -0700 Subject: [PATCH 11/18] style: Swap around a bunch of spacing in docstrings to get close to handwritten style. --- .../api/parameters/__init__.py | 3 + .../api/default/get_common_parameters.py | 8 +- .../api/default/post_common_parameters.py | 8 +- .../get_location_query_optionality.py | 20 ++-- ...lete_common_parameters_overriding_param.py | 10 +- .../get_common_parameters_overriding_param.py | 14 ++- .../get_same_name_multiple_locations_param.py | 18 ++- .../parameters/multiple_path_parameters.py | 14 ++- .../api/tag1/get_tag_with_number.py | 6 - .../api/tests/defaults_tests_defaults_post.py | 108 ++++++++---------- .../api/tests/get_basic_list_of_booleans.py | 24 ++-- .../api/tests/get_basic_list_of_floats.py | 24 ++-- .../api/tests/get_basic_list_of_integers.py | 24 ++-- .../api/tests/get_basic_list_of_strings.py | 24 ++-- .../api/tests/get_user_list.py | 52 ++++----- .../api/tests/int_enum_tests_int_enum_post.py | 28 ++--- .../tests/json_body_tests_json_body_post.py | 24 ++-- .../no_response_tests_no_response_get.py | 12 +- .../octet_stream_tests_octet_stream_get.py | 24 +--- .../api/tests/post_form_data.py | 12 +- .../api/tests/post_tests_json_body_string.py | 24 +--- .../api/tests/test_inline_objects.py | 24 +--- ..._with_cookie_auth_token_with_cookie_get.py | 14 +-- ...d_content_tests_unsupported_content_get.py | 12 +- .../tests/upload_file_tests_upload_post.py | 28 ++--- ...upload_multiple_files_tests_upload_post.py | 28 ++--- .../my_test_api_client/api/true_/false_.py | 8 +- end_to_end_tests/openapi.json | 2 +- .../templates/endpoint_macros.py.jinja | 25 ++-- 29 files changed, 233 insertions(+), 389 deletions(-) diff --git a/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/parameters/__init__.py b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/parameters/__init__.py index 26e6450c7..7bf263058 100644 --- a/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/parameters/__init__.py +++ b/end_to_end_tests/custom-templates-golden-record/my_test_api_client/api/parameters/__init__.py @@ -13,6 +13,9 @@ class ParametersEndpoints: @classmethod def get_common_parameters_overriding_param(cls) -> types.ModuleType: + """ + Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code + """ return get_common_parameters_overriding_param @classmethod diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py index cc66feaed..718582daf 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py @@ -45,10 +45,8 @@ def sync_detailed( common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: """ - - Args: - common (Union[Unset, None, str]): None: + common (Union[Unset, None, str]): None Returns: Response[Any] @@ -73,10 +71,8 @@ async def asyncio_detailed( common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: """ - - Args: - common (Union[Unset, None, str]): None: + common (Union[Unset, None, str]): None Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py index b5189234a..a7b10b78a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py @@ -45,10 +45,8 @@ def sync_detailed( common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: """ - - Args: - common (Union[Unset, None, str]): None: + common (Union[Unset, None, str]): None Returns: Response[Any] @@ -73,10 +71,8 @@ async def asyncio_detailed( common: Union[Unset, None, str] = UNSET, ) -> Response[Any]: """ - - Args: - common (Union[Unset, None, str]): None: + common (Union[Unset, None, str]): None Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py index fe3c70a01..d8cd2720f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py @@ -69,13 +69,11 @@ def sync_detailed( not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET, ) -> Response[Any]: """ - - Args: - not_null_required (datetime.datetime): None: - null_required (Union[Unset, None, datetime.datetime]): None: - null_not_required (Union[Unset, None, datetime.datetime]): None: - not_null_not_required (Union[Unset, None, datetime.datetime]): None: + not_null_required (datetime.datetime): None + null_required (Union[Unset, None, datetime.datetime]): None + null_not_required (Union[Unset, None, datetime.datetime]): None + not_null_not_required (Union[Unset, None, datetime.datetime]): None Returns: Response[Any] @@ -106,13 +104,11 @@ async def asyncio_detailed( not_null_not_required: Union[Unset, None, datetime.datetime] = UNSET, ) -> Response[Any]: """ - - Args: - not_null_required (datetime.datetime): None: - null_required (Union[Unset, None, datetime.datetime]): None: - null_not_required (Union[Unset, None, datetime.datetime]): None: - not_null_not_required (Union[Unset, None, datetime.datetime]): None: + not_null_required (datetime.datetime): None + null_required (Union[Unset, None, datetime.datetime]): None + null_not_required (Union[Unset, None, datetime.datetime]): None + not_null_not_required (Union[Unset, None, datetime.datetime]): None Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index 80212931c..15bd31c08 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -47,10 +47,9 @@ def sync_detailed( param_query: Union[Unset, None, str] = UNSET, ) -> Response[Any]: """ - - Args: - param_query (Union[Unset, None, str]): None: + param_path (str): None + param_query (Union[Unset, None, str]): None Returns: Response[Any] @@ -77,10 +76,9 @@ async def asyncio_detailed( param_query: Union[Unset, None, str] = UNSET, ) -> Response[Any]: """ - - Args: - param_query (Union[Unset, None, str]): None: + param_path (str): None + param_query (Union[Unset, None, str]): None Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index 95c524e90..db77a16b2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -46,11 +46,12 @@ def sync_detailed( client: Client, param_query: str = "overriden_in_GET", ) -> Response[Any]: - """ - + """Test that if you have an overriding property from `PathItem` in `Operation`, + it produces valid code Args: - param_query (str): None|default: 'overriden_in_GET': + param_path (str): None + param_query (str): None|default: 'overriden_in_GET' Returns: Response[Any] @@ -76,11 +77,12 @@ async def asyncio_detailed( client: Client, param_query: str = "overriden_in_GET", ) -> Response[Any]: - """ - + """Test that if you have an overriding property from `PathItem` in `Operation`, + it produces valid code Args: - param_query (str): None|default: 'overriden_in_GET': + param_path (str): None + param_query (str): None|default: 'overriden_in_GET' Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index 6a5ce85c1..04619562e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -57,12 +57,11 @@ def sync_detailed( param_cookie: Union[Unset, str] = UNSET, ) -> Response[Any]: """ - - Args: - param_query (Union[Unset, None, str]): None: - param_header (Union[Unset, str]): None, - param_cookie (Union[Unset, str]): None, + param_path (str): None + param_query (Union[Unset, None, str]): None + param_header (Union[Unset, str]): None + param_cookie (Union[Unset, str]): None Returns: Response[Any] @@ -93,12 +92,11 @@ async def asyncio_detailed( param_cookie: Union[Unset, str] = UNSET, ) -> Response[Any]: """ - - Args: - param_query (Union[Unset, None, str]): None: - param_header (Union[Unset, str]): None, - param_cookie (Union[Unset, str]): None, + param_path (str): None + param_query (Union[Unset, None, str]): None + param_header (Union[Unset, str]): None + param_cookie (Union[Unset, str]): None Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py index 058f2eec0..9f5bcf46e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -47,8 +47,11 @@ def sync_detailed( client: Client, ) -> Response[Any]: """ - - + Args: + param4 (str): None + param2 (int): None + param1 (str): None + param3 (int): None Returns: Response[Any] @@ -79,8 +82,11 @@ async def asyncio_detailed( client: Client, ) -> Response[Any]: """ - - + Args: + param4 (str): None + param2 (int): None + param1 (str): None + param3 (int): None Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py index e426dcc75..c3e429627 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py @@ -37,9 +37,6 @@ def sync_detailed( client: Client, ) -> Response[Any]: """ - - - Returns: Response[Any] """ @@ -61,9 +58,6 @@ async def asyncio_detailed( client: Client, ) -> Response[Any]: """ - - - Returns: Response[Any] """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py index c9e434732..20cb3379d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py @@ -119,23 +119,20 @@ def sync_detailed( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Defaults - - + """Defaults Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : + string_prop (str): None|default: 'the default string' + date_prop (datetime.date): None|default: isoparse('1010-10-10').date() + float_prop (float): None|default: 3.14 + int_prop (int): None|default: 7 + boolean_prop (bool): None + list_prop (List[AnEnum]): None + union_prop (Union[float, str]): None|default: 'not a float' + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + enum_prop (AnEnum): For testing Enums in all the ways they can be used + model_prop (ModelWithUnionProperty): + required_model_prop (ModelWithUnionProperty): Returns: Response[Union[Any, HTTPValidationError]] @@ -179,23 +176,20 @@ def sync( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Defaults - - + """Defaults Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : + string_prop (str): None|default: 'the default string' + date_prop (datetime.date): None|default: isoparse('1010-10-10').date() + float_prop (float): None|default: 3.14 + int_prop (int): None|default: 7 + boolean_prop (bool): None + list_prop (List[AnEnum]): None + union_prop (Union[float, str]): None|default: 'not a float' + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + enum_prop (AnEnum): For testing Enums in all the ways they can be used + model_prop (ModelWithUnionProperty): + required_model_prop (ModelWithUnionProperty): Returns: Response[Union[Any, HTTPValidationError]] @@ -232,23 +226,20 @@ async def asyncio_detailed( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Defaults - - + """Defaults Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : + string_prop (str): None|default: 'the default string' + date_prop (datetime.date): None|default: isoparse('1010-10-10').date() + float_prop (float): None|default: 3.14 + int_prop (int): None|default: 7 + boolean_prop (bool): None + list_prop (List[AnEnum]): None + union_prop (Union[float, str]): None|default: 'not a float' + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + enum_prop (AnEnum): For testing Enums in all the ways they can be used + model_prop (ModelWithUnionProperty): + required_model_prop (ModelWithUnionProperty): Returns: Response[Union[Any, HTTPValidationError]] @@ -290,23 +281,20 @@ async def asyncio( model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Defaults - - + """Defaults Args: - string_prop (str): None|default: 'the default string': - date_prop (datetime.date): None|default: isoparse('1010-10-10').date(): - float_prop (float): None|default: 3.14: - int_prop (int): None|default: 7: - boolean_prop (bool): None: - list_prop (List[AnEnum]): None: - union_prop (Union[float, str]): None|default: 'not a float': - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6: - enum_prop (AnEnum): For testing Enums in all the ways they can be used : - model_prop (ModelWithUnionProperty): : - required_model_prop (ModelWithUnionProperty): : + string_prop (str): None|default: 'the default string' + date_prop (datetime.date): None|default: isoparse('1010-10-10').date() + float_prop (float): None|default: 3.14 + int_prop (int): None|default: 7 + boolean_prop (bool): None + list_prop (List[AnEnum]): None + union_prop (Union[float, str]): None|default: 'not a float' + union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + enum_prop (AnEnum): For testing Enums in all the ways they can be used + model_prop (ModelWithUnionProperty): + required_model_prop (ModelWithUnionProperty): Returns: Response[Union[Any, HTTPValidationError]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py index 280f9ec0a..0b903c8bf 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py @@ -44,11 +44,9 @@ def sync_detailed( *, client: Client, ) -> Response[List[bool]]: - """ - Get Basic List Of Booleans - - Get a list of booleans + """Get Basic List Of Booleans + Get a list of booleans Returns: Response[List[bool]] @@ -70,11 +68,9 @@ def sync( *, client: Client, ) -> Optional[List[bool]]: - """ - Get Basic List Of Booleans - - Get a list of booleans + """Get Basic List Of Booleans + Get a list of booleans Returns: Response[List[bool]] @@ -89,11 +85,9 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[bool]]: - """ - Get Basic List Of Booleans - - Get a list of booleans + """Get Basic List Of Booleans + Get a list of booleans Returns: Response[List[bool]] @@ -113,11 +107,9 @@ async def asyncio( *, client: Client, ) -> Optional[List[bool]]: - """ - Get Basic List Of Booleans - - Get a list of booleans + """Get Basic List Of Booleans + Get a list of booleans Returns: Response[List[bool]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py index d57bd5dcb..5b401c1c9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py @@ -44,11 +44,9 @@ def sync_detailed( *, client: Client, ) -> Response[List[float]]: - """ - Get Basic List Of Floats - - Get a list of floats + """Get Basic List Of Floats + Get a list of floats Returns: Response[List[float]] @@ -70,11 +68,9 @@ def sync( *, client: Client, ) -> Optional[List[float]]: - """ - Get Basic List Of Floats - - Get a list of floats + """Get Basic List Of Floats + Get a list of floats Returns: Response[List[float]] @@ -89,11 +85,9 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[float]]: - """ - Get Basic List Of Floats - - Get a list of floats + """Get Basic List Of Floats + Get a list of floats Returns: Response[List[float]] @@ -113,11 +107,9 @@ async def asyncio( *, client: Client, ) -> Optional[List[float]]: - """ - Get Basic List Of Floats - - Get a list of floats + """Get Basic List Of Floats + Get a list of floats Returns: Response[List[float]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py index 5e6d4a350..6b229d1a5 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py @@ -44,11 +44,9 @@ def sync_detailed( *, client: Client, ) -> Response[List[int]]: - """ - Get Basic List Of Integers - - Get a list of integers + """Get Basic List Of Integers + Get a list of integers Returns: Response[List[int]] @@ -70,11 +68,9 @@ def sync( *, client: Client, ) -> Optional[List[int]]: - """ - Get Basic List Of Integers - - Get a list of integers + """Get Basic List Of Integers + Get a list of integers Returns: Response[List[int]] @@ -89,11 +85,9 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[int]]: - """ - Get Basic List Of Integers - - Get a list of integers + """Get Basic List Of Integers + Get a list of integers Returns: Response[List[int]] @@ -113,11 +107,9 @@ async def asyncio( *, client: Client, ) -> Optional[List[int]]: - """ - Get Basic List Of Integers - - Get a list of integers + """Get Basic List Of Integers + Get a list of integers Returns: Response[List[int]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py index 5eefed4a0..e42f0849a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py @@ -44,11 +44,9 @@ def sync_detailed( *, client: Client, ) -> Response[List[str]]: - """ - Get Basic List Of Strings - - Get a list of strings + """Get Basic List Of Strings + Get a list of strings Returns: Response[List[str]] @@ -70,11 +68,9 @@ def sync( *, client: Client, ) -> Optional[List[str]]: - """ - Get Basic List Of Strings - - Get a list of strings + """Get Basic List Of Strings + Get a list of strings Returns: Response[List[str]] @@ -89,11 +85,9 @@ async def asyncio_detailed( *, client: Client, ) -> Response[List[str]]: - """ - Get Basic List Of Strings - - Get a list of strings + """Get Basic List Of Strings + Get a list of strings Returns: Response[List[str]] @@ -113,11 +107,9 @@ async def asyncio( *, client: Client, ) -> Optional[List[str]]: - """ - Get Basic List Of Strings - - Get a list of strings + """Get Basic List Of Strings + Get a list of strings Returns: Response[List[str]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py index e4187f451..c0b4fc58c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py @@ -100,16 +100,15 @@ def sync_detailed( an_enum_value_with_only_null: List[None], some_date: Union[datetime.date, datetime.datetime], ) -> Response[Union[HTTPValidationError, List[AModel]]]: - """ - Get List + """Get List - Get a list of things + Get a list of things Args: - an_enum_value (List[AnEnum]): None: - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: - an_enum_value_with_only_null (List[None]): None: - some_date (Union[datetime.date, datetime.datetime]): None: + an_enum_value (List[AnEnum]): None + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None + an_enum_value_with_only_null (List[None]): None + some_date (Union[datetime.date, datetime.datetime]): None Returns: Response[Union[HTTPValidationError, List[AModel]]] @@ -139,16 +138,15 @@ def sync( an_enum_value_with_only_null: List[None], some_date: Union[datetime.date, datetime.datetime], ) -> Optional[Union[HTTPValidationError, List[AModel]]]: - """ - Get List + """Get List - Get a list of things + Get a list of things Args: - an_enum_value (List[AnEnum]): None: - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: - an_enum_value_with_only_null (List[None]): None: - some_date (Union[datetime.date, datetime.datetime]): None: + an_enum_value (List[AnEnum]): None + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None + an_enum_value_with_only_null (List[None]): None + some_date (Union[datetime.date, datetime.datetime]): None Returns: Response[Union[HTTPValidationError, List[AModel]]] @@ -171,16 +169,15 @@ async def asyncio_detailed( an_enum_value_with_only_null: List[None], some_date: Union[datetime.date, datetime.datetime], ) -> Response[Union[HTTPValidationError, List[AModel]]]: - """ - Get List + """Get List - Get a list of things + Get a list of things Args: - an_enum_value (List[AnEnum]): None: - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: - an_enum_value_with_only_null (List[None]): None: - some_date (Union[datetime.date, datetime.datetime]): None: + an_enum_value (List[AnEnum]): None + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None + an_enum_value_with_only_null (List[None]): None + some_date (Union[datetime.date, datetime.datetime]): None Returns: Response[Union[HTTPValidationError, List[AModel]]] @@ -208,16 +205,15 @@ async def asyncio( an_enum_value_with_only_null: List[None], some_date: Union[datetime.date, datetime.datetime], ) -> Optional[Union[HTTPValidationError, List[AModel]]]: - """ - Get List + """Get List - Get a list of things + Get a list of things Args: - an_enum_value (List[AnEnum]): None: - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None: - an_enum_value_with_only_null (List[None]): None: - some_date (Union[datetime.date, datetime.datetime]): None: + an_enum_value (List[AnEnum]): None + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None + an_enum_value_with_only_null (List[None]): None + some_date (Union[datetime.date, datetime.datetime]): None Returns: Response[Union[HTTPValidationError, List[AModel]]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py index 2209ad710..59ee29ab6 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py @@ -60,13 +60,10 @@ def sync_detailed( client: Client, int_enum: AnIntEnum, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Int Enum - - + """Int Enum Args: - int_enum (AnIntEnum): An enumeration.: + int_enum (AnIntEnum): An enumeration. Returns: Response[Union[Any, HTTPValidationError]] @@ -90,13 +87,10 @@ def sync( client: Client, int_enum: AnIntEnum, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Int Enum - - + """Int Enum Args: - int_enum (AnIntEnum): An enumeration.: + int_enum (AnIntEnum): An enumeration. Returns: Response[Union[Any, HTTPValidationError]] @@ -113,13 +107,10 @@ async def asyncio_detailed( client: Client, int_enum: AnIntEnum, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Int Enum - - + """Int Enum Args: - int_enum (AnIntEnum): An enumeration.: + int_enum (AnIntEnum): An enumeration. Returns: Response[Union[Any, HTTPValidationError]] @@ -141,13 +132,10 @@ async def asyncio( client: Client, int_enum: AnIntEnum, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Int Enum - - + """Int Enum Args: - int_enum (AnIntEnum): An enumeration.: + int_enum (AnIntEnum): An enumeration. Returns: Response[Union[Any, HTTPValidationError]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py index cbfa4cbaa..8d714ae18 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -55,11 +55,9 @@ def sync_detailed( client: Client, json_body: AModel, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Json Body - - Try sending a JSON body + """Json Body + Try sending a JSON body Returns: Response[Union[Any, HTTPValidationError]] @@ -83,11 +81,9 @@ def sync( client: Client, json_body: AModel, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Json Body - - Try sending a JSON body + """Json Body + Try sending a JSON body Returns: Response[Union[Any, HTTPValidationError]] @@ -104,11 +100,9 @@ async def asyncio_detailed( client: Client, json_body: AModel, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Json Body - - Try sending a JSON body + """Json Body + Try sending a JSON body Returns: Response[Union[Any, HTTPValidationError]] @@ -130,11 +124,9 @@ async def asyncio( client: Client, json_body: AModel, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Json Body - - Try sending a JSON body + """Json Body + Try sending a JSON body Returns: Response[Union[Any, HTTPValidationError]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py index ceaf9e57a..cce9dfb1e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py @@ -36,11 +36,7 @@ def sync_detailed( *, client: Client, ) -> Response[Any]: - """ - No Response - - - + """No Response Returns: Response[Any] @@ -62,11 +58,7 @@ async def asyncio_detailed( *, client: Client, ) -> Response[Any]: - """ - No Response - - - + """No Response Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py index 9cd15ed95..f8a18d050 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py @@ -45,11 +45,7 @@ def sync_detailed( *, client: Client, ) -> Response[File]: - """ - Octet Stream - - - + """Octet Stream Returns: Response[File] @@ -71,11 +67,7 @@ def sync( *, client: Client, ) -> Optional[File]: - """ - Octet Stream - - - + """Octet Stream Returns: Response[File] @@ -90,11 +82,7 @@ async def asyncio_detailed( *, client: Client, ) -> Response[File]: - """ - Octet Stream - - - + """Octet Stream Returns: Response[File] @@ -114,11 +102,7 @@ async def asyncio( *, client: Client, ) -> Optional[File]: - """ - Octet Stream - - - + """Octet Stream Returns: Response[File] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py index 84152ccec..f7fa6adce 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py @@ -40,11 +40,9 @@ def sync_detailed( client: Client, form_data: AFormData, ) -> Response[Any]: - """ - Post from data - - Post form data + """Post from data + Post form data Returns: Response[Any] @@ -68,11 +66,9 @@ async def asyncio_detailed( client: Client, form_data: AFormData, ) -> Response[Any]: - """ - Post from data - - Post form data + """Post from data + Post form data Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py index c4c0ad84e..9549434eb 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py @@ -53,11 +53,7 @@ def sync_detailed( client: Client, json_body: str, ) -> Response[Union[HTTPValidationError, str]]: - """ - Json Body Which is String - - - + """Json Body Which is String Returns: Response[Union[HTTPValidationError, str]] @@ -81,11 +77,7 @@ def sync( client: Client, json_body: str, ) -> Optional[Union[HTTPValidationError, str]]: - """ - Json Body Which is String - - - + """Json Body Which is String Returns: Response[Union[HTTPValidationError, str]] @@ -102,11 +94,7 @@ async def asyncio_detailed( client: Client, json_body: str, ) -> Response[Union[HTTPValidationError, str]]: - """ - Json Body Which is String - - - + """Json Body Which is String Returns: Response[Union[HTTPValidationError, str]] @@ -128,11 +116,7 @@ async def asyncio( client: Client, json_body: str, ) -> Optional[Union[HTTPValidationError, str]]: - """ - Json Body Which is String - - - + """Json Body Which is String Returns: Response[Union[HTTPValidationError, str]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py index 94bac7eed..c4c5380d8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py @@ -51,11 +51,7 @@ def sync_detailed( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Response[TestInlineObjectsResponse200]: - """ - Test Inline Objects - - - + """Test Inline Objects Returns: Response[TestInlineObjectsResponse200] @@ -79,11 +75,7 @@ def sync( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Optional[TestInlineObjectsResponse200]: - """ - Test Inline Objects - - - + """Test Inline Objects Returns: Response[TestInlineObjectsResponse200] @@ -100,11 +92,7 @@ async def asyncio_detailed( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Response[TestInlineObjectsResponse200]: - """ - Test Inline Objects - - - + """Test Inline Objects Returns: Response[TestInlineObjectsResponse200] @@ -126,11 +114,7 @@ async def asyncio( client: Client, json_body: TestInlineObjectsJsonBody, ) -> Optional[TestInlineObjectsResponse200]: - """ - Test Inline Objects - - - + """Test Inline Objects Returns: Response[TestInlineObjectsResponse200] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index 605b09269..b46844072 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -40,13 +40,12 @@ def sync_detailed( client: Client, my_token: str, ) -> Response[Any]: - """ - TOKEN_WITH_COOKIE + """TOKEN_WITH_COOKIE - Test optional cookie parameters + Test optional cookie parameters Args: - my_token (str): None, + my_token (str): None Returns: Response[Any] @@ -70,13 +69,12 @@ async def asyncio_detailed( client: Client, my_token: str, ) -> Response[Any]: - """ - TOKEN_WITH_COOKIE + """TOKEN_WITH_COOKIE - Test optional cookie parameters + Test optional cookie parameters Args: - my_token (str): None, + my_token (str): None Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py index 39db731cf..29fc0f734 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py @@ -36,11 +36,7 @@ def sync_detailed( *, client: Client, ) -> Response[Any]: - """ - Unsupported Content - - - + """Unsupported Content Returns: Response[Any] @@ -62,11 +58,7 @@ async def asyncio_detailed( *, client: Client, ) -> Response[Any]: - """ - Unsupported Content - - - + """Unsupported Content Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py index ab2b0ec44..6d8dd270b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -60,13 +60,12 @@ def sync_detailed( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Upload File + """Upload File - Upload a file + Upload a file Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] @@ -92,13 +91,12 @@ def sync( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Upload File + """Upload File - Upload a file + Upload a file Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] @@ -117,13 +115,12 @@ async def asyncio_detailed( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Upload File + """Upload File - Upload a file + Upload a file Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] @@ -147,13 +144,12 @@ async def asyncio( multipart_data: BodyUploadFileTestsUploadPost, keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Upload File + """Upload File - Upload a file + Upload a file Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py index ccc159e1f..f9355f315 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py @@ -63,13 +63,12 @@ def sync_detailed( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Upload multiple files + """Upload multiple files - Upload several files in the same request + Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] @@ -95,13 +94,12 @@ def sync( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Upload multiple files + """Upload multiple files - Upload several files in the same request + Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] @@ -120,13 +118,12 @@ async def asyncio_detailed( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Response[Union[Any, HTTPValidationError]]: - """ - Upload multiple files + """Upload multiple files - Upload several files in the same request + Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] @@ -150,13 +147,12 @@ async def asyncio( multipart_data: List[File], keep_alive: Union[Unset, bool] = UNSET, ) -> Optional[Union[Any, HTTPValidationError]]: - """ - Upload multiple files + """Upload multiple files - Upload several files in the same request + Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None, + keep_alive (Union[Unset, bool]): None Returns: Response[Union[Any, HTTPValidationError]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py index a94d4cac2..d1872954e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py @@ -45,10 +45,8 @@ def sync_detailed( import_: str, ) -> Response[Any]: """ - - Args: - import_ (str): None: + import_ (str): None Returns: Response[Any] @@ -73,10 +71,8 @@ async def asyncio_detailed( import_: str, ) -> Response[Any]: """ - - Args: - import_ (str): None: + import_ (str): None Returns: Response[Any] diff --git a/end_to_end_tests/openapi.json b/end_to_end_tests/openapi.json index 46db24487..7c38ee0f3 100644 --- a/end_to_end_tests/openapi.json +++ b/end_to_end_tests/openapi.json @@ -793,8 +793,8 @@ } }, "/common_parameters_overriding/{param}": { - "description": "Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code", "get": { + "description": "Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code", "tags": [ "parameters" ], diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index fe293677e..6945abdbc 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -149,27 +149,32 @@ json_body=json_body, {% endmacro %} {% macro docstring(endpoint, return_string) %} -""" -{% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} +"""{% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} + +{% endif -%} +{%- if endpoint.description %} {{ endpoint.description | wordwrap(76) }} -{{ endpoint.description | wordwrap(76)}} -{% else %} -{{ endpoint.description | wordwrap(76)}} {% endif %} +{% if not endpoint.summary and not endpoint.description %} +{# Leave extra space so that Args or Returns isn't at the top #} -{% if endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} +{% endif %} +{% if endpoint.path_parameters or endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} Args: + {% for parameter in endpoint.path_parameters.values() %} + {{ parameter.to_docstring() }} + {% endfor %} {% for parameter in endpoint.query_parameters.values() %} - {{ parameter.to_docstring() }}: + {{ parameter.to_docstring() }} {% endfor %} {% for parameter in endpoint.header_parameters.values() %} - {{ parameter.to_docstring() }}, + {{ parameter.to_docstring() }} {% endfor %} {% for parameter in endpoint.cookie_parameters.values() %} - {{ parameter.to_docstring() }}, + {{ parameter.to_docstring() }} {% endfor %} -{% endif %} +{% endif %} Returns: Response[{{ return_string }}] """ From a5364c2b8ee73a2478df99a542318ee431465c12 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 19:14:29 -0700 Subject: [PATCH 12/18] style: Omit missing descriptions from endpoint parameter docstrings and restyle default & example strings. --- .../api/default/get_common_parameters.py | 4 +- .../api/default/post_common_parameters.py | 4 +- .../get_location_query_optionality.py | 16 ++--- ...lete_common_parameters_overriding_param.py | 8 +-- .../get_common_parameters_overriding_param.py | 16 +++-- .../get_same_name_multiple_locations_param.py | 16 ++--- .../parameters/multiple_path_parameters.py | 16 ++--- .../api/tests/defaults_tests_defaults_post.py | 68 ++++++++++--------- .../api/tests/get_user_list.py | 32 ++++----- ..._with_cookie_auth_token_with_cookie_get.py | 4 +- .../tests/upload_file_tests_upload_post.py | 12 ++-- ...upload_multiple_files_tests_upload_post.py | 12 ++-- .../my_test_api_client/api/true_/false_.py | 4 +- .../my_test_api_client/models/a_form_data.py | 4 +- .../my_test_api_client/models/a_model.py | 36 +++++----- ...roperties_reference_that_are_not_object.py | 58 ++++++++-------- .../models/all_of_sub_model.py | 6 +- .../models/another_all_of_sub_model.py | 6 +- .../body_upload_file_tests_upload_post.py | 10 +-- ...e_tests_upload_post_additional_property.py | 2 +- ..._tests_upload_post_some_nullable_object.py | 2 +- ...load_file_tests_upload_post_some_object.py | 4 +- ..._tests_upload_post_some_optional_object.py | 2 +- .../models/http_validation_error.py | 2 +- .../models/model_from_all_of.py | 8 +-- ...odel_with_additional_properties_inlined.py | 2 +- ..._properties_inlined_additional_property.py | 2 +- .../models/model_with_union_property.py | 2 +- .../model_with_union_property_inlined.py | 2 +- ...ith_union_property_inlined_fruit_type_0.py | 2 +- ...ith_union_property_inlined_fruit_type_1.py | 2 +- .../models/test_inline_objects_json_body.py | 2 +- .../test_inline_objects_response_200.py | 2 +- .../models/validation_error.py | 6 +- end_to_end_tests/openapi.json | 4 +- openapi_python_client/parser/openapi.py | 10 +++ .../parser/properties/property.py | 6 +- .../templates/endpoint_macros.py.jinja | 13 +--- 38 files changed, 212 insertions(+), 195 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py index 718582daf..f70f53d11 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py @@ -46,7 +46,7 @@ def sync_detailed( ) -> Response[Any]: """ Args: - common (Union[Unset, None, str]): None + common (Union[Unset, None, str]): Returns: Response[Any] @@ -72,7 +72,7 @@ async def asyncio_detailed( ) -> Response[Any]: """ Args: - common (Union[Unset, None, str]): None + common (Union[Unset, None, str]): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py index a7b10b78a..c395867d7 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py @@ -46,7 +46,7 @@ def sync_detailed( ) -> Response[Any]: """ Args: - common (Union[Unset, None, str]): None + common (Union[Unset, None, str]): Returns: Response[Any] @@ -72,7 +72,7 @@ async def asyncio_detailed( ) -> Response[Any]: """ Args: - common (Union[Unset, None, str]): None + common (Union[Unset, None, str]): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py index d8cd2720f..6bec8f41b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py @@ -70,10 +70,10 @@ def sync_detailed( ) -> Response[Any]: """ Args: - not_null_required (datetime.datetime): None - null_required (Union[Unset, None, datetime.datetime]): None - null_not_required (Union[Unset, None, datetime.datetime]): None - not_null_not_required (Union[Unset, None, datetime.datetime]): None + not_null_required (datetime.datetime): + null_required (Union[Unset, None, datetime.datetime]): + null_not_required (Union[Unset, None, datetime.datetime]): + not_null_not_required (Union[Unset, None, datetime.datetime]): Returns: Response[Any] @@ -105,10 +105,10 @@ async def asyncio_detailed( ) -> Response[Any]: """ Args: - not_null_required (datetime.datetime): None - null_required (Union[Unset, None, datetime.datetime]): None - null_not_required (Union[Unset, None, datetime.datetime]): None - not_null_not_required (Union[Unset, None, datetime.datetime]): None + not_null_required (datetime.datetime): + null_required (Union[Unset, None, datetime.datetime]): + null_not_required (Union[Unset, None, datetime.datetime]): + not_null_not_required (Union[Unset, None, datetime.datetime]): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index 15bd31c08..f2336cdea 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -48,8 +48,8 @@ def sync_detailed( ) -> Response[Any]: """ Args: - param_path (str): None - param_query (Union[Unset, None, str]): None + param_path (str): + param_query (Union[Unset, None, str]): Returns: Response[Any] @@ -77,8 +77,8 @@ async def asyncio_detailed( ) -> Response[Any]: """ Args: - param_path (str): None - param_query (Union[Unset, None, str]): None + param_path (str): + param_query (Union[Unset, None, str]): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index db77a16b2..e9dfb0d98 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -10,7 +10,7 @@ def _get_kwargs( param_path: str, *, client: Client, - param_query: str = "overriden_in_GET", + param_query: str = "overridden_in_GET", ) -> Dict[str, Any]: url = "{}/common_parameters_overriding/{param}".format(client.base_url, param=param_path) @@ -44,14 +44,15 @@ def sync_detailed( param_path: str, *, client: Client, - param_query: str = "overriden_in_GET", + param_query: str = "overridden_in_GET", ) -> Response[Any]: """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code Args: - param_path (str): None - param_query (str): None|default: 'overriden_in_GET' + param_path (str): + param_query (str): A parameter with the same name as another. Default: + 'overridden_in_GET'. Example: an example string. Returns: Response[Any] @@ -75,14 +76,15 @@ async def asyncio_detailed( param_path: str, *, client: Client, - param_query: str = "overriden_in_GET", + param_query: str = "overridden_in_GET", ) -> Response[Any]: """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code Args: - param_path (str): None - param_query (str): None|default: 'overriden_in_GET' + param_path (str): + param_query (str): A parameter with the same name as another. Default: + 'overridden_in_GET'. Example: an example string. Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index 04619562e..2e016adbf 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -58,10 +58,10 @@ def sync_detailed( ) -> Response[Any]: """ Args: - param_path (str): None - param_query (Union[Unset, None, str]): None - param_header (Union[Unset, str]): None - param_cookie (Union[Unset, str]): None + param_path (str): + param_query (Union[Unset, None, str]): + param_header (Union[Unset, str]): + param_cookie (Union[Unset, str]): Returns: Response[Any] @@ -93,10 +93,10 @@ async def asyncio_detailed( ) -> Response[Any]: """ Args: - param_path (str): None - param_query (Union[Unset, None, str]): None - param_header (Union[Unset, str]): None - param_cookie (Union[Unset, str]): None + param_path (str): + param_query (Union[Unset, None, str]): + param_header (Union[Unset, str]): + param_cookie (Union[Unset, str]): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py index 9f5bcf46e..cfa48f320 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -48,10 +48,10 @@ def sync_detailed( ) -> Response[Any]: """ Args: - param4 (str): None - param2 (int): None - param1 (str): None - param3 (int): None + param4 (str): + param2 (int): + param1 (str): + param3 (int): Returns: Response[Any] @@ -83,10 +83,10 @@ async def asyncio_detailed( ) -> Response[Any]: """ Args: - param4 (str): None - param2 (int): None - param1 (str): None - param3 (int): None + param4 (str): + param2 (int): + param1 (str): + param3 (int): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py index 20cb3379d..876660eec 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py @@ -122,14 +122,15 @@ def sync_detailed( """Defaults Args: - string_prop (str): None|default: 'the default string' - date_prop (datetime.date): None|default: isoparse('1010-10-10').date() - float_prop (float): None|default: 3.14 - int_prop (int): None|default: 7 - boolean_prop (bool): None - list_prop (List[AnEnum]): None - union_prop (Union[float, str]): None|default: 'not a float' - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + string_prop (str): Default: 'the default string'. + date_prop (datetime.date): Default: isoparse('1010-10-10').date(). + float_prop (float): Default: 3.14. + int_prop (int): Default: 7. + boolean_prop (bool): + list_prop (List[AnEnum]): + union_prop (Union[float, str]): Default: 'not a float'. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: + 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -179,14 +180,15 @@ def sync( """Defaults Args: - string_prop (str): None|default: 'the default string' - date_prop (datetime.date): None|default: isoparse('1010-10-10').date() - float_prop (float): None|default: 3.14 - int_prop (int): None|default: 7 - boolean_prop (bool): None - list_prop (List[AnEnum]): None - union_prop (Union[float, str]): None|default: 'not a float' - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + string_prop (str): Default: 'the default string'. + date_prop (datetime.date): Default: isoparse('1010-10-10').date(). + float_prop (float): Default: 3.14. + int_prop (int): Default: 7. + boolean_prop (bool): + list_prop (List[AnEnum]): + union_prop (Union[float, str]): Default: 'not a float'. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: + 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -229,14 +231,15 @@ async def asyncio_detailed( """Defaults Args: - string_prop (str): None|default: 'the default string' - date_prop (datetime.date): None|default: isoparse('1010-10-10').date() - float_prop (float): None|default: 3.14 - int_prop (int): None|default: 7 - boolean_prop (bool): None - list_prop (List[AnEnum]): None - union_prop (Union[float, str]): None|default: 'not a float' - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + string_prop (str): Default: 'the default string'. + date_prop (datetime.date): Default: isoparse('1010-10-10').date(). + float_prop (float): Default: 3.14. + int_prop (int): Default: 7. + boolean_prop (bool): + list_prop (List[AnEnum]): + union_prop (Union[float, str]): Default: 'not a float'. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: + 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -284,14 +287,15 @@ async def asyncio( """Defaults Args: - string_prop (str): None|default: 'the default string' - date_prop (datetime.date): None|default: isoparse('1010-10-10').date() - float_prop (float): None|default: 3.14 - int_prop (int): None|default: 7 - boolean_prop (bool): None - list_prop (List[AnEnum]): None - union_prop (Union[float, str]): None|default: 'not a float' - union_prop_with_ref (Union[AnEnum, None, Unset, float]): None|default: 0.6 + string_prop (str): Default: 'the default string'. + date_prop (datetime.date): Default: isoparse('1010-10-10').date(). + float_prop (float): Default: 3.14. + int_prop (int): Default: 7. + boolean_prop (bool): + list_prop (List[AnEnum]): + union_prop (Union[float, str]): Default: 'not a float'. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: + 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py index c0b4fc58c..d80c1917b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py @@ -105,10 +105,10 @@ def sync_detailed( Get a list of things Args: - an_enum_value (List[AnEnum]): None - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None - an_enum_value_with_only_null (List[None]): None - some_date (Union[datetime.date, datetime.datetime]): None + an_enum_value (List[AnEnum]): + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): + an_enum_value_with_only_null (List[None]): + some_date (Union[datetime.date, datetime.datetime]): Returns: Response[Union[HTTPValidationError, List[AModel]]] @@ -143,10 +143,10 @@ def sync( Get a list of things Args: - an_enum_value (List[AnEnum]): None - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None - an_enum_value_with_only_null (List[None]): None - some_date (Union[datetime.date, datetime.datetime]): None + an_enum_value (List[AnEnum]): + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): + an_enum_value_with_only_null (List[None]): + some_date (Union[datetime.date, datetime.datetime]): Returns: Response[Union[HTTPValidationError, List[AModel]]] @@ -174,10 +174,10 @@ async def asyncio_detailed( Get a list of things Args: - an_enum_value (List[AnEnum]): None - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None - an_enum_value_with_only_null (List[None]): None - some_date (Union[datetime.date, datetime.datetime]): None + an_enum_value (List[AnEnum]): + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): + an_enum_value_with_only_null (List[None]): + some_date (Union[datetime.date, datetime.datetime]): Returns: Response[Union[HTTPValidationError, List[AModel]]] @@ -210,10 +210,10 @@ async def asyncio( Get a list of things Args: - an_enum_value (List[AnEnum]): None - an_enum_value_with_null (List[Optional[AnEnumWithNull]]): None - an_enum_value_with_only_null (List[None]): None - some_date (Union[datetime.date, datetime.datetime]): None + an_enum_value (List[AnEnum]): + an_enum_value_with_null (List[Optional[AnEnumWithNull]]): + an_enum_value_with_only_null (List[None]): + some_date (Union[datetime.date, datetime.datetime]): Returns: Response[Union[HTTPValidationError, List[AModel]]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index b46844072..6cd6a559f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -45,7 +45,7 @@ def sync_detailed( Test optional cookie parameters Args: - my_token (str): None + my_token (str): Returns: Response[Any] @@ -74,7 +74,7 @@ async def asyncio_detailed( Test optional cookie parameters Args: - my_token (str): None + my_token (str): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py index 6d8dd270b..a3f4d03c7 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -65,7 +65,8 @@ def sync_detailed( Upload a file Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (BodyUploadFileTestsUploadPost): Returns: Response[Union[Any, HTTPValidationError]] @@ -96,7 +97,8 @@ def sync( Upload a file Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (BodyUploadFileTestsUploadPost): Returns: Response[Union[Any, HTTPValidationError]] @@ -120,7 +122,8 @@ async def asyncio_detailed( Upload a file Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (BodyUploadFileTestsUploadPost): Returns: Response[Union[Any, HTTPValidationError]] @@ -149,7 +152,8 @@ async def asyncio( Upload a file Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (BodyUploadFileTestsUploadPost): Returns: Response[Union[Any, HTTPValidationError]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py index f9355f315..553bc619a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py @@ -68,7 +68,8 @@ def sync_detailed( Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (List[File]): Returns: Response[Union[Any, HTTPValidationError]] @@ -99,7 +100,8 @@ def sync( Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (List[File]): Returns: Response[Union[Any, HTTPValidationError]] @@ -123,7 +125,8 @@ async def asyncio_detailed( Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (List[File]): Returns: Response[Union[Any, HTTPValidationError]] @@ -152,7 +155,8 @@ async def asyncio( Upload several files in the same request Args: - keep_alive (Union[Unset, bool]): None + keep_alive (Union[Unset, bool]): + multipart_data (List[File]): Returns: Response[Union[Any, HTTPValidationError]] diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py index d1872954e..6e897586b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py @@ -46,7 +46,7 @@ def sync_detailed( ) -> Response[Any]: """ Args: - import_ (str): None + import_ (str): Returns: Response[Any] @@ -72,7 +72,7 @@ async def asyncio_detailed( ) -> Response[Any]: """ Args: - import_ (str): None + import_ (str): Returns: Response[Any] diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py index 17ff2ec74..3a99c38bd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py @@ -13,8 +13,8 @@ class AFormData: Properties: - an_required_field (str): None - an_optional_field (Union[Unset, str]): None + an_required_field (str): + an_optional_field (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py index 0161116b5..0520b9e85 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py @@ -22,28 +22,28 @@ class AModel: Properties: an_enum_value (AnEnum): For testing Enums in all the ways they can be used - an_allof_enum_with_overridden_default (AnAllOfEnum): None|default: - AnAllOfEnum.OVERRIDDEN_DEFAULT - a_camel_date_time (Union[datetime.date, datetime.datetime]): None - a_date (datetime.date): None - required_not_nullable (str): None - one_of_models (Union[Any, FreeFormModel, ModelWithUnionProperty]): None + an_allof_enum_with_overridden_default (AnAllOfEnum): Default: + AnAllOfEnum.OVERRIDDEN_DEFAULT. + a_camel_date_time (Union[datetime.date, datetime.datetime]): + a_date (datetime.date): + required_not_nullable (str): + one_of_models (Union[Any, FreeFormModel, ModelWithUnionProperty]): model (ModelWithUnionProperty): - any_value (Union[Unset, Any]): None - an_optional_allof_enum (Union[Unset, AnAllOfEnum]): None - nested_list_of_enums (Union[Unset, List[List[DifferentEnum]]]): None - a_nullable_date (Optional[datetime.date]): None - a_not_required_date (Union[Unset, datetime.date]): None - attr_1_leading_digit (Union[Unset, str]): None - required_nullable (Optional[str]): None - not_required_nullable (Union[Unset, None, str]): None - not_required_not_nullable (Union[Unset, str]): None + any_value (Union[Unset, Any]): + an_optional_allof_enum (Union[Unset, AnAllOfEnum]): + nested_list_of_enums (Union[Unset, List[List[DifferentEnum]]]): + a_nullable_date (Optional[datetime.date]): + a_not_required_date (Union[Unset, datetime.date]): + attr_1_leading_digit (Union[Unset, str]): + required_nullable (Optional[str]): + not_required_nullable (Union[Unset, None, str]): + not_required_not_nullable (Union[Unset, str]): nullable_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, - None]): None + None]): not_required_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, - Unset]): None + Unset]): not_required_nullable_one_of_models (Union[FreeFormModel, - ModelWithUnionProperty, None, Unset, str]): None + ModelWithUnionProperty, None, Unset, str]): nullable_model (Optional[ModelWithUnionProperty]): not_required_model (Union[Unset, ModelWithUnionProperty]): not_required_nullable_model (Union[Unset, None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py index 423d420af..05007abcf 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py @@ -17,37 +17,37 @@ class AModelWithPropertiesReferenceThatAreNotObject: Properties: - enum_properties_ref (List[AnEnum]): None - str_properties_ref (List[str]): None - date_properties_ref (List[datetime.date]): None - datetime_properties_ref (List[datetime.datetime]): None - int32_properties_ref (List[int]): None - int64_properties_ref (List[int]): None - float_properties_ref (List[float]): None - double_properties_ref (List[float]): None - file_properties_ref (List[File]): None - bytestream_properties_ref (List[str]): None - enum_properties (List[AnEnum]): None - str_properties (List[str]): None - date_properties (List[datetime.date]): None - datetime_properties (List[datetime.datetime]): None - int32_properties (List[int]): None - int64_properties (List[int]): None - float_properties (List[float]): None - double_properties (List[float]): None - file_properties (List[File]): None - bytestream_properties (List[str]): None + enum_properties_ref (List[AnEnum]): + str_properties_ref (List[str]): + date_properties_ref (List[datetime.date]): + datetime_properties_ref (List[datetime.datetime]): + int32_properties_ref (List[int]): + int64_properties_ref (List[int]): + float_properties_ref (List[float]): + double_properties_ref (List[float]): + file_properties_ref (List[File]): + bytestream_properties_ref (List[str]): + enum_properties (List[AnEnum]): + str_properties (List[str]): + date_properties (List[datetime.date]): + datetime_properties (List[datetime.datetime]): + int32_properties (List[int]): + int64_properties (List[int]): + float_properties (List[float]): + double_properties (List[float]): + file_properties (List[File]): + bytestream_properties (List[str]): enum_property_ref (AnEnum): For testing Enums in all the ways they can be used - str_property_ref (str): None - date_property_ref (datetime.date): None - datetime_property_ref (datetime.datetime): None - int32_property_ref (int): None - int64_property_ref (int): None - float_property_ref (float): None - double_property_ref (float): None - file_property_ref (File): None - bytestream_property_ref (str): None + str_property_ref (str): + date_property_ref (datetime.date): + datetime_property_ref (datetime.datetime): + int32_property_ref (int): + int64_property_ref (int): + float_property_ref (float): + double_property_ref (float): + file_property_ref (File): + bytestream_property_ref (str): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py index d95154275..9f75e04c3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py @@ -14,9 +14,9 @@ class AllOfSubModel: Properties: - a_sub_property (Union[Unset, str]): None - type (Union[Unset, str]): None - type_enum (Union[Unset, AllOfSubModelTypeEnum]): None + a_sub_property (Union[Unset, str]): + type (Union[Unset, str]): + type_enum (Union[Unset, AllOfSubModelTypeEnum]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py index 4b3642bb9..aba4c7218 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py @@ -15,9 +15,9 @@ class AnotherAllOfSubModel: Properties: - another_sub_property (Union[Unset, str]): None - type (Union[Unset, AnotherAllOfSubModelType]): None - type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): None + another_sub_property (Union[Unset, str]): + type (Union[Unset, AnotherAllOfSubModelType]): + type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py index 585496f23..aa18af191 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py @@ -26,12 +26,12 @@ class BodyUploadFileTestsUploadPost: Properties: - some_file (File): None + some_file (File): some_object (BodyUploadFileTestsUploadPostSomeObject): - some_optional_file (Union[Unset, File]): None - some_string (Union[Unset, str]): None|default: 'some_default_string' - some_number (Union[Unset, float]): None - some_array (Union[Unset, List[float]]): None + some_optional_file (Union[Unset, File]): + some_string (Union[Unset, str]): Default: 'some_default_string'. + some_number (Union[Unset, float]): + some_array (Union[Unset, List[float]]): some_optional_object (Union[Unset, BodyUploadFileTestsUploadPostSomeOptionalObject]): some_nullable_object diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py index b9f0f5e6b..62d08f7fe 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py @@ -13,7 +13,7 @@ class BodyUploadFileTestsUploadPostAdditionalProperty: Properties: - foo (Union[Unset, str]): None + foo (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py index e882c1d3c..936b20734 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py @@ -13,7 +13,7 @@ class BodyUploadFileTestsUploadPostSomeNullableObject: Properties: - bar (Union[Unset, str]): None + bar (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py index e12cdf246..bd47bd78c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py @@ -11,8 +11,8 @@ class BodyUploadFileTestsUploadPostSomeObject: Properties: - num (float): None - text (str): None + num (float): + text (str): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py index 01800cff5..e93a9c689 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py @@ -11,7 +11,7 @@ class BodyUploadFileTestsUploadPostSomeOptionalObject: Properties: - foo (str): None + foo (str): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py index 976cfb90f..784673fa6 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py @@ -14,7 +14,7 @@ class HTTPValidationError: Properties: - detail (Union[Unset, List[ValidationError]]): None + detail (Union[Unset, List[ValidationError]]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py index 2b7d082bb..1bc432dd6 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py @@ -15,10 +15,10 @@ class ModelFromAllOf: Properties: - a_sub_property (Union[Unset, str]): None - type (Union[Unset, AnotherAllOfSubModelType]): None - type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): None - another_sub_property (Union[Unset, str]): None + a_sub_property (Union[Unset, str]): + type (Union[Unset, AnotherAllOfSubModelType]): + type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): + another_sub_property (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py index 3d028ce80..573c53056 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py @@ -16,7 +16,7 @@ class ModelWithAdditionalPropertiesInlined: Properties: - a_number (Union[Unset, float]): None + a_number (Union[Unset, float]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py index 1fe76fae9..a671102dd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py @@ -13,7 +13,7 @@ class ModelWithAdditionalPropertiesInlinedAdditionalProperty: Properties: - extra_props_prop (Union[Unset, str]): None + extra_props_prop (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py index a15a4c5d3..31a33a5fd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py @@ -15,7 +15,7 @@ class ModelWithUnionProperty: Properties: - a_property (Union[AnEnum, AnIntEnum, Unset]): None + a_property (Union[AnEnum, AnIntEnum, Unset]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py index c9512e3fe..f1ddef87e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py @@ -16,7 +16,7 @@ class ModelWithUnionPropertyInlined: Properties: fruit (Union[ModelWithUnionPropertyInlinedFruitType0, - ModelWithUnionPropertyInlinedFruitType1, Unset]): None + ModelWithUnionPropertyInlinedFruitType1, Unset]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py index eec99c8f9..34ba8dbd4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py @@ -13,7 +13,7 @@ class ModelWithUnionPropertyInlinedFruitType0: Properties: - apples (Union[Unset, str]): None + apples (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py index 2d9e5c8a0..1b124062a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py @@ -13,7 +13,7 @@ class ModelWithUnionPropertyInlinedFruitType1: Properties: - bananas (Union[Unset, str]): None + bananas (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py index a831b558e..c4ebe5557 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py @@ -13,7 +13,7 @@ class TestInlineObjectsJsonBody: Properties: - a_property (Union[Unset, str]): None + a_property (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py index 535fcaa72..e51e13887 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py @@ -13,7 +13,7 @@ class TestInlineObjectsResponse200: Properties: - a_property (Union[Unset, str]): None + a_property (Union[Unset, str]): """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py index e80e9790a..d5c0b4779 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py @@ -11,9 +11,9 @@ class ValidationError: Properties: - loc (List[str]): None - msg (str): None - type (str): None + loc (List[str]): + msg (str): + type (str): """ diff --git a/end_to_end_tests/openapi.json b/end_to_end_tests/openapi.json index 7c38ee0f3..0cb28e6f9 100644 --- a/end_to_end_tests/openapi.json +++ b/end_to_end_tests/openapi.json @@ -804,8 +804,10 @@ "in": "query", "required": true, "schema": { + "description": "A parameter with the same name as another.", + "example": "an example string", "type": "string", - "default": "overriden_in_GET" + "default": "overridden_in_GET" } } ], diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index af368f8d7..0ee5dda0b 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -416,6 +416,16 @@ def response_type(self) -> str: return self.responses[0].prop.get_type_string() return f"Union[{', '.join(types)}]" + def all_parameters(self) -> Iterator[Property]: + yield from self.path_parameters.values() + yield from self.query_parameters.values() + yield from self.header_parameters.values() + yield from self.cookie_parameters.values() + if self.multipart_body: + yield self.multipart_body + if self.json_body: + yield self.json_body + @dataclass class GeneratorData: diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py index 9b72aaab6..5b7f9ead9 100644 --- a/openapi_python_client/parser/properties/property.py +++ b/openapi_python_client/parser/properties/property.py @@ -112,9 +112,9 @@ def to_string(self) -> str: def to_docstring(self) -> str: """Returns property docstring""" - doc = f"{self.python_name} ({self.get_type_string()}): {self.description}" + doc = f"{self.python_name} ({self.get_type_string()}): {self.description or ''}" if self.default: - doc += f"|default: {self.default}" + doc += f" Default: {self.default}." if self.example: - doc += f"|ex: {self.example}" + doc += f" Example: {self.example}." return doc diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index 6945abdbc..f478564f0 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -161,17 +161,8 @@ json_body=json_body, {% endif %} {% if endpoint.path_parameters or endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} Args: - {% for parameter in endpoint.path_parameters.values() %} - {{ parameter.to_docstring() }} - {% endfor %} - {% for parameter in endpoint.query_parameters.values() %} - {{ parameter.to_docstring() }} - {% endfor %} - {% for parameter in endpoint.header_parameters.values() %} - {{ parameter.to_docstring() }} - {% endfor %} - {% for parameter in endpoint.cookie_parameters.values() %} - {{ parameter.to_docstring() }} + {% for parameter in endpoint.all_parameters() %} + {{ parameter.to_docstring() | wordwrap(70) | indent(8) }} {% endfor %} {% endif %} From 379921351eac2510e2e5854c8994e490335bc42c Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 19:17:17 -0700 Subject: [PATCH 13/18] style: Relax length limit on docstrings to be closer to code line limit from black (120) --- .../get_common_parameters_overriding_param.py | 6 ++---- .../api/tests/defaults_tests_defaults_post.py | 12 ++++-------- .../templates/endpoint_macros.py.jinja | 6 +++--- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index e9dfb0d98..b09c9f940 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -46,8 +46,7 @@ def sync_detailed( client: Client, param_query: str = "overridden_in_GET", ) -> Response[Any]: - """Test that if you have an overriding property from `PathItem` in `Operation`, - it produces valid code + """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code Args: param_path (str): @@ -78,8 +77,7 @@ async def asyncio_detailed( client: Client, param_query: str = "overridden_in_GET", ) -> Response[Any]: - """Test that if you have an overriding property from `PathItem` in `Operation`, - it produces valid code + """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code Args: param_path (str): diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py index 876660eec..8ee63b9a1 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py @@ -129,8 +129,7 @@ def sync_detailed( boolean_prop (bool): list_prop (List[AnEnum]): union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: - 0.6. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -187,8 +186,7 @@ def sync( boolean_prop (bool): list_prop (List[AnEnum]): union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: - 0.6. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -238,8 +236,7 @@ async def asyncio_detailed( boolean_prop (bool): list_prop (List[AnEnum]): union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: - 0.6. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): @@ -294,8 +291,7 @@ async def asyncio( boolean_prop (bool): list_prop (List[AnEnum]): union_prop (Union[float, str]): Default: 'not a float'. - union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: - 0.6. + union_prop_with_ref (Union[AnEnum, None, Unset, float]): Default: 0.6. enum_prop (AnEnum): For testing Enums in all the ways they can be used model_prop (ModelWithUnionProperty): required_model_prop (ModelWithUnionProperty): diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index f478564f0..cdcc80738 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -149,10 +149,10 @@ json_body=json_body, {% endmacro %} {% macro docstring(endpoint, return_string) %} -"""{% if endpoint.summary %}{{ endpoint.summary | wordwrap(76)}} +"""{% if endpoint.summary %}{{ endpoint.summary | wordwrap(100)}} {% endif -%} -{%- if endpoint.description %} {{ endpoint.description | wordwrap(76) }} +{%- if endpoint.description %} {{ endpoint.description | wordwrap(100) }} {% endif %} {% if not endpoint.summary and not endpoint.description %} @@ -162,7 +162,7 @@ json_body=json_body, {% if endpoint.path_parameters or endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} Args: {% for parameter in endpoint.all_parameters() %} - {{ parameter.to_docstring() | wordwrap(70) | indent(8) }} + {{ parameter.to_docstring() | wordwrap(90) | indent(8) }} {% endfor %} {% endif %} From aac3ca1169f336218220244a7655cd8b589708e1 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 19:34:40 -0700 Subject: [PATCH 14/18] style: Reformat model docstrings a bit and use Attributes instead of Properties (per Sphinx guide) --- .../my_test_api_client/models/a_form_data.py | 5 +- .../my_test_api_client/models/a_model.py | 58 +++++++--------- ...roperties_reference_that_are_not_object.py | 66 +++++++++---------- .../models/all_of_sub_model.py | 5 +- .../models/another_all_of_sub_model.py | 5 +- .../body_upload_file_tests_upload_post.py | 25 +++---- ...e_tests_upload_post_additional_property.py | 5 +- ..._tests_upload_post_some_nullable_object.py | 5 +- ...load_file_tests_upload_post_some_object.py | 5 +- ..._tests_upload_post_some_optional_object.py | 5 +- .../models/free_form_model.py | 7 +- .../models/http_validation_error.py | 5 +- .../my_test_api_client/models/import_.py | 7 +- .../models/model_from_all_of.py | 5 +- .../my_test_api_client/models/model_name.py | 7 +- ...odel_with_additional_properties_inlined.py | 5 +- ..._properties_inlined_additional_property.py | 5 +- .../model_with_additional_properties_refed.py | 7 +- .../models/model_with_any_json_properties.py | 7 +- ...n_properties_additional_property_type_0.py | 7 +- ...el_with_primitive_additional_properties.py | 8 +-- ...ive_additional_properties_a_date_holder.py | 7 +- .../models/model_with_property_ref.py | 5 +- .../models/model_with_union_property.py | 5 +- .../model_with_union_property_inlined.py | 8 +-- ...ith_union_property_inlined_fruit_type_0.py | 5 +- ...ith_union_property_inlined_fruit_type_1.py | 5 +- .../my_test_api_client/models/none.py | 7 +- .../models/test_inline_objects_json_body.py | 5 +- .../test_inline_objects_response_200.py | 5 +- .../models/validation_error.py | 5 +- .../templates/model.py.jinja | 29 +++++--- 32 files changed, 116 insertions(+), 224 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py index 3a99c38bd..958b24ab5 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_form_data.py @@ -10,12 +10,9 @@ @attr.s(auto_attribs=True) class AFormData: """ - - - Properties: + Attributes: an_required_field (str): an_optional_field (Union[Unset, str]): - """ an_required_field: str diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py index 0520b9e85..48cd1ca77 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model.py @@ -16,39 +16,31 @@ @attr.s(auto_attribs=True) class AModel: - """ - A Model for testing all the ways custom objects can be used - - Properties: - an_enum_value (AnEnum): For testing Enums in all the ways they can be - used - an_allof_enum_with_overridden_default (AnAllOfEnum): Default: - AnAllOfEnum.OVERRIDDEN_DEFAULT. - a_camel_date_time (Union[datetime.date, datetime.datetime]): - a_date (datetime.date): - required_not_nullable (str): - one_of_models (Union[Any, FreeFormModel, ModelWithUnionProperty]): - model (ModelWithUnionProperty): - any_value (Union[Unset, Any]): - an_optional_allof_enum (Union[Unset, AnAllOfEnum]): - nested_list_of_enums (Union[Unset, List[List[DifferentEnum]]]): - a_nullable_date (Optional[datetime.date]): - a_not_required_date (Union[Unset, datetime.date]): - attr_1_leading_digit (Union[Unset, str]): - required_nullable (Optional[str]): - not_required_nullable (Union[Unset, None, str]): - not_required_not_nullable (Union[Unset, str]): - nullable_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, - None]): - not_required_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, - Unset]): - not_required_nullable_one_of_models (Union[FreeFormModel, - ModelWithUnionProperty, None, Unset, str]): - nullable_model (Optional[ModelWithUnionProperty]): - not_required_model (Union[Unset, ModelWithUnionProperty]): - not_required_nullable_model (Union[Unset, None, - ModelWithUnionProperty]): - + """A Model for testing all the ways custom objects can be used + + Attributes: + an_enum_value (AnEnum): For testing Enums in all the ways they can be used + an_allof_enum_with_overridden_default (AnAllOfEnum): Default: AnAllOfEnum.OVERRIDDEN_DEFAULT. + a_camel_date_time (Union[datetime.date, datetime.datetime]): + a_date (datetime.date): + required_not_nullable (str): + one_of_models (Union[Any, FreeFormModel, ModelWithUnionProperty]): + model (ModelWithUnionProperty): + any_value (Union[Unset, Any]): + an_optional_allof_enum (Union[Unset, AnAllOfEnum]): + nested_list_of_enums (Union[Unset, List[List[DifferentEnum]]]): + a_nullable_date (Optional[datetime.date]): + a_not_required_date (Union[Unset, datetime.date]): + attr_1_leading_digit (Union[Unset, str]): + required_nullable (Optional[str]): + not_required_nullable (Union[Unset, None, str]): + not_required_not_nullable (Union[Unset, str]): + nullable_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, None]): + not_required_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, Unset]): + not_required_nullable_one_of_models (Union[FreeFormModel, ModelWithUnionProperty, None, Unset, str]): + nullable_model (Optional[ModelWithUnionProperty]): + not_required_model (Union[Unset, ModelWithUnionProperty]): + not_required_nullable_model (Union[Unset, None, ModelWithUnionProperty]): """ an_enum_value: AnEnum diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py index 05007abcf..1f1c05565 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py @@ -14,41 +14,37 @@ @attr.s(auto_attribs=True) class AModelWithPropertiesReferenceThatAreNotObject: """ - - - Properties: - enum_properties_ref (List[AnEnum]): - str_properties_ref (List[str]): - date_properties_ref (List[datetime.date]): - datetime_properties_ref (List[datetime.datetime]): - int32_properties_ref (List[int]): - int64_properties_ref (List[int]): - float_properties_ref (List[float]): - double_properties_ref (List[float]): - file_properties_ref (List[File]): - bytestream_properties_ref (List[str]): - enum_properties (List[AnEnum]): - str_properties (List[str]): - date_properties (List[datetime.date]): - datetime_properties (List[datetime.datetime]): - int32_properties (List[int]): - int64_properties (List[int]): - float_properties (List[float]): - double_properties (List[float]): - file_properties (List[File]): - bytestream_properties (List[str]): - enum_property_ref (AnEnum): For testing Enums in all the ways they can - be used - str_property_ref (str): - date_property_ref (datetime.date): - datetime_property_ref (datetime.datetime): - int32_property_ref (int): - int64_property_ref (int): - float_property_ref (float): - double_property_ref (float): - file_property_ref (File): - bytestream_property_ref (str): - + Attributes: + enum_properties_ref (List[AnEnum]): + str_properties_ref (List[str]): + date_properties_ref (List[datetime.date]): + datetime_properties_ref (List[datetime.datetime]): + int32_properties_ref (List[int]): + int64_properties_ref (List[int]): + float_properties_ref (List[float]): + double_properties_ref (List[float]): + file_properties_ref (List[File]): + bytestream_properties_ref (List[str]): + enum_properties (List[AnEnum]): + str_properties (List[str]): + date_properties (List[datetime.date]): + datetime_properties (List[datetime.datetime]): + int32_properties (List[int]): + int64_properties (List[int]): + float_properties (List[float]): + double_properties (List[float]): + file_properties (List[File]): + bytestream_properties (List[str]): + enum_property_ref (AnEnum): For testing Enums in all the ways they can be used + str_property_ref (str): + date_property_ref (datetime.date): + datetime_property_ref (datetime.datetime): + int32_property_ref (int): + int64_property_ref (int): + float_property_ref (float): + double_property_ref (float): + file_property_ref (File): + bytestream_property_ref (str): """ enum_properties_ref: List[AnEnum] diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py index 9f75e04c3..5a46393fd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/all_of_sub_model.py @@ -11,13 +11,10 @@ @attr.s(auto_attribs=True) class AllOfSubModel: """ - - - Properties: + Attributes: a_sub_property (Union[Unset, str]): type (Union[Unset, str]): type_enum (Union[Unset, AllOfSubModelTypeEnum]): - """ a_sub_property: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py index aba4c7218..c339eebd3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/another_all_of_sub_model.py @@ -12,13 +12,10 @@ @attr.s(auto_attribs=True) class AnotherAllOfSubModel: """ - - - Properties: + Attributes: another_sub_property (Union[Unset, str]): type (Union[Unset, AnotherAllOfSubModelType]): type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): - """ another_sub_property: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py index aa18af191..200dbec53 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post.py @@ -23,21 +23,16 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPost: """ - - - Properties: - some_file (File): - some_object (BodyUploadFileTestsUploadPostSomeObject): - some_optional_file (Union[Unset, File]): - some_string (Union[Unset, str]): Default: 'some_default_string'. - some_number (Union[Unset, float]): - some_array (Union[Unset, List[float]]): - some_optional_object (Union[Unset, - BodyUploadFileTestsUploadPostSomeOptionalObject]): - some_nullable_object - (Optional[BodyUploadFileTestsUploadPostSomeNullableObject]): - some_enum (Union[Unset, DifferentEnum]): An enumeration. - + Attributes: + some_file (File): + some_object (BodyUploadFileTestsUploadPostSomeObject): + some_optional_file (Union[Unset, File]): + some_string (Union[Unset, str]): Default: 'some_default_string'. + some_number (Union[Unset, float]): + some_array (Union[Unset, List[float]]): + some_optional_object (Union[Unset, BodyUploadFileTestsUploadPostSomeOptionalObject]): + some_nullable_object (Optional[BodyUploadFileTestsUploadPostSomeNullableObject]): + some_enum (Union[Unset, DifferentEnum]): An enumeration. """ some_file: File diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py index 62d08f7fe..522355858 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_additional_property.py @@ -10,11 +10,8 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostAdditionalProperty: """ - - - Properties: + Attributes: foo (Union[Unset, str]): - """ foo: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py index 936b20734..e809b413e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_nullable_object.py @@ -10,11 +10,8 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostSomeNullableObject: """ - - - Properties: + Attributes: bar (Union[Unset, str]): - """ bar: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py index bd47bd78c..8a4f123de 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_object.py @@ -8,12 +8,9 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostSomeObject: """ - - - Properties: + Attributes: num (float): text (str): - """ num: float diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py index e93a9c689..a32d5f979 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/body_upload_file_tests_upload_post_some_optional_object.py @@ -8,11 +8,8 @@ @attr.s(auto_attribs=True) class BodyUploadFileTestsUploadPostSomeOptionalObject: """ - - - Properties: + Attributes: foo (str): - """ foo: str diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py b/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py index 49de8ca6e..f8cc2151c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/free_form_model.py @@ -7,12 +7,7 @@ @attr.s(auto_attribs=True) class FreeFormModel: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py index 784673fa6..21855e7e5 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/http_validation_error.py @@ -11,11 +11,8 @@ @attr.s(auto_attribs=True) class HTTPValidationError: """ - - - Properties: + Attributes: detail (Union[Unset, List[ValidationError]]): - """ detail: Union[Unset, List[ValidationError]] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/import_.py b/end_to_end_tests/golden-record/my_test_api_client/models/import_.py index cd6efcc93..276a4f21b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/import_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/import_.py @@ -7,12 +7,7 @@ @attr.s(auto_attribs=True) class Import: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py index 1bc432dd6..3dfc48a36 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_from_all_of.py @@ -12,14 +12,11 @@ @attr.s(auto_attribs=True) class ModelFromAllOf: """ - - - Properties: + Attributes: a_sub_property (Union[Unset, str]): type (Union[Unset, AnotherAllOfSubModelType]): type_enum (Union[Unset, AnotherAllOfSubModelTypeEnum]): another_sub_property (Union[Unset, str]): - """ a_sub_property: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py index 3b34c15d1..c87d4c208 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_name.py @@ -7,12 +7,7 @@ @attr.s(auto_attribs=True) class ModelName: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py index 573c53056..6e3faebf4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined.py @@ -13,11 +13,8 @@ @attr.s(auto_attribs=True) class ModelWithAdditionalPropertiesInlined: """ - - - Properties: + Attributes: a_number (Union[Unset, float]): - """ a_number: Union[Unset, float] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py index a671102dd..66b487c00 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_inlined_additional_property.py @@ -10,11 +10,8 @@ @attr.s(auto_attribs=True) class ModelWithAdditionalPropertiesInlinedAdditionalProperty: """ - - - Properties: + Attributes: extra_props_prop (Union[Unset, str]): - """ extra_props_prop: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py index 6b6a3d8a8..d51c5d72c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_additional_properties_refed.py @@ -9,12 +9,7 @@ @attr.s(auto_attribs=True) class ModelWithAdditionalPropertiesRefed: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[str, AnEnum] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py index fe2ceabd0..08a016dd8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties.py @@ -11,12 +11,7 @@ @attr.s(auto_attribs=True) class ModelWithAnyJsonProperties: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[ str, Union[List[str], ModelWithAnyJsonPropertiesAdditionalPropertyType0, bool, float, int, str] diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py index bcb227b5e..19e863fc4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_any_json_properties_additional_property_type_0.py @@ -7,12 +7,7 @@ @attr.s(auto_attribs=True) class ModelWithAnyJsonPropertiesAdditionalPropertyType0: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[str, str] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py index 1b151ca23..40d384759 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties.py @@ -13,12 +13,8 @@ @attr.s(auto_attribs=True) class ModelWithPrimitiveAdditionalProperties: """ - - - Properties: - a_date_holder (Union[Unset, - ModelWithPrimitiveAdditionalPropertiesADateHolder]): - + Attributes: + a_date_holder (Union[Unset, ModelWithPrimitiveAdditionalPropertiesADateHolder]): """ a_date_holder: Union[Unset, ModelWithPrimitiveAdditionalPropertiesADateHolder] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py index 74397fe2c..aa8a25252 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_primitive_additional_properties_a_date_holder.py @@ -9,12 +9,7 @@ @attr.s(auto_attribs=True) class ModelWithPrimitiveAdditionalPropertiesADateHolder: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[str, datetime.datetime] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py index 36fab63ef..a3713efe2 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_property_ref.py @@ -11,11 +11,8 @@ @attr.s(auto_attribs=True) class ModelWithPropertyRef: """ - - - Properties: + Attributes: inner (Union[Unset, ModelName]): - """ inner: Union[Unset, ModelName] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py index 31a33a5fd..9afb3cdde 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py @@ -12,11 +12,8 @@ @attr.s(auto_attribs=True) class ModelWithUnionProperty: """ - - - Properties: + Attributes: a_property (Union[AnEnum, AnIntEnum, Unset]): - """ a_property: Union[AnEnum, AnIntEnum, Unset] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py index f1ddef87e..e8537d13d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined.py @@ -12,12 +12,8 @@ @attr.s(auto_attribs=True) class ModelWithUnionPropertyInlined: """ - - - Properties: - fruit (Union[ModelWithUnionPropertyInlinedFruitType0, - ModelWithUnionPropertyInlinedFruitType1, Unset]): - + Attributes: + fruit (Union[ModelWithUnionPropertyInlinedFruitType0, ModelWithUnionPropertyInlinedFruitType1, Unset]): """ fruit: Union[ModelWithUnionPropertyInlinedFruitType0, ModelWithUnionPropertyInlinedFruitType1, Unset] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py index 34ba8dbd4..466bfe252 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_0.py @@ -10,11 +10,8 @@ @attr.s(auto_attribs=True) class ModelWithUnionPropertyInlinedFruitType0: """ - - - Properties: + Attributes: apples (Union[Unset, str]): - """ apples: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py index 1b124062a..a0dae4331 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property_inlined_fruit_type_1.py @@ -10,11 +10,8 @@ @attr.s(auto_attribs=True) class ModelWithUnionPropertyInlinedFruitType1: """ - - - Properties: + Attributes: bananas (Union[Unset, str]): - """ bananas: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/none.py b/end_to_end_tests/golden-record/my_test_api_client/models/none.py index 77ad48334..e1722f094 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/none.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/none.py @@ -7,12 +7,7 @@ @attr.s(auto_attribs=True) class None_: - """ - - - Properties: - - """ + """ """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py index c4ebe5557..66f8ce42c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_json_body.py @@ -10,11 +10,8 @@ @attr.s(auto_attribs=True) class TestInlineObjectsJsonBody: """ - - - Properties: + Attributes: a_property (Union[Unset, str]): - """ a_property: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py index e51e13887..3f9c1c944 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/test_inline_objects_response_200.py @@ -10,11 +10,8 @@ @attr.s(auto_attribs=True) class TestInlineObjectsResponse200: """ - - - Properties: + Attributes: a_property (Union[Unset, str]): - """ a_property: Union[Unset, str] = UNSET diff --git a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py index d5c0b4779..e2f6539ee 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py +++ b/end_to_end_tests/golden-record/my_test_api_client/models/validation_error.py @@ -8,13 +8,10 @@ @attr.s(auto_attribs=True) class ValidationError: """ - - - Properties: + Attributes: loc (List[str]): msg (str): type (str): - """ loc: List[str] diff --git a/openapi_python_client/templates/model.py.jinja b/openapi_python_client/templates/model.py.jinja index cef54bd4f..49246fa31 100644 --- a/openapi_python_client/templates/model.py.jinja +++ b/openapi_python_client/templates/model.py.jinja @@ -28,17 +28,28 @@ T = TypeVar("T", bound="{{ class_name }}") @attr.s(auto_attribs=True) class {{ class_name }}: - """ - {% if model.title %}{{ model.title | wordwrap(76) }}{% endif %} - {% if model.description %}{{ model.description | wordwrap(76) }}{% endif %} - - {% if model.example %}Example:{{ model.example | string | wordwrap(76) }}{% endif %} - - Properties: + """{% if model.title %}{{ model.title | wordwrap(116) }} + + {% endif -%} + {%- if model.description %}{{ model.description | wordwrap(116) }} + + {% endif %} + {% if not model.title and not model.description %} + {# Leave extra space so that a section doesn't start on the first line #} + + {% endif %} + {% if model.example %} + Example: + {{ model.example | string | wordwrap(112) | indent(12) }} + + {% endif %} + {% if model.required_properties or model.optional_properties %} + Attributes: {% for property in model.required_properties + model.optional_properties %} - {{ property.to_docstring() | wordwrap(72) }} - {% endfor %} + {{ property.to_docstring() | wordwrap(112) | indent(12) }} + {% endfor %}{% endif %} """ + {% for property in model.required_properties + model.optional_properties %} {% if property.default is none and property.required %} {{ property.to_string() }} From d7c43fc78c8365e851a1ca87661ea1d552750111 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 19:37:20 -0700 Subject: [PATCH 15/18] style: Add missing docstring --- openapi_python_client/parser/openapi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index 0ee5dda0b..f91bd1eba 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -417,6 +417,7 @@ def response_type(self) -> str: return f"Union[{', '.join(types)}]" def all_parameters(self) -> Iterator[Property]: + """Iterate through all the parameters of this endpoint """ yield from self.path_parameters.values() yield from self.query_parameters.values() yield from self.header_parameters.values() From a039b9906c1bd1959c494317182251ae1f4e1873 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 19:38:25 -0700 Subject: [PATCH 16/18] style: Reformat --- openapi_python_client/parser/openapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index f91bd1eba..d7dcd24e1 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -417,7 +417,7 @@ def response_type(self) -> str: return f"Union[{', '.join(types)}]" def all_parameters(self) -> Iterator[Property]: - """Iterate through all the parameters of this endpoint """ + """Iterate through all the parameters of this endpoint""" yield from self.path_parameters.values() yield from self.query_parameters.values() yield from self.header_parameters.values() From 10212d5319d289e7214f840350114a6a3b926a74 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 19:45:34 -0700 Subject: [PATCH 17/18] fix: Include JSON body parameters in docstrings when that's the only param. --- .../api/tests/json_body_tests_json_body_post.py | 12 ++++++++++++ .../api/tests/post_tests_json_body_string.py | 12 ++++++++++++ .../api/tests/test_inline_objects.py | 12 ++++++++++++ openapi_python_client/parser/openapi.py | 6 +++++- .../templates/endpoint_macros.py.jinja | 5 +++-- 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py index 8d714ae18..f5303c25b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -59,6 +59,9 @@ def sync_detailed( Try sending a JSON body + Args: + json_body (AModel): A Model for testing all the ways custom objects can be used + Returns: Response[Union[Any, HTTPValidationError]] """ @@ -85,6 +88,9 @@ def sync( Try sending a JSON body + Args: + json_body (AModel): A Model for testing all the ways custom objects can be used + Returns: Response[Union[Any, HTTPValidationError]] """ @@ -104,6 +110,9 @@ async def asyncio_detailed( Try sending a JSON body + Args: + json_body (AModel): A Model for testing all the ways custom objects can be used + Returns: Response[Union[Any, HTTPValidationError]] """ @@ -128,6 +137,9 @@ async def asyncio( Try sending a JSON body + Args: + json_body (AModel): A Model for testing all the ways custom objects can be used + Returns: Response[Union[Any, HTTPValidationError]] """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py index 9549434eb..4770fd7a6 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py @@ -55,6 +55,9 @@ def sync_detailed( ) -> Response[Union[HTTPValidationError, str]]: """Json Body Which is String + Args: + json_body (str): + Returns: Response[Union[HTTPValidationError, str]] """ @@ -79,6 +82,9 @@ def sync( ) -> Optional[Union[HTTPValidationError, str]]: """Json Body Which is String + Args: + json_body (str): + Returns: Response[Union[HTTPValidationError, str]] """ @@ -96,6 +102,9 @@ async def asyncio_detailed( ) -> Response[Union[HTTPValidationError, str]]: """Json Body Which is String + Args: + json_body (str): + Returns: Response[Union[HTTPValidationError, str]] """ @@ -118,6 +127,9 @@ async def asyncio( ) -> Optional[Union[HTTPValidationError, str]]: """Json Body Which is String + Args: + json_body (str): + Returns: Response[Union[HTTPValidationError, str]] """ diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py index c4c5380d8..6c40f6309 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py @@ -53,6 +53,9 @@ def sync_detailed( ) -> Response[TestInlineObjectsResponse200]: """Test Inline Objects + Args: + json_body (TestInlineObjectsJsonBody): + Returns: Response[TestInlineObjectsResponse200] """ @@ -77,6 +80,9 @@ def sync( ) -> Optional[TestInlineObjectsResponse200]: """Test Inline Objects + Args: + json_body (TestInlineObjectsJsonBody): + Returns: Response[TestInlineObjectsResponse200] """ @@ -94,6 +100,9 @@ async def asyncio_detailed( ) -> Response[TestInlineObjectsResponse200]: """Test Inline Objects + Args: + json_body (TestInlineObjectsJsonBody): + Returns: Response[TestInlineObjectsResponse200] """ @@ -116,6 +125,9 @@ async def asyncio( ) -> Optional[TestInlineObjectsResponse200]: """Test Inline Objects + Args: + json_body (TestInlineObjectsJsonBody): + Returns: Response[TestInlineObjectsResponse200] """ diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index d7dcd24e1..359d6022c 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -416,7 +416,7 @@ def response_type(self) -> str: return self.responses[0].prop.get_type_string() return f"Union[{', '.join(types)}]" - def all_parameters(self) -> Iterator[Property]: + def iter_all_parameters(self) -> Iterator[Property]: """Iterate through all the parameters of this endpoint""" yield from self.path_parameters.values() yield from self.query_parameters.values() @@ -427,6 +427,10 @@ def all_parameters(self) -> Iterator[Property]: if self.json_body: yield self.json_body + def list_all_parameters(self) -> List[Property]: + """Return a List of all the parameters of this endpoint""" + return list(self.iter_all_parameters()) + @dataclass class GeneratorData: diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index cdcc80738..36c65d7e2 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -159,9 +159,10 @@ json_body=json_body, {# Leave extra space so that Args or Returns isn't at the top #} {% endif %} -{% if endpoint.path_parameters or endpoint.query_parameters or endpoint.header_parameters or endpoint.cookie_parameters %} +{% set all_parameters = endpoint.list_all_parameters() %} +{% if all_parameters %} Args: - {% for parameter in endpoint.all_parameters() %} + {% for parameter in all_parameters %} {{ parameter.to_docstring() | wordwrap(90) | indent(8) }} {% endfor %} From 4b492b8f8c8c6ce91918e765bf9d8ce890a305e5 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 19:49:27 -0700 Subject: [PATCH 18/18] test: Fill a discovered coverage hole --- tests/test_parser/test_responses.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_parser/test_responses.py b/tests/test_parser/test_responses.py index 35d6bab13..ab73cfb74 100644 --- a/tests/test_parser/test_responses.py +++ b/tests/test_parser/test_responses.py @@ -31,6 +31,29 @@ def test_response_from_data_no_content(any_property_factory): ) +def test_response_from_data_reference(any_property_factory): + from openapi_python_client.parser.responses import Response, response_from_data + + response, schemas = response_from_data( + status_code=200, + data=oai.Reference.construct(), + schemas=Schemas(), + parent_name="parent", + config=MagicMock(), + ) + + assert response == Response( + status_code=200, + prop=any_property_factory( + name="response_200", + default=None, + nullable=False, + required=True, + ), + source="None", + ) + + def test_response_from_data_unsupported_content_type(): from openapi_python_client.parser.responses import response_from_data