Skip to content

Commit

Permalink
Add a temporary workaround to get original type despite custom serial…
Browse files Browse the repository at this point in the history
…ization
  • Loading branch information
Fatal1ty committed Nov 23, 2024
1 parent fcfe2d3 commit 98c1a27
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mashumaro/jsonschema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class Instance:
__owner_builder: Optional[CodeBuilder] = None
__self_builder: Optional[CodeBuilder] = None

# Original type despite custom serialization. To be revised.
_original_type: Type = field(init=False)

origin_type: Type = field(init=False)
annotations: list[Annotation] = field(init=False, default_factory=list)

Expand Down Expand Up @@ -150,6 +153,7 @@ def derive(self, **changes: Any) -> "Instance":
return new_instance

def __post_init__(self) -> None:
self._original_type = self.type
self.update_type(self.type)
if is_annotated(self.type):
self.annotations = getattr(self.type, "__metadata__", [])
Expand Down

0 comments on commit 98c1a27

Please sign in to comment.