Hi, is it possible to have a `typing.Optional` inp...
# ask-the-community
g
Hi, is it possible to have a
typing.Optional
input to a workflow?
Copy code
@workflow
def wf(foo: Optional[str]):
    ...
gives me:
Copy code
Missing option '--foo'.
k
yes, try
Copy code
@workflow
def wf(foo: Optional[str] = None):
    ...
g
Ah sorry I simplified my example a bit too much, Iā€™m using:
Copy code
def wf(foo: Optional[list[str]] = None):
Should I use a different default?
When trying
[]
instead of `None`:
Copy code
Invalid value for '--foo': Failed to convert param <Option foo>, [] to typing.Optional[typing.List[str]]
Adding any string to the list and using that as default seems to work, not the prettiest but can progress with that šŸ™‚ :
Copy code
def wf(foo: Optional[list[str]] = [""]):
k
odd. might creating a issue for it. [flyte-bug]
r
Was a bug created for this? I'm encountering the same issue.