Skip to content

Commit

Permalink
models/Reference - default value for _target
Browse files Browse the repository at this point in the history
  • Loading branch information
commonism committed Sep 5, 2023
1 parent 4c907c6 commit ed1d544
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions aiopenapi3/v20/general.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import typing
from typing import Optional, Any
from typing import Optional, Any, Union

from pydantic import Field, ConfigDict, PrivateAttr


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):
Expand All @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion aiopenapi3/v30/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion aiopenapi3/v31/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit ed1d544

Please sign in to comment.