From f5846ce2813bd805c07f304d4b0d83962a1293b8 Mon Sep 17 00:00:00 2001 From: Forest Tong Date: Wed, 27 Jan 2021 09:18:54 -0500 Subject: [PATCH 1/5] Serialize model query params --- .../api/tests/defaults_tests_defaults_post.py | 28 +++++++++------ ...tional_value_tests_optional_query_param.py | 2 +- .../api/tests/defaults_tests_defaults_post.py | 36 +++++++++++++------ ...tional_value_tests_optional_query_param.py | 2 +- end_to_end_tests/openapi.json | 8 +++++ .../parser/properties/model_property.py | 1 + .../templates/endpoint_macros.pyi | 9 ++--- 7 files changed, 60 insertions(+), 26 deletions(-) diff --git a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py index 574d5018b..f87ad3e1b 100644 --- a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py @@ -13,6 +13,7 @@ from ...models.an_enum import AnEnum from ...models.http_validation_error import HTTPValidationError +from ...models.model_with_union_property import ModelWithUnionProperty from ...types import UNSET, Unset @@ -50,6 +51,7 @@ def httpx_request( union_prop: Union[Unset, float, str] = "not a float", union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, + model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, ) -> Response[Union[None, HTTPValidationError]]: json_datetime_prop: Union[Unset, str] = UNSET @@ -89,27 +91,33 @@ def httpx_request( if not isinstance(enum_prop, Unset): json_enum_prop = enum_prop + json_model_prop: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(model_prop, Unset): + json_model_prop = model_prop.to_dict() + params: Dict[str, Any] = {} - if string_prop is not UNSET: + if not isinstance(string_prop, Unset) and string_prop is not None: params["string_prop"] = string_prop - if datetime_prop is not UNSET: + if not isinstance(json_datetime_prop, Unset) and json_datetime_prop is not None: params["datetime_prop"] = json_datetime_prop - if date_prop is not UNSET: + if not isinstance(json_date_prop, Unset) and json_date_prop is not None: params["date_prop"] = json_date_prop - if float_prop is not UNSET: + if not isinstance(float_prop, Unset) and float_prop is not None: params["float_prop"] = float_prop - if int_prop is not UNSET: + if not isinstance(int_prop, Unset) and int_prop is not None: params["int_prop"] = int_prop - if boolean_prop is not UNSET: + if not isinstance(boolean_prop, Unset) and boolean_prop is not None: params["boolean_prop"] = boolean_prop - if list_prop is not UNSET: + if not isinstance(json_list_prop, Unset) and json_list_prop is not None: params["list_prop"] = json_list_prop - if union_prop is not UNSET: + if not isinstance(json_union_prop, Unset) and json_union_prop is not None: params["union_prop"] = json_union_prop - if union_prop_with_ref is not UNSET: + if not isinstance(json_union_prop_with_ref, Unset) and json_union_prop_with_ref is not None: params["union_prop_with_ref"] = json_union_prop_with_ref - if enum_prop is not UNSET: + if not isinstance(json_enum_prop, Unset) and json_enum_prop is not None: params["enum_prop"] = json_enum_prop + if not isinstance(json_model_prop, Unset) and json_model_prop is not None: + params.update(json_model_prop) response = client.request( "post", diff --git a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/optional_value_tests_optional_query_param.py b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/optional_value_tests_optional_query_param.py index bff43cc10..616dc4252 100644 --- a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/optional_value_tests_optional_query_param.py +++ b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/optional_value_tests_optional_query_param.py @@ -44,7 +44,7 @@ def httpx_request( json_query_param = query_param params: Dict[str, Any] = {} - if query_param is not UNSET: + if not isinstance(json_query_param, Unset) and json_query_param is not None: params["query_param"] = json_query_param response = client.request( 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 9242cddaa..ff6ef2409 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 @@ -7,6 +7,7 @@ from ...client import Client from ...models.an_enum import AnEnum from ...models.http_validation_error import HTTPValidationError +from ...models.model_with_union_property import ModelWithUnionProperty from ...types import UNSET, Response, Unset @@ -23,6 +24,7 @@ def _get_kwargs( union_prop: Union[Unset, float, str] = "not a float", union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, + model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, ) -> Dict[str, Any]: url = "{}/tests/defaults".format(client.base_url) @@ -65,27 +67,33 @@ def _get_kwargs( if not isinstance(enum_prop, Unset): json_enum_prop = enum_prop + json_model_prop: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(model_prop, Unset): + json_model_prop = model_prop.to_dict() + params: Dict[str, Any] = {} - if string_prop is not UNSET: + if not isinstance(string_prop, Unset) and string_prop is not None: params["string_prop"] = string_prop - if datetime_prop is not UNSET: + if not isinstance(json_datetime_prop, Unset) and json_datetime_prop is not None: params["datetime_prop"] = json_datetime_prop - if date_prop is not UNSET: + if not isinstance(json_date_prop, Unset) and json_date_prop is not None: params["date_prop"] = json_date_prop - if float_prop is not UNSET: + if not isinstance(float_prop, Unset) and float_prop is not None: params["float_prop"] = float_prop - if int_prop is not UNSET: + if not isinstance(int_prop, Unset) and int_prop is not None: params["int_prop"] = int_prop - if boolean_prop is not UNSET: + if not isinstance(boolean_prop, Unset) and boolean_prop is not None: params["boolean_prop"] = boolean_prop - if list_prop is not UNSET: + if not isinstance(json_list_prop, Unset) and json_list_prop is not None: params["list_prop"] = json_list_prop - if union_prop is not UNSET: + if not isinstance(json_union_prop, Unset) and json_union_prop is not None: params["union_prop"] = json_union_prop - if union_prop_with_ref is not UNSET: + if not isinstance(json_union_prop_with_ref, Unset) and json_union_prop_with_ref is not None: params["union_prop_with_ref"] = json_union_prop_with_ref - if enum_prop is not UNSET: + if not isinstance(json_enum_prop, Unset) and json_enum_prop is not None: params["enum_prop"] = json_enum_prop + if not isinstance(json_model_prop, Unset) and json_model_prop is not None: + params.update(json_model_prop) return { "url": url, @@ -130,6 +138,7 @@ def sync_detailed( union_prop: Union[Unset, float, str] = "not a float", union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, + model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, ) -> Response[Union[None, HTTPValidationError]]: kwargs = _get_kwargs( client=client, @@ -143,6 +152,7 @@ def sync_detailed( union_prop=union_prop, union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, + model_prop=model_prop, ) response = httpx.post( @@ -165,6 +175,7 @@ def sync( union_prop: Union[Unset, float, str] = "not a float", union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, + model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, ) -> Optional[Union[None, HTTPValidationError]]: """ """ @@ -180,6 +191,7 @@ def sync( union_prop=union_prop, union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, + model_prop=model_prop, ).parsed @@ -196,6 +208,7 @@ async def asyncio_detailed( union_prop: Union[Unset, float, str] = "not a float", union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, + model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, ) -> Response[Union[None, HTTPValidationError]]: kwargs = _get_kwargs( client=client, @@ -209,6 +222,7 @@ async def asyncio_detailed( union_prop=union_prop, union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, + model_prop=model_prop, ) async with httpx.AsyncClient() as _client: @@ -230,6 +244,7 @@ async def asyncio( union_prop: Union[Unset, float, str] = "not a float", union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, + model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, ) -> Optional[Union[None, HTTPValidationError]]: """ """ @@ -246,5 +261,6 @@ async def asyncio( union_prop=union_prop, union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, + model_prop=model_prop, ) ).parsed diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/optional_value_tests_optional_query_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/optional_value_tests_optional_query_param.py index 751f48e03..576a770fe 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/optional_value_tests_optional_query_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/optional_value_tests_optional_query_param.py @@ -21,7 +21,7 @@ def _get_kwargs( json_query_param = query_param params: Dict[str, Any] = {} - if query_param is not UNSET: + if not isinstance(json_query_param, Unset) and json_query_param is not None: params["query_param"] = json_query_param return { diff --git a/end_to_end_tests/openapi.json b/end_to_end_tests/openapi.json index 9e3d78908..7912711c7 100644 --- a/end_to_end_tests/openapi.json +++ b/end_to_end_tests/openapi.json @@ -396,6 +396,14 @@ }, "name": "enum_prop", "in": "query" + }, + { + "required": false, + "schema": { + "$ref": "#/components/schemas/ModelWithUnionProperty" + }, + "name": "model_prop", + "in": "query" } ], "responses": { diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py index 084017a41..202505b28 100644 --- a/openapi_python_client/parser/properties/model_property.py +++ b/openapi_python_client/parser/properties/model_property.py @@ -19,6 +19,7 @@ class ModelProperty(Property): additional_properties: Union[bool, Property] template: ClassVar[str] = "model_property.pyi" + json_is_dict: ClassVar[bool] = True def get_type_string(self, no_optional: bool = False) -> str: """ Get a string representation of type that should be used when declaring this property """ diff --git a/openapi_python_client/templates/endpoint_macros.pyi b/openapi_python_client/templates/endpoint_macros.pyi index 5819714d8..8d3d464c3 100644 --- a/openapi_python_client/templates/endpoint_macros.pyi +++ b/openapi_python_client/templates/endpoint_macros.pyi @@ -33,11 +33,12 @@ params: Dict[str, Any] = { } {% for property in endpoint.query_parameters %} {% if not property.required %} -if {{ property.python_name }} is not UNSET: - {% if property.template %} - params["{{ property.name }}"] = {{ "json_" + property.python_name }} + {% set property_name = "json_" + property.python_name if property.template else property.python_name %} +if {% if not property.required %}not isinstance({{ property_name }}, Unset) and {% endif %}{{ property_name }} is not None: + {% if property.json_is_dict %} + params.update({{ property_name }}) {% else %} - params["{{ property.name }}"] = {{ property.python_name }} + params["{{ property.name }}"] = {{ property_name }} {% endif %} {% endif %} {% endfor %} From 147fe016e896e6982d8db653065fa8e5e25909ff Mon Sep 17 00:00:00 2001 From: Forest Tong Date: Tue, 9 Feb 2021 11:14:30 -0500 Subject: [PATCH 2/5] Always check --- .../api/tests/defaults_tests_defaults_post.py | 6 +++++- .../api/tests/defaults_tests_defaults_post.py | 14 +++++++++++++- end_to_end_tests/openapi.json | 8 ++++++++ .../templates/endpoint_macros.py.jinja | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py index 03ac51f8e..073aaaea4 100644 --- a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py @@ -52,6 +52,7 @@ def httpx_request( union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, + required_model_prop: ModelWithUnionProperty, ) -> Response[Union[None, HTTPValidationError]]: json_datetime_prop: Union[Unset, str] = UNSET @@ -95,6 +96,8 @@ def httpx_request( if not isinstance(model_prop, Unset): json_model_prop = model_prop.to_dict() + json_required_model_prop = required_model_prop.to_dict() + params: Dict[str, Any] = { "string_prop": string_prop, "datetime_prop": json_datetime_prop, @@ -107,8 +110,9 @@ def httpx_request( "union_prop_with_ref": json_union_prop_with_ref, "enum_prop": json_enum_prop, } - if not isinstance(json_model_prop, Unset): + if not isinstance(json_model_prop, Unset) and json_model_prop is not None: params.update(json_model_prop) + params.update(json_required_model_prop) params = {k: v for k, v in params.items() if v is not UNSET and v is not None} response = client.request( 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 fee23bbbe..0f53398e2 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 @@ -25,6 +25,7 @@ def _get_kwargs( union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, + required_model_prop: ModelWithUnionProperty, ) -> Dict[str, Any]: url = "{}/tests/defaults".format(client.base_url) @@ -71,6 +72,8 @@ def _get_kwargs( if not isinstance(model_prop, Unset): json_model_prop = model_prop.to_dict() + json_required_model_prop = required_model_prop.to_dict() + params: Dict[str, Any] = { "string_prop": string_prop, "datetime_prop": json_datetime_prop, @@ -83,8 +86,9 @@ def _get_kwargs( "union_prop_with_ref": json_union_prop_with_ref, "enum_prop": json_enum_prop, } - if not isinstance(json_model_prop, Unset): + if not isinstance(json_model_prop, Unset) and json_model_prop is not None: params.update(json_model_prop) + params.update(json_required_model_prop) params = {k: v for k, v in params.items() if v is not UNSET and v is not None} return { @@ -131,6 +135,7 @@ def sync_detailed( union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, + required_model_prop: ModelWithUnionProperty, ) -> Response[Union[None, HTTPValidationError]]: kwargs = _get_kwargs( client=client, @@ -145,6 +150,7 @@ def sync_detailed( union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, model_prop=model_prop, + required_model_prop=required_model_prop, ) response = httpx.post( @@ -168,6 +174,7 @@ def sync( union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, + required_model_prop: ModelWithUnionProperty, ) -> Optional[Union[None, HTTPValidationError]]: """ """ @@ -184,6 +191,7 @@ def sync( union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, model_prop=model_prop, + required_model_prop=required_model_prop, ).parsed @@ -201,6 +209,7 @@ async def asyncio_detailed( union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, + required_model_prop: ModelWithUnionProperty, ) -> Response[Union[None, HTTPValidationError]]: kwargs = _get_kwargs( client=client, @@ -215,6 +224,7 @@ async def asyncio_detailed( union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, model_prop=model_prop, + required_model_prop=required_model_prop, ) async with httpx.AsyncClient() as _client: @@ -237,6 +247,7 @@ async def asyncio( union_prop_with_ref: Union[Unset, float, AnEnum] = 0.6, enum_prop: Union[Unset, AnEnum] = UNSET, model_prop: Union[ModelWithUnionProperty, Unset] = UNSET, + required_model_prop: ModelWithUnionProperty, ) -> Optional[Union[None, HTTPValidationError]]: """ """ @@ -254,5 +265,6 @@ async def asyncio( union_prop_with_ref=union_prop_with_ref, enum_prop=enum_prop, model_prop=model_prop, + required_model_prop=required_model_prop, ) ).parsed diff --git a/end_to_end_tests/openapi.json b/end_to_end_tests/openapi.json index 8562f6796..881fe2be5 100644 --- a/end_to_end_tests/openapi.json +++ b/end_to_end_tests/openapi.json @@ -404,6 +404,14 @@ }, "name": "model_prop", "in": "query" + }, + { + "required": true, + "schema": { + "$ref": "#/components/schemas/ModelWithUnionProperty" + }, + "name": "required_model_prop", + "in": "query" } ], "responses": { diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index 64b59caa4..5f6363af5 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -37,7 +37,7 @@ params: Dict[str, Any] = { {% if property.required and not property.nullable %} params.update({{ property_name }}) {% else %} -if {% if not property.required %}not isinstance({{ property_name }}, Unset){% endif %}{% if not property.required and property.nullable %} and {% endif %}{% if property.nullable %}{{ property_name }} is not None{% endif %}: +if not isinstance({{ property_name }}, Unset) and {{ property_name }} is not None: params.update({{ "json_" + property.python_name }}) {% endif %} {% endif %} From 8b277737eacc56a773108e1bf24fb83c57b3c883 Mon Sep 17 00:00:00 2001 From: Forest Tong Date: Wed, 10 Feb 2021 14:12:40 -0500 Subject: [PATCH 3/5] Add to base Property class --- openapi_python_client/parser/properties/property.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py index 0b7047551..a94af72ba 100644 --- a/openapi_python_client/parser/properties/property.py +++ b/openapi_python_client/parser/properties/property.py @@ -28,6 +28,7 @@ class Property: python_name: str = attr.ib(init=False) template: ClassVar[Optional[str]] = None + json_is_dict: ClassVar[bool] = False def __attrs_post_init__(self) -> None: object.__setattr__(self, "python_name", utils.to_valid_python_identifier(utils.snake_case(self.name))) From 284a75070c0e31e81256a5e39ebd6b75251de01f Mon Sep 17 00:00:00 2001 From: Forest Tong Date: Wed, 10 Feb 2021 17:36:02 -0500 Subject: [PATCH 4/5] Revert change to if statement in endpoint_macros --- .../custom_e2e/api/tests/defaults_tests_defaults_post.py | 2 +- .../api/tests/defaults_tests_defaults_post.py | 2 +- openapi_python_client/templates/endpoint_macros.py.jinja | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py index 073aaaea4..53e2d1def 100644 --- a/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record-custom/custom_e2e/api/tests/defaults_tests_defaults_post.py @@ -110,7 +110,7 @@ def httpx_request( "union_prop_with_ref": json_union_prop_with_ref, "enum_prop": json_enum_prop, } - if not isinstance(json_model_prop, Unset) and json_model_prop is not None: + if not isinstance(json_model_prop, Unset): params.update(json_model_prop) params.update(json_required_model_prop) params = {k: v for k, v in params.items() if v is not UNSET and v is not None} 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 0f53398e2..5f5f5dac6 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 @@ -86,7 +86,7 @@ def _get_kwargs( "union_prop_with_ref": json_union_prop_with_ref, "enum_prop": json_enum_prop, } - if not isinstance(json_model_prop, Unset) and json_model_prop is not None: + if not isinstance(json_model_prop, Unset): params.update(json_model_prop) params.update(json_required_model_prop) params = {k: v for k, v in params.items() if v is not UNSET and v is not None} diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index 5f6363af5..64b59caa4 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -37,7 +37,7 @@ params: Dict[str, Any] = { {% if property.required and not property.nullable %} params.update({{ property_name }}) {% else %} -if not isinstance({{ property_name }}, Unset) and {{ property_name }} is not None: +if {% if not property.required %}not isinstance({{ property_name }}, Unset){% endif %}{% if not property.required and property.nullable %} and {% endif %}{% if property.nullable %}{{ property_name }} is not None{% endif %}: params.update({{ "json_" + property.python_name }}) {% endif %} {% endif %} From 8d6d6446c57504b68920783b91e515618ad047be Mon Sep 17 00:00:00 2001 From: Forest Tong Date: Wed, 10 Feb 2021 17:38:49 -0500 Subject: [PATCH 5/5] Reuse variable --- openapi_python_client/templates/endpoint_macros.py.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index 64b59caa4..113c410e2 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -38,7 +38,7 @@ params: Dict[str, Any] = { params.update({{ property_name }}) {% else %} if {% if not property.required %}not isinstance({{ property_name }}, Unset){% endif %}{% if not property.required and property.nullable %} and {% endif %}{% if property.nullable %}{{ property_name }} is not None{% endif %}: - params.update({{ "json_" + property.python_name }}) + params.update({{ property_name }}) {% endif %} {% endif %} {% endfor %}