Muhammad Ridwan
07/06/2026, 7:21 AMMarvin
07/06/2026, 7:22 AMMarvin
07/06/2026, 7:24 AMpython
from pydantic import BaseModel, ConfigDict, Field
class MyParams(BaseModel):
model_config = ConfigDict(
json_schema_extra={
"dependencies": {
"coupon_code": {
"required": ["approver"]
}
}
}
)
coupon_code: str | None = None
approver: str | None = Field(
default=None,
description="Required if coupon_code is provided"
)
If you want a more conditional UX, the best workaround is usually a discriminated union / separate schema variants, so the user selects a type first and then only sees the relevant fields for that variant.
If you want, I can show you a Prefect-compatible example for:
1. conditional validation, or
2. a discriminated union form that behaves more like conditional fields.Muhammad Ridwan
07/06/2026, 7:38 AMMarvin
07/06/2026, 7:38 AMMarvin
07/06/2026, 7:41 AMpython
from prefect import flow
@flow
def process_file(file_path: str):
with open(file_path, "rb") as f:
data = f.read()
return len(data)
Or for cloud storage:
python
from prefect import flow
@flow
def process_s3_file(bucket: str, key: str):
# load file from S3 inside the flow
...
A note: bytes can exist in the schema, but Prefect’s form UI does not expose it as a real file picker/upload control.
If you want, I can suggest the best pattern depending on whether your files are:
- local files
- S3/GCS/Azure files
- files uploaded by non-technical users through the UIBring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by