diff --git a/pkgs/clan-cli/clan_lib/api/type_to_jsonschema.py b/pkgs/clan-cli/clan_lib/api/type_to_jsonschema.py index b4dda26a1..04bd49de6 100644 --- a/pkgs/clan-cli/clan_lib/api/type_to_jsonschema.py +++ b/pkgs/clan-cli/clan_lib/api/type_to_jsonschema.py @@ -13,6 +13,7 @@ from typing import ( NewType, NotRequired, Required, + TypeAliasType, TypeVar, Union, get_args, @@ -239,6 +240,12 @@ def type_to_dict( origtype = t.__supertype__ return type_to_dict(origtype, scope, type_map) + if isinstance(t, TypeAliasType): + # Handle PEP 695 type aliases (type X = Y syntax) + return type_to_dict( + t.__value__, scope, type_map, narrow_unsupported_union_types + ) + if hasattr(t, "__origin__"): # Check if it's a generic type origin = get_origin(t) args = get_args(t)