<@ULVA73B9P> This is the entrypoint for my deploym...
# ask-marvin
j
@Marvin This is the entrypoint for my deployment:
Copy code
@flow
def insert_missing(local_files: list[dict[str, str]]):
    blah()
Right now, this renders the parameter definition on screen as attached. Is there a way to communicate to Prefect server that each dictionary in the list should have two dialogs, one for the key and one for the value?
m
thought for 44.0 seconds
Yes, you can control how the parameters are rendered in the UI using Pydantic models. Here's how you can modify your flow to specify the structure of the dictionaries:
Copy code
python
from pydantic import BaseModel
from prefect import flow

class FileMapping(BaseModel):
    source_path: str
    destination_path: str

@flow
def insert_missing(local_files: list[FileMapping]):
    blah()
This approach will: 1. Create separate input fields for each dictionary's keys 2. Provide proper validation 3. Allow users to add/remove items from the list in the UI 4. Give you type safety in your code You can also add descriptions and examples to make the UI more user-friendly:
Copy code
python
from pydantic import BaseModel, Field
from prefect import flow

class FileMapping(BaseModel):
    source_path: str = Field(
        description="Path to the source file"
    )
    destination_path: str = Field(
        description="Where the file should be copied to"
    )

@flow
def insert_missing(local_files: list[FileMapping]):
    blah()
The UI will now show a more structured form with clear labels and the ability to add multiple file mappings, each with dedicated fields for source and destination paths. For more details on form building and parameter schemas, check out the Prefect documentation on form building.