From a56b2e9765b150418f0585d19c69c3535ec7c1ae Mon Sep 17 00:00:00 2001 From: timonrieger Date: Sat, 14 Nov 2026 16:01:43 +0100 Subject: [PATCH 1/2] [python] Replace python-dateutil with datetime.fromisoformat --- .../main/resources/python/README_onlypackage.mustache | 1 - .../src/main/resources/python/api_client.mustache | 9 ++------- .../src/main/resources/python/pyproject.mustache | 4 ---- .../src/main/resources/python/requirements.mustache | 1 - .../src/main/resources/python/setup.mustache | 1 - .../src/main/resources/python/test-requirements.mustache | 1 - .../openapi_client/api_client.py | 9 ++------- .../pyproject.toml | 2 -- .../requirements.txt | 1 - .../setup.py | 1 - .../test-requirements.txt | 1 - .../client/echo_api/python/openapi_client/api_client.py | 9 ++------- samples/client/echo_api/python/pyproject.toml | 2 -- samples/client/echo_api/python/requirements.txt | 1 - samples/client/echo_api/python/setup.py | 1 - samples/client/echo_api/python/test-requirements.txt | 1 - .../legacy_model_dict_client/api_client.py | 9 ++------- .../python-legacy-model-dictionaries/pyproject.toml | 2 -- .../python-legacy-model-dictionaries/requirements.txt | 1 - .../others/python-legacy-model-dictionaries/setup.py | 1 - .../test-requirements.txt | 1 - .../petstore/python-aiohttp/petstore_api/api_client.py | 9 ++------- .../client/petstore/python-aiohttp/pyproject.toml | 2 -- .../client/petstore/python-aiohttp/requirements.txt | 1 - samples/openapi3/client/petstore/python-aiohttp/setup.py | 1 - .../client/petstore/python-aiohttp/test-requirements.txt | 1 - .../python-httpx-sync/petstore_api/api_client.py | 9 ++------- .../client/petstore/python-httpx-sync/pyproject.toml | 2 -- .../client/petstore/python-httpx-sync/requirements.txt | 1 - .../openapi3/client/petstore/python-httpx-sync/setup.py | 1 - .../petstore/python-httpx-sync/test-requirements.txt | 1 - .../petstore/python-httpx/petstore_api/api_client.py | 9 ++------- .../openapi3/client/petstore/python-httpx/pyproject.toml | 2 -- .../client/petstore/python-httpx/requirements.txt | 1 - samples/openapi3/client/petstore/python-httpx/setup.py | 1 - .../client/petstore/python-httpx/test-requirements.txt | 1 - .../python-httpx2-sync/petstore_api/api_client.py | 9 ++------- .../client/petstore/python-httpx2-sync/pyproject.toml | 2 -- .../client/petstore/python-httpx2-sync/requirements.txt | 1 - .../openapi3/client/petstore/python-httpx2-sync/setup.py | 1 - .../petstore/python-httpx2-sync/test-requirements.txt | 1 - .../petstore/python-httpx2/petstore_api/api_client.py | 9 ++------- .../client/petstore/python-httpx2/pyproject.toml | 2 -- .../client/petstore/python-httpx2/requirements.txt | 1 - samples/openapi3/client/petstore/python-httpx2/setup.py | 1 - .../client/petstore/python-httpx2/test-requirements.txt | 1 - .../python-lazyImports/petstore_api/api_client.py | 9 ++------- .../client/petstore/python-lazyImports/pyproject.toml | 2 -- .../client/petstore/python-lazyImports/requirements.txt | 1 - .../openapi3/client/petstore/python-lazyImports/setup.py | 1 - .../petstore/python-lazyImports/test-requirements.txt | 1 - .../petstore/python-lazyImports/tests/test_api_client.py | 6 +++--- .../client/petstore/python/petstore_api/api_client.py | 9 ++------- samples/openapi3/client/petstore/python/pyproject.toml | 2 -- samples/openapi3/client/petstore/python/requirements.txt | 1 - samples/openapi3/client/petstore/python/setup.py | 1 - .../client/petstore/python/test-requirements.txt | 1 - .../client/petstore/python/tests/test_api_client.py | 8 ++++---- 58 files changed, 29 insertions(+), 142 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache b/modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache index d205966d0bc5..30f1b6aa017d 100644 --- a/modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache +++ b/modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache @@ -27,7 +27,6 @@ This python library package is generated without supporting files like setup.py To be able to use it, you will need these dependencies in your own package that uses this library: * urllib3 >= 2.1.0, < 3.0.0 -* python-dateutil >= 2.8.2 {{#async}} * aiohttp >= 3.8.4 * aiohttp-retry >= 2.8.3 diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 8c9d283b4489..6e8975f22a08 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -2,7 +2,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -973,9 +972,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -991,9 +988,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/modules/openapi-generator/src/main/resources/python/pyproject.mustache b/modules/openapi-generator/src/main/resources/python/pyproject.mustache index 109cff467caa..b61e222781a5 100644 --- a/modules/openapi-generator/src/main/resources/python/pyproject.mustache +++ b/modules/openapi-generator/src/main/resources/python/pyproject.mustache @@ -41,7 +41,6 @@ python = "^3.11" {{^async}} urllib3 = ">= 2.7.0, < 3.0.0" {{/async}} -python-dateutil = ">= 2.8.2" {{#asyncio}} aiohttp = ">= 3.14.1" aiohttp-retry = ">= 2.8.3" @@ -66,7 +65,6 @@ dependencies = [ {{^async}} "urllib3 (>=2.7.0,<3.0.0)", {{/async}} - "python-dateutil (>=2.8.2)", {{#httpx}} "httpx (>=0.28.1)", {{/httpx}} @@ -96,7 +94,6 @@ pytest = ">= 9.0.3" pytest-cov = ">= 2.8.1" tox = ">= 3.9.0" flake8 = ">= 4.0.0" -types-python-dateutil = ">= 2.8.19.14" mypy = ">= 1.5" {{/poetry1}} {{^poetry1}} @@ -106,7 +103,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] {{/poetry1}} diff --git a/modules/openapi-generator/src/main/resources/python/requirements.mustache b/modules/openapi-generator/src/main/resources/python/requirements.mustache index 36f07decbdbf..d2d409f36a19 100644 --- a/modules/openapi-generator/src/main/resources/python/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/requirements.mustache @@ -1,7 +1,6 @@ {{^async}} urllib3 >= 2.7.0, < 3.0.0 {{/async}} -python_dateutil >= 2.8.2 {{#asyncio}} aiohttp >= 3.14.1 aiohttp-retry >= 2.8.3 diff --git a/modules/openapi-generator/src/main/resources/python/setup.mustache b/modules/openapi-generator/src/main/resources/python/setup.mustache index 8f0da3eee18d..7178f275966c 100644 --- a/modules/openapi-generator/src/main/resources/python/setup.mustache +++ b/modules/openapi-generator/src/main/resources/python/setup.mustache @@ -15,7 +15,6 @@ REQUIRES = [ {{^async}} "urllib3 >= 2.7.0, < 3.0.0", {{/async}} - "python-dateutil >= 2.8.2", {{#asyncio}} "aiohttp >= 3.14.1", "aiohttp-retry >= 2.8.3", diff --git a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache index 9cb0629aded0..6aa50ccfb06e 100644 --- a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py index 516f7fb1a206..f60978385444 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py @@ -13,7 +13,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -807,9 +806,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -825,9 +822,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/pyproject.toml b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/pyproject.toml index c8ba8d656bd2..8908163c7614 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/pyproject.toml +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/pyproject.toml @@ -12,7 +12,6 @@ requires-python = ">=3.11" dependencies = [ "urllib3 (>=2.7.0,<3.0.0)", - "python-dateutil (>=2.8.2)", "pydantic (>=2.11)", "typing-extensions (>=4.7.1)", ] @@ -26,7 +25,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/requirements.txt b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/requirements.txt index 1d751a9a2254..c87436ff6c03 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/requirements.txt +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/requirements.txt @@ -1,4 +1,3 @@ urllib3 >= 2.7.0, < 3.0.0 -python_dateutil >= 2.8.2 pydantic >= 2.11 typing-extensions >= 4.7.1 diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/setup.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/setup.py index 20494a74d591..75da1b9caf6f 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/setup.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/setup.py @@ -24,7 +24,6 @@ PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ "urllib3 >= 2.7.0, < 3.0.0", - "python-dateutil >= 2.8.2", "pydantic >= 2.11", "typing-extensions >= 4.7.1", ] diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test-requirements.txt b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test-requirements.txt +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/client/echo_api/python/openapi_client/api_client.py b/samples/client/echo_api/python/openapi_client/api_client.py index 516f7fb1a206..f60978385444 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -13,7 +13,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -807,9 +806,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -825,9 +822,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/client/echo_api/python/pyproject.toml b/samples/client/echo_api/python/pyproject.toml index c8ba8d656bd2..8908163c7614 100644 --- a/samples/client/echo_api/python/pyproject.toml +++ b/samples/client/echo_api/python/pyproject.toml @@ -12,7 +12,6 @@ requires-python = ">=3.11" dependencies = [ "urllib3 (>=2.7.0,<3.0.0)", - "python-dateutil (>=2.8.2)", "pydantic (>=2.11)", "typing-extensions (>=4.7.1)", ] @@ -26,7 +25,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/client/echo_api/python/requirements.txt b/samples/client/echo_api/python/requirements.txt index 1d751a9a2254..c87436ff6c03 100644 --- a/samples/client/echo_api/python/requirements.txt +++ b/samples/client/echo_api/python/requirements.txt @@ -1,4 +1,3 @@ urllib3 >= 2.7.0, < 3.0.0 -python_dateutil >= 2.8.2 pydantic >= 2.11 typing-extensions >= 4.7.1 diff --git a/samples/client/echo_api/python/setup.py b/samples/client/echo_api/python/setup.py index 20494a74d591..75da1b9caf6f 100644 --- a/samples/client/echo_api/python/setup.py +++ b/samples/client/echo_api/python/setup.py @@ -24,7 +24,6 @@ PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ "urllib3 >= 2.7.0, < 3.0.0", - "python-dateutil >= 2.8.2", "pydantic >= 2.11", "typing-extensions >= 4.7.1", ] diff --git a/samples/client/echo_api/python/test-requirements.txt b/samples/client/echo_api/python/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/client/echo_api/python/test-requirements.txt +++ b/samples/client/echo_api/python/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py index 5302b6c1ebec..e3578052770d 100644 --- a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py +++ b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -888,9 +887,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -906,9 +903,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/client/others/python-legacy-model-dictionaries/pyproject.toml b/samples/client/others/python-legacy-model-dictionaries/pyproject.toml index 5f5e6b8ae3d5..326d3637de52 100644 --- a/samples/client/others/python-legacy-model-dictionaries/pyproject.toml +++ b/samples/client/others/python-legacy-model-dictionaries/pyproject.toml @@ -11,7 +11,6 @@ requires-python = ">=3.11" dependencies = [ "urllib3 (>=2.7.0,<3.0.0)", - "python-dateutil (>=2.8.2)", "pydantic (>=2.11)", "typing-extensions (>=4.7.1)", ] @@ -25,7 +24,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/client/others/python-legacy-model-dictionaries/requirements.txt b/samples/client/others/python-legacy-model-dictionaries/requirements.txt index 1d751a9a2254..c87436ff6c03 100644 --- a/samples/client/others/python-legacy-model-dictionaries/requirements.txt +++ b/samples/client/others/python-legacy-model-dictionaries/requirements.txt @@ -1,4 +1,3 @@ urllib3 >= 2.7.0, < 3.0.0 -python_dateutil >= 2.8.2 pydantic >= 2.11 typing-extensions >= 4.7.1 diff --git a/samples/client/others/python-legacy-model-dictionaries/setup.py b/samples/client/others/python-legacy-model-dictionaries/setup.py index d18c5efcc6cf..c34229925953 100644 --- a/samples/client/others/python-legacy-model-dictionaries/setup.py +++ b/samples/client/others/python-legacy-model-dictionaries/setup.py @@ -23,7 +23,6 @@ PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ "urllib3 >= 2.7.0, < 3.0.0", - "python-dateutil >= 2.8.2", "pydantic >= 2.11", "typing-extensions >= 4.7.1", ] diff --git a/samples/client/others/python-legacy-model-dictionaries/test-requirements.txt b/samples/client/others/python-legacy-model-dictionaries/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/client/others/python-legacy-model-dictionaries/test-requirements.txt +++ b/samples/client/others/python-legacy-model-dictionaries/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py index 249166feb5ba..b06adc80cc9e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -814,9 +813,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -832,9 +829,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml index bcf671a77754..38c590c79d4e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml +++ b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml @@ -11,7 +11,6 @@ include = ["petstore_api/py.typed"] [tool.poetry.dependencies] python = "^3.11" -python-dateutil = ">= 2.8.2" aiohttp = ">= 3.14.1" aiohttp-retry = ">= 2.8.3" pem = ">= 19.3.0" @@ -24,7 +23,6 @@ pytest = ">= 9.0.3" pytest-cov = ">= 2.8.1" tox = ">= 3.9.0" flake8 = ">= 4.0.0" -types-python-dateutil = ">= 2.8.19.14" mypy = ">= 1.5" diff --git a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt index baeace9e16c0..d3c66dacd5b3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt +++ b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt @@ -1,4 +1,3 @@ -python_dateutil >= 2.8.2 aiohttp >= 3.14.1 aiohttp-retry >= 2.8.3 pem >= 19.3.0 diff --git a/samples/openapi3/client/petstore/python-aiohttp/setup.py b/samples/openapi3/client/petstore/python-aiohttp/setup.py index 662f156c19cf..cb18d62c771a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/setup.py +++ b/samples/openapi3/client/petstore/python-aiohttp/setup.py @@ -22,7 +22,6 @@ VERSION = "1.0.0" PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ - "python-dateutil >= 2.8.2", "aiohttp >= 3.14.1", "aiohttp-retry >= 2.8.3", "pem >= 19.3.0", diff --git a/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt b/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py index 43782b4ec85b..8a3cb459e598 100644 --- a/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -817,9 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -835,9 +832,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx-sync/pyproject.toml b/samples/openapi3/client/petstore/python-httpx-sync/pyproject.toml index 15b2a10b849b..c629f14e6ddf 100644 --- a/samples/openapi3/client/petstore/python-httpx-sync/pyproject.toml +++ b/samples/openapi3/client/petstore/python-httpx-sync/pyproject.toml @@ -11,7 +11,6 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] requires-python = ">=3.11" dependencies = [ - "python-dateutil (>=2.8.2)", "httpx (>=0.28.1)", "pem (>=19.3.0)", "pycryptodome (>=3.9.0)", @@ -28,7 +27,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/openapi3/client/petstore/python-httpx-sync/requirements.txt b/samples/openapi3/client/petstore/python-httpx-sync/requirements.txt index 5aad1e2102b5..d2bc1cc1242f 100644 --- a/samples/openapi3/client/petstore/python-httpx-sync/requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx-sync/requirements.txt @@ -1,4 +1,3 @@ -python_dateutil >= 2.8.2 httpx >= 0.28.1 pem >= 19.3.0 pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-httpx-sync/setup.py b/samples/openapi3/client/petstore/python-httpx-sync/setup.py index e3fbfe697e5a..d90ab663e6b4 100644 --- a/samples/openapi3/client/petstore/python-httpx-sync/setup.py +++ b/samples/openapi3/client/petstore/python-httpx-sync/setup.py @@ -22,7 +22,6 @@ VERSION = "1.0.0" PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ - "python-dateutil >= 2.8.2", "httpx >= 0.28.1", "pem >= 19.3.0", "pycryptodome >= 3.9.0", diff --git a/samples/openapi3/client/petstore/python-httpx-sync/test-requirements.txt b/samples/openapi3/client/petstore/python-httpx-sync/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/openapi3/client/petstore/python-httpx-sync/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx-sync/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py index 43782b4ec85b..8a3cb459e598 100644 --- a/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -817,9 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -835,9 +832,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx/pyproject.toml b/samples/openapi3/client/petstore/python-httpx/pyproject.toml index 15b2a10b849b..c629f14e6ddf 100644 --- a/samples/openapi3/client/petstore/python-httpx/pyproject.toml +++ b/samples/openapi3/client/petstore/python-httpx/pyproject.toml @@ -11,7 +11,6 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] requires-python = ">=3.11" dependencies = [ - "python-dateutil (>=2.8.2)", "httpx (>=0.28.1)", "pem (>=19.3.0)", "pycryptodome (>=3.9.0)", @@ -28,7 +27,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/openapi3/client/petstore/python-httpx/requirements.txt b/samples/openapi3/client/petstore/python-httpx/requirements.txt index 5aad1e2102b5..d2bc1cc1242f 100644 --- a/samples/openapi3/client/petstore/python-httpx/requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx/requirements.txt @@ -1,4 +1,3 @@ -python_dateutil >= 2.8.2 httpx >= 0.28.1 pem >= 19.3.0 pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-httpx/setup.py b/samples/openapi3/client/petstore/python-httpx/setup.py index e3fbfe697e5a..d90ab663e6b4 100644 --- a/samples/openapi3/client/petstore/python-httpx/setup.py +++ b/samples/openapi3/client/petstore/python-httpx/setup.py @@ -22,7 +22,6 @@ VERSION = "1.0.0" PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ - "python-dateutil >= 2.8.2", "httpx >= 0.28.1", "pem >= 19.3.0", "pycryptodome >= 3.9.0", diff --git a/samples/openapi3/client/petstore/python-httpx/test-requirements.txt b/samples/openapi3/client/petstore/python-httpx/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/openapi3/client/petstore/python-httpx/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py index 43782b4ec85b..8a3cb459e598 100644 --- a/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -817,9 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -835,9 +832,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx2-sync/pyproject.toml b/samples/openapi3/client/petstore/python-httpx2-sync/pyproject.toml index d0c97fcd113f..408d77dc016c 100644 --- a/samples/openapi3/client/petstore/python-httpx2-sync/pyproject.toml +++ b/samples/openapi3/client/petstore/python-httpx2-sync/pyproject.toml @@ -11,7 +11,6 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] requires-python = ">=3.11" dependencies = [ - "python-dateutil (>=2.8.2)", "httpx2 (>=2.13.0,<3)", "pem (>=19.3.0)", "pycryptodome (>=3.9.0)", @@ -28,7 +27,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/openapi3/client/petstore/python-httpx2-sync/requirements.txt b/samples/openapi3/client/petstore/python-httpx2-sync/requirements.txt index ccf3d0aa899d..5ff966127b23 100644 --- a/samples/openapi3/client/petstore/python-httpx2-sync/requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx2-sync/requirements.txt @@ -1,4 +1,3 @@ -python_dateutil >= 2.8.2 httpx2 >= 2.13.0, < 3 pem >= 19.3.0 pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-httpx2-sync/setup.py b/samples/openapi3/client/petstore/python-httpx2-sync/setup.py index def9367fbbd0..49098a46d17b 100644 --- a/samples/openapi3/client/petstore/python-httpx2-sync/setup.py +++ b/samples/openapi3/client/petstore/python-httpx2-sync/setup.py @@ -22,7 +22,6 @@ VERSION = "1.0.0" PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ - "python-dateutil >= 2.8.2", "httpx2 >= 2.13.0, < 3", "pem >= 19.3.0", "pycryptodome >= 3.9.0", diff --git a/samples/openapi3/client/petstore/python-httpx2-sync/test-requirements.txt b/samples/openapi3/client/petstore/python-httpx2-sync/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/openapi3/client/petstore/python-httpx2-sync/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx2-sync/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py index 43782b4ec85b..8a3cb459e598 100644 --- a/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -817,9 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -835,9 +832,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx2/pyproject.toml b/samples/openapi3/client/petstore/python-httpx2/pyproject.toml index d0c97fcd113f..408d77dc016c 100644 --- a/samples/openapi3/client/petstore/python-httpx2/pyproject.toml +++ b/samples/openapi3/client/petstore/python-httpx2/pyproject.toml @@ -11,7 +11,6 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] requires-python = ">=3.11" dependencies = [ - "python-dateutil (>=2.8.2)", "httpx2 (>=2.13.0,<3)", "pem (>=19.3.0)", "pycryptodome (>=3.9.0)", @@ -28,7 +27,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/openapi3/client/petstore/python-httpx2/requirements.txt b/samples/openapi3/client/petstore/python-httpx2/requirements.txt index ccf3d0aa899d..5ff966127b23 100644 --- a/samples/openapi3/client/petstore/python-httpx2/requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx2/requirements.txt @@ -1,4 +1,3 @@ -python_dateutil >= 2.8.2 httpx2 >= 2.13.0, < 3 pem >= 19.3.0 pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-httpx2/setup.py b/samples/openapi3/client/petstore/python-httpx2/setup.py index def9367fbbd0..49098a46d17b 100644 --- a/samples/openapi3/client/petstore/python-httpx2/setup.py +++ b/samples/openapi3/client/petstore/python-httpx2/setup.py @@ -22,7 +22,6 @@ VERSION = "1.0.0" PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ - "python-dateutil >= 2.8.2", "httpx2 >= 2.13.0, < 3", "pem >= 19.3.0", "pycryptodome >= 3.9.0", diff --git a/samples/openapi3/client/petstore/python-httpx2/test-requirements.txt b/samples/openapi3/client/petstore/python-httpx2/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/openapi3/client/petstore/python-httpx2/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-httpx2/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py index e94f64789c50..da6efcf68748 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -814,9 +813,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -832,9 +829,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-lazyImports/pyproject.toml b/samples/openapi3/client/petstore/python-lazyImports/pyproject.toml index 763ab84520b5..6252f277b166 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/pyproject.toml +++ b/samples/openapi3/client/petstore/python-lazyImports/pyproject.toml @@ -12,7 +12,6 @@ requires-python = ">=3.11" dependencies = [ "urllib3 (>=2.7.0,<3.0.0)", - "python-dateutil (>=2.8.2)", "pem (>=19.3.0)", "pycryptodome (>=3.9.0)", "pydantic (>=2.11)", @@ -28,7 +27,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/openapi3/client/petstore/python-lazyImports/requirements.txt b/samples/openapi3/client/petstore/python-lazyImports/requirements.txt index 05db0e110efc..e4535242c033 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/requirements.txt +++ b/samples/openapi3/client/petstore/python-lazyImports/requirements.txt @@ -1,5 +1,4 @@ urllib3 >= 2.7.0, < 3.0.0 -python_dateutil >= 2.8.2 pem >= 19.3.0 pycryptodome >= 3.9.0 pydantic >= 2.11 diff --git a/samples/openapi3/client/petstore/python-lazyImports/setup.py b/samples/openapi3/client/petstore/python-lazyImports/setup.py index 0e0385045013..7939213acc54 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/setup.py +++ b/samples/openapi3/client/petstore/python-lazyImports/setup.py @@ -23,7 +23,6 @@ PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ "urllib3 >= 2.7.0, < 3.0.0", - "python-dateutil >= 2.8.2", "pem >= 19.3.0", "pycryptodome >= 3.9.0", "pydantic >= 2.11", diff --git a/samples/openapi3/client/petstore/python-lazyImports/test-requirements.txt b/samples/openapi3/client/petstore/python-lazyImports/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-lazyImports/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python-lazyImports/tests/test_api_client.py b/samples/openapi3/client/petstore/python-lazyImports/tests/test_api_client.py index cb0ed9080f51..db8b648e8309 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/tests/test_api_client.py +++ b/samples/openapi3/client/petstore/python-lazyImports/tests/test_api_client.py @@ -13,7 +13,7 @@ from decimal import Decimal from enum import Enum -from dateutil.parser import parse +import datetime import petstore_api import petstore_api.configuration @@ -172,12 +172,12 @@ def test_sanitize_for_serialization_bool(self): self.assertEqual(result, data) def test_sanitize_for_serialization_date(self): - data = parse("1997-07-16").date() # date + data = datetime.date.fromisoformat("1997-07-16") # date result = self.api_client.sanitize_for_serialization(data) self.assertEqual(result, "1997-07-16") def test_sanitize_for_serialization_datetime(self): - data = parse("1997-07-16T19:20:30.45+01:00") # datetime + data = datetime.datetime.fromisoformat("1997-07-16T19:20:30.45+01:00") # datetime result = self.api_client.sanitize_for_serialization(data) self.assertEqual(result, "1997-07-16T19:20:30.450000+01:00") diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 5b6101731ba0..0e3c9adbfe31 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -12,7 +12,6 @@ import datetime -from dateutil.parser import parse from enum import Enum import decimal import json @@ -814,9 +813,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return parse(string).date() - except ImportError: - return string + return datetime.date.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, @@ -832,9 +829,7 @@ def __deserialize_datetime(self, string): :return: datetime. """ try: - return parse(string) - except ImportError: - return string + return datetime.datetime.fromisoformat(string) except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python/pyproject.toml b/samples/openapi3/client/petstore/python/pyproject.toml index 763ab84520b5..6252f277b166 100644 --- a/samples/openapi3/client/petstore/python/pyproject.toml +++ b/samples/openapi3/client/petstore/python/pyproject.toml @@ -12,7 +12,6 @@ requires-python = ">=3.11" dependencies = [ "urllib3 (>=2.7.0,<3.0.0)", - "python-dateutil (>=2.8.2)", "pem (>=19.3.0)", "pycryptodome (>=3.9.0)", "pydantic (>=2.11)", @@ -28,7 +27,6 @@ dev = [ "pytest-cov>=2.8.1", "tox>=3.9.0", "flake8>=4.0.0", - "types-python-dateutil>=2.8.19.14", "mypy>=1.5", ] diff --git a/samples/openapi3/client/petstore/python/requirements.txt b/samples/openapi3/client/petstore/python/requirements.txt index 05db0e110efc..e4535242c033 100755 --- a/samples/openapi3/client/petstore/python/requirements.txt +++ b/samples/openapi3/client/petstore/python/requirements.txt @@ -1,5 +1,4 @@ urllib3 >= 2.7.0, < 3.0.0 -python_dateutil >= 2.8.2 pem >= 19.3.0 pycryptodome >= 3.9.0 pydantic >= 2.11 diff --git a/samples/openapi3/client/petstore/python/setup.py b/samples/openapi3/client/petstore/python/setup.py index 0e0385045013..7939213acc54 100755 --- a/samples/openapi3/client/petstore/python/setup.py +++ b/samples/openapi3/client/petstore/python/setup.py @@ -23,7 +23,6 @@ PYTHON_REQUIRES = ">= 3.11" REQUIRES = [ "urllib3 >= 2.7.0, < 3.0.0", - "python-dateutil >= 2.8.2", "pem >= 19.3.0", "pycryptodome >= 3.9.0", "pydantic >= 2.11", diff --git a/samples/openapi3/client/petstore/python/test-requirements.txt b/samples/openapi3/client/petstore/python/test-requirements.txt index 9cb0629aded0..6aa50ccfb06e 100755 --- a/samples/openapi3/client/petstore/python/test-requirements.txt +++ b/samples/openapi3/client/petstore/python/test-requirements.txt @@ -2,5 +2,4 @@ pytest >= 9.0.3 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 -types-python-dateutil >= 2.8.19.14 mypy >= 1.5 diff --git a/samples/openapi3/client/petstore/python/tests/test_api_client.py b/samples/openapi3/client/petstore/python/tests/test_api_client.py index cea1e548dd31..c14d975076b0 100644 --- a/samples/openapi3/client/petstore/python/tests/test_api_client.py +++ b/samples/openapi3/client/petstore/python/tests/test_api_client.py @@ -13,7 +13,7 @@ from decimal import Decimal from enum import Enum -from dateutil.parser import parse +import datetime import petstore_api import petstore_api.configuration @@ -172,12 +172,12 @@ def test_sanitize_for_serialization_bool(self): self.assertEqual(result, data) def test_sanitize_for_serialization_date(self): - data = parse("1997-07-16").date() # date + data = datetime.date.fromisoformat("1997-07-16") # date result = self.api_client.sanitize_for_serialization(data) self.assertEqual(result, "1997-07-16") def test_sanitize_for_serialization_datetime(self): - data = parse("1997-07-16T19:20:30.45+01:00") # datetime + data = datetime.datetime.fromisoformat("1997-07-16T19:20:30.45+01:00") # datetime result = self.api_client.sanitize_for_serialization(data) self.assertEqual(result, "1997-07-16T19:20:30.450000+01:00") @@ -318,7 +318,7 @@ def test_parameters_to_url_query_quotes_reserved_characters_in_names(self): def test_explode_query_object(self): # one pair per entry; a list repeats the name, None is left out, values are serialized - params = self.api_client.explode_query_object('filter', {'a': 'b', 'k': None, 'l': ['x', None, 2], 'd': parse('2020-01-02').date()}) + params = self.api_client.explode_query_object('filter', {'a': 'b', 'k': None, 'l': ['x', None, 2], 'd': datetime.date.fromisoformat('2020-01-02')}) self.assertEqual(params, [('a', 'b'), ('l', 'x'), ('l', 2), ('d', '2020-01-02')]) def test_explode_query_object_model(self): From 0d7f9fc94e5ac4ef1851eab5de464032c0cc4df9 Mon Sep 17 00:00:00 2001 From: timonrieger Date: Sat, 14 Nov 2026 17:35:15 +0100 Subject: [PATCH 2/2] [python] Accept datetime strings when deserializing dates dateutil's parse(string).date() accepted datetime-shaped strings for date values. datetime.date.fromisoformat rejects them, so parse via datetime.datetime.fromisoformat(string).date(), which accepts both. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XR83Jm91yXcaupiSTHCXnZ --- .../src/main/resources/python/api_client.mustache | 2 +- .../openapi_client/api_client.py | 2 +- samples/client/echo_api/python/openapi_client/api_client.py | 2 +- .../legacy_model_dict_client/api_client.py | 2 +- .../client/petstore/python-aiohttp/petstore_api/api_client.py | 2 +- .../petstore/python-httpx-sync/petstore_api/api_client.py | 2 +- .../client/petstore/python-httpx/petstore_api/api_client.py | 2 +- .../petstore/python-httpx2-sync/petstore_api/api_client.py | 2 +- .../client/petstore/python-httpx2/petstore_api/api_client.py | 2 +- .../petstore/python-lazyImports/petstore_api/api_client.py | 2 +- .../openapi3/client/petstore/python/petstore_api/api_client.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 6e8975f22a08..b15d7df20952 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -972,7 +972,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py index f60978385444..764e06a2fde4 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/api_client.py @@ -806,7 +806,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/client/echo_api/python/openapi_client/api_client.py b/samples/client/echo_api/python/openapi_client/api_client.py index f60978385444..764e06a2fde4 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -806,7 +806,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py index e3578052770d..d0579fafd2f3 100644 --- a/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py +++ b/samples/client/others/python-legacy-model-dictionaries/legacy_model_dict_client/api_client.py @@ -887,7 +887,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py index b06adc80cc9e..4a4853774b22 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py @@ -813,7 +813,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py index 8a3cb459e598..23b1e6e66788 100644 --- a/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx-sync/petstore_api/api_client.py @@ -816,7 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py index 8a3cb459e598..23b1e6e66788 100644 --- a/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx/petstore_api/api_client.py @@ -816,7 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py index 8a3cb459e598..23b1e6e66788 100644 --- a/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx2-sync/petstore_api/api_client.py @@ -816,7 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py index 8a3cb459e598..23b1e6e66788 100644 --- a/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-httpx2/petstore_api/api_client.py @@ -816,7 +816,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py index da6efcf68748..d4a3e771d206 100644 --- a/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-lazyImports/petstore_api/api_client.py @@ -813,7 +813,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0, diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 0e3c9adbfe31..05745b0b39b0 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -813,7 +813,7 @@ def __deserialize_date(self, string): :return: date. """ try: - return datetime.date.fromisoformat(string) + return datetime.datetime.fromisoformat(string).date() except ValueError: raise rest.ApiException( status=0,