is it possible to get prefect to take in a boolean...
# ask-community
k
is it possible to get prefect to take in a boolean parameter? Or do all parameters need to be strings?
k
They just need to be JSONSerializable. Pretty sure it can be a boolean. You running into something?
k
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
@Marvin open “Feature Request: Toggle switch for Boolean Parameters” in UI
k
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
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
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.