We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6590ee7 commit 1039b57Copy full SHA for 1039b57
1 file changed
src/murfey/cli/generate_route_manifest.py
@@ -39,17 +39,17 @@ def extract_base_type(annotation):
39
The unwrapped base type, or the original annotation if no unambiguous base
40
type can be determined.
41
"""
42
- # Unwrap Annotated
+ # Unwrap Annotated type annotations
43
if get_origin(annotation) is Annotated:
44
annotation = get_args(annotation)[0]
45
46
- # Unwrap Optional / Union:param
47
- origin = get_origin(annotation)
48
- if origin is Union:
+ # Unwrap and return single-type Optional type annotations
+ if get_origin(annotation) is Union:
49
args = [a for a in get_args(annotation) if a is not type(None)]
50
if len(args) == 1:
51
return args[0]
52
+ # Return complex multi-type annotations or simple unpacked ones
53
return annotation
54
55
0 commit comments