https://prefect.io logo
d

Deceivious

07/19/2023, 12:52 PM
Hello, I have a flow.
Copy code
def flow(a:int,b:str)
How do i disable validation for
b
while keeping the validation for
a
active?
j

Jake Kaplan

07/19/2023, 1:09 PM
If i'm understanding right you can change the type hint for
b
to be whatever you'd like or remove it entirely
Copy code
from prefect import flow
from typing import Any

@flow
def flow(a: int, b: Any):
    print(a, b)


if __name__ == '__main__':
    flow(1, 'b')
    flow(1, 5)
d

Deceivious

07/19/2023, 1:40 PM
Not exactly what I wanted but I think This would work. Let me test
j

Jake Kaplan

07/19/2023, 1:44 PM
are you looking to do something like:
Copy code
@flow
def flow(a: int, b: DontCoerce[str]):
  ...
d

Deceivious

07/19/2023, 1:55 PM
I wanted my
b
to be a Enum type of which the values are computed are baked into the deployment using the open api params. But when i run the flow, the
b
param was being checked and failing.
But I think I can set
b
to str while only modifying the deplyment open api params without any issues.
🙌 1