Skip to content

Commit

Permalink
Allow inline models to return unvalidated types
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object committed Nov 13, 2023
1 parent 90c951b commit 9942e87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hexdoc/model/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class InlineModel(HexdocModel, ABC):
@classmethod
@abstractmethod
def load_id(cls, id: ResourceLocation, context: Any) -> Self:
def load_id(cls, id: ResourceLocation, context: Any) -> Any:
...

@model_validator(mode="wrap")
Expand All @@ -42,14 +42,14 @@ def _wrap_root_load_from_id(

# load the data
context = cast_or_raise(info.context, ValidationContext)
return cls.load_id(id, context)
return handler(cls.load_id(id, context))


@dataclass_transform()
class InlineItemModel(HexdocModel, ABC):
@classmethod
@abstractmethod
def load_id(cls, item: ItemStack, context: Any) -> Self:
def load_id(cls, item: ItemStack, context: Any) -> Any:
...

@model_validator(mode="wrap")
Expand Down Expand Up @@ -77,4 +77,4 @@ def _wrap_root_load_from_id(

# load the data
context = cast_or_raise(info.context, ValidationContext)
return cls.load_id(item, context)
return handler(cls.load_id(item, context))

0 comments on commit 9942e87

Please sign in to comment.