is it possible to get prefect to take in a boolean parameter? Or do all parameters need to be strings?
k
Kevin Kho
02/09/2022, 5:08 AM
They just need to be JSONSerializable. Pretty sure it can be a boolean. You running into something?
k
Kevin
02/09/2022, 5:09 AM
haven't run into an error yet. but I've been trying to search documentation on boolean parameters and couldnt find anything. Ideally, the prefect UI would show a toggle switch and not a text box for this parameter to signify theres only 2 options
k
Kevin Kho
02/09/2022, 5:11 AM
@Marvin open “Feature Request: Toggle switch for Boolean Parameters” in UI
Are you expecting a registered Flow Parameter’s type to be inferred and the display changed in the UI? So that is not possible. But if you select a Parameter in the UI, there is a Radio button that shows up
Because everything is JSONSerialized so there is no inherent type
a
Andrea Haessly
02/09/2022, 9:54 PM
if I set a default value for a parameter, in the UI it will have selected a type. I'd like to specify in the code what type the parameter should be without having to specify a default value. Is that possible?
k
Kevin Kho
02/09/2022, 10:03 PM
Not for current Prefect, but yes this is readily available in Prefect 2.0 (Orion) where type annotations of your tasks are used to coerce the inputs.