Skip to content

Commit

Permalink
Fix type alias validation
Browse files Browse the repository at this point in the history
  • Loading branch information
KaQuMiQ authored Apr 17, 2024
1 parent 262c98e commit b638a1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/draive/parameters/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from collections import abc as collections_abc
from collections.abc import Callable, Iterable
from dataclasses import is_dataclass
from typing import Any, ForwardRef, Protocol, TypeVar, get_args, get_origin
from typing import Any, ForwardRef, Protocol, TypeAliasType, TypeVar, get_args, get_origin

import typing_extensions

Expand Down Expand Up @@ -941,6 +941,12 @@ def validated_missing(value: Any) -> Any:
else:
return _any_validator(verifier=verifier)

case type_alias if isinstance(type_alias, TypeAliasType):
return _class_instance_validator(
annotation=type_alias.__value__,
verifier=verifier,
)

case class_type if inspect.isclass(class_type):
return _class_instance_validator(
annotation=class_type,
Expand Down

0 comments on commit b638a1a

Please sign in to comment.