Skip to content

Type asset_expression on the API side so the UI doesn't cast through unknown #67692

@Lee-W

Description

@Lee-W

Body

The UI endpoints that return asset_expression declare it as dict | None on the Python datamodel — datamodels/dags.py, datamodels/ui/dags.py, datamodels/ui/assets.py, datamodels/ui/partitioned_dag_runs.py. OpenAPI gen turns this into { [k: string]: unknown } | null in the generated TypeScript, so the UI hand-writes an ExpressionType discriminated union in src/components/AssetExpression/ and the consumers (AssetProgressCell.tsx, pages/DagsList/AssetSchedule.tsx) cast unknown as ExpressionType with no runtime check.

If the server-side shape ever changes the TypeScript build won't catch it — the failure mode is a blank render or a discriminator-missing crash at runtime.

from #64571 (comment)

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:UIRelated to UI/UX. For Frontend Developers.kind:featureFeature Requestskind:metaHigh-level information important to the community

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions