When I set up parameters for a Deployment in the U...
# prefect-ui
t
When I set up parameters for a Deployment in the UI, I specify one of the parameters as type dict, for some reason the UI is saying it is an object and it treats it as a json instead. I can always load the json into a dict in the code, but I was wondering if I am doing something wrong.
1
z
We should automatically be coercing the JSON to a dictionary at runtime for you, is this not happening?
t
no
z
Could you share a short example that prints the value of the parameter at runtime and includes the value you’ve set via the UI? We’ve got some WIP for improving the UI import forms here as well.
You can also check the schema that will get generated for your flow function:
Copy code
from prefect.utilities.callables import parameter_schema

parameter_schema(my_flow)
t
Copy code
@flow
def run(
	sf_session_id: str=None,
	db_config: dict=None,
	sobjects: str or list=None,
	method_: str='run',
	run_local: bool=False,
	# *args, 
	# **kwargs,
):
Copy code
title='Parameters' type='object' properties={'sf_session_id': {'title': 'sf_session_id', 'type': 'string'}, 'db_config': {'title': 'db_config', 'type': '
object'}, 'sobjects': {'title': 'sobjects', 'type': 'string'}, 'method_': {'title': 'method_', 'default': 'run', 'type': 'string'}, 'run_local': {'title'
: 'run_local', 'default': False, 'type': 'boolean'}} required=None definitions=None
it says is is an object
which "jsonifies" the dict i put in the UI
- db_config: value is not a valid dict
z
It needs to be sent as JSON, this actually looks like a client side bug in that it should parse this but doesn't try to. I'll open an issue. Thanks for reporting this!
t
Np, thanks!
Hi Michael, any updates on this bug?