diff --git a/aiopenapi3/v20/general.py b/aiopenapi3/v20/general.py index 8f93bda7..ad07831a 100644 --- a/aiopenapi3/v20/general.py +++ b/aiopenapi3/v20/general.py @@ -1,5 +1,5 @@ import typing -from typing import Optional, Any +from typing import Optional, Any, Union from pydantic import Field, ConfigDict, PrivateAttr @@ -7,7 +7,8 @@ from ..base import ObjectExtended, ObjectBase, ReferenceBase if typing.TYPE_CHECKING: - from .._types import SchemaType + from .schemas import Schema + from .parameter import Parameter class ExternalDocumentation(ObjectExtended): @@ -31,7 +32,7 @@ class Reference(ObjectBase, ReferenceBase): ref: str = Field(alias="$ref") - _target: "SchemaType" = PrivateAttr() + _target: Union["Schema", "Parameter", "Reference"] = PrivateAttr(default=None) model_config = ConfigDict(extra="ignore") diff --git a/aiopenapi3/v30/general.py b/aiopenapi3/v30/general.py index 808e26f4..d4dc171f 100644 --- a/aiopenapi3/v30/general.py +++ b/aiopenapi3/v30/general.py @@ -33,7 +33,7 @@ class Reference(ObjectBase, ReferenceBase): ref: str = Field(alias="$ref") - _target: Union["Schema", "Parameter", "Reference"] = PrivateAttr() + _target: Union["Schema", "Parameter", "Reference"] = PrivateAttr(default=None) model_config = ConfigDict( extra="ignore", # """This object cannot be extended with additional properties and any properties added SHALL be ignored.""" diff --git a/aiopenapi3/v31/general.py b/aiopenapi3/v31/general.py index b612888b..7a681e06 100644 --- a/aiopenapi3/v31/general.py +++ b/aiopenapi3/v31/general.py @@ -34,7 +34,7 @@ class Reference(ObjectBase, ReferenceBase): summary: Optional[str] = Field(default=None) description: Optional[str] = Field(default=None) - _target: Union["Schema", "Parameter", "Reference", "PathItem"] = PrivateAttr() + _target: Union["Schema", "Parameter", "Reference", "PathItem"] = PrivateAttr(default=None) model_config = ConfigDict( # """This object cannot be extended with additional properties and any properties added SHALL be ignored."""