https://prefect.io logo
Title
f

Florian Kühnlenz

12/16/2021, 1:05 PM
it seems there is a change to the way parameters are shown in the ui (including a date picker! nice!) Is there any documentation on these? Any release notes?
a

Anna Geller

12/16/2021, 1:11 PM
Wasn’t it this way like for ages? 😄 I don’t see any recent related changes here. Also, this seems rather intuitive - do you have any specific questions about that? I could try answering them and if I can’t I’ll ask the UI team.
😆 1
j

Jenny

12/16/2021, 1:46 PM
Hi Florien, you’re right we updated our json and dict inputs. You should see the related note and PRs in the 2021-12-14 release in the link Anna just shared.
a

Anna Geller

12/16/2021, 1:53 PM
Thanks Jenny, indeed it looks like I missed this one. Again, @Florian Kühnlenz if you have any questions about it, LMK
👍 1
f

Florian Kühnlenz

12/17/2021, 3:08 PM
One more thing, is there a way to set the type used for parameters?
a

Anna Geller

12/17/2021, 3:12 PM
If type validation is what you’re asking, we currently don’t have this for Parameters in Prefect 1.0. However, Orion supports pydantic type validation for parameters.
f

Florian Kühnlenz

12/17/2021, 3:13 PM
No I would just like to be able to set the types used in the ui.
I mean set them from the flow in code.
a

Anna Geller

12/17/2021, 3:15 PM
you can do it already by using specific data types for your default values. If your default parameter value is an integer, then the UI will also show Integer as the default type
As long as your flow code can handle the date type set in the UI, your flow should work fine.
e.g. in my flow code, I have this parameter set as string even though it’s actually a date in isoformat:
expire_at = Parameter("expire_at", default="2021-12-16T00:00:00.000")
The UI then gives me the option whether I want this to be date or string:
f

Florian Kühnlenz

12/17/2021, 4:25 PM
But if I need none as default value to represent a not set value then there is no way currently? Also datetimeparameter does not seem to trigger the date type.
a

Anna Geller

12/17/2021, 4:33 PM
Regardless of which option you choose (e.g. as above Date vs. String), the type is only for the UI so that e.g. a business user would not make a mistake by typing date in a wrong format, but the parameter value passed to your flow will still be a string. Again, I wouldn’t rely too much on that to set specific types, there is no type validation there, it’s only for ease of use when triggering your flows from the UI. The flow code should handle type validation/type casting when needed.
:upvote: 1