Skip to content

[Bug] Optional[X] type not being handled properly as parameter #236

@cretz

Description

@cretz

Describe the bug

Our check at

if not inspect.isclass(arg_hint) or arg_hint is inspect.Parameter.empty:
that does inspect.isclass is False for typing.Optional (which is an alias for typing.Union). Remove that check. And make sure to write a test accepting an optional parameter (ideally using a Pydantic model as the inner optional value since this is what was originally reported).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions