diff --git a/modules/openapi-generator/src/main/resources/python/model_anyof.mustache b/modules/openapi-generator/src/main/resources/python/model_anyof.mustache index 874886b2ed1a..bbdaea4b310a 100644 --- a/modules/openapi-generator/src/main/resources/python/model_anyof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_anyof.mustache @@ -183,10 +183,8 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#vendorExtensions.x-py-postponed-model-imports.size}} {{#vendorExtensions.x-py-postponed-model-imports}} -from typing import TYPE_CHECKING -if TYPE_CHECKING: - {{{.}}} - # TODO: pydantic v2 +{{{.}}} {{/vendorExtensions.x-py-postponed-model-imports}} - # {{classname}}.model_rebuild() +# TODO: Rewrite to not use raise_errors +{{classname}}.model_rebuild(raise_errors=False) {{/vendorExtensions.x-py-postponed-model-imports.size}} diff --git a/modules/openapi-generator/src/main/resources/python/model_generic.mustache b/modules/openapi-generator/src/main/resources/python/model_generic.mustache index 3a17ae1c82a2..5eaaf29d2187 100644 --- a/modules/openapi-generator/src/main/resources/python/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_generic.mustache @@ -378,9 +378,6 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#vendorExtensions.x-py-postponed-model-imports}} {{{.}}} {{/vendorExtensions.x-py-postponed-model-imports}} -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # {{classname}}.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +{{classname}}.model_rebuild(raise_errors=False) {{/vendorExtensions.x-py-postponed-model-imports.size}} diff --git a/modules/openapi-generator/src/main/resources/python/model_oneof.mustache b/modules/openapi-generator/src/main/resources/python/model_oneof.mustache index 4c26feccf65d..4fb47c8c8747 100644 --- a/modules/openapi-generator/src/main/resources/python/model_oneof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_oneof.mustache @@ -207,10 +207,8 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#vendorExtensions.x-py-postponed-model-imports.size}} {{#vendorExtensions.x-py-postponed-model-imports}} -from typing import TYPE_CHECKING -if TYPE_CHECKING: - {{{.}}} - # TODO: pydantic v2 +{{{.}}} {{/vendorExtensions.x-py-postponed-model-imports}} - # {{classname}}.model_rebuild() +# TODO: Rewrite to not use raise_errors +{{classname}}.model_rebuild(raise_errors=False) {{/vendorExtensions.x-py-postponed-model-imports.size}} diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py index 20ac6fa84424..fe213c1e1a26 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py @@ -104,9 +104,6 @@ def from_dict(cls, obj: Dict) -> Union[Self, Self]: from petstore_api.models.cat import Cat from petstore_api.models.dog import Dog -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # Animal.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +Animal.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py index e095b779611b..8176d68569fd 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py @@ -90,9 +90,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.first_ref import FirstRef -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # CircularReferenceModel.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +CircularReferenceModel.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py index f04e2ae95008..288287f975f9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py @@ -90,9 +90,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.self_reference_model import SelfReferenceModel -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # DummyModel.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +DummyModel.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py index b976f122f4e3..cc442eca85bb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py @@ -90,9 +90,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.second_ref import SecondRef -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # FirstRef.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +FirstRef.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py index a602e3ca7e18..412be9274557 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py @@ -90,9 +90,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.circular_reference_model import CircularReferenceModel -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # SecondRef.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +SecondRef.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py index 00a4f44b5552..1fb606fba4a3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py @@ -90,9 +90,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.dummy_model import DummyModel -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # SelfReferenceModel.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +SelfReferenceModel.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python/petstore_api/models/animal.py index 73c342cf2376..72b86942d9c1 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/animal.py @@ -112,9 +112,6 @@ def from_dict(cls, obj: Dict) -> Union[Self, Self]: from petstore_api.models.cat import Cat from petstore_api.models.dog import Dog -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # Animal.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +Animal.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py index ca3f50a3f0d7..5d753c240374 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py @@ -103,9 +103,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.first_ref import FirstRef -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # CircularReferenceModel.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +CircularReferenceModel.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py index 2f2315a7c381..c54d487cadc0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py @@ -103,9 +103,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.self_reference_model import SelfReferenceModel -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # DummyModel.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +DummyModel.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py index 37d913e32811..3711a163b052 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py @@ -103,9 +103,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.second_ref import SecondRef -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # FirstRef.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +FirstRef.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py index ec009e46ffb1..6dc55f9a6233 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py @@ -103,9 +103,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.circular_reference_model import CircularReferenceModel -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # SecondRef.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +SecondRef.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py index 53d88067a458..fda9fb712fb7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py @@ -103,9 +103,6 @@ def from_dict(cls, obj: Dict) -> Self: return _obj from petstore_api.models.dummy_model import DummyModel -from typing import TYPE_CHECKING -if TYPE_CHECKING: - # TODO: pydantic v2 - # SelfReferenceModel.model_rebuild() - pass +# TODO: Rewrite to not use raise_errors +SelfReferenceModel.model_rebuild(raise_errors=False) diff --git a/samples/openapi3/client/petstore/python/tests/test_model.py b/samples/openapi3/client/petstore/python/tests/test_model.py index c41bfe8e7538..c96ec890acc2 100644 --- a/samples/openapi3/client/petstore/python/tests/test_model.py +++ b/samples/openapi3/client/petstore/python/tests/test_model.py @@ -560,7 +560,6 @@ def test_object_with_additional_properties(self): # should not throw the following errors: # pydantic.errors.ConfigError: field "additional_properties" not yet prepared so type is still a ForwardRef, you might need to call ObjectToTestAdditionalProperties.update_forward_refs(). - @unittest.skip("TODO: pydantic v2: fix circular dependencies between CircularReferenceModel, FirstRef, SecondRef") def test_first_ref(self): # shouldn't throw "still a ForwardRef" error a = petstore_api.FirstRef.from_dict({})