The GitHub Actions job "Tests (AMD)" on airflow.git/type-asset-expression-api 
has failed.
Run started by GitHub user Anuragp22 (triggered by Anuragp22).

Head commit for run:
622dc919580f8c127882f6ae65eea6256db9abe6 / Anuragp22 <[email protected]>
Type asset_expression in the REST API instead of an untyped dict

asset_expression was declared as `dict | None` on the REST API response
models, so the OpenAPI generator emitted an opaque `{ [k: string]: unknown }`
and the UI hand-maintained an ExpressionType union and cast the value through
it with no runtime check. A change to the server shape would not be caught by
the TypeScript build.

This adds a structured, recursive AssetExpression model in
datamodels/common.py: a discriminated union over the five shapes
BaseAsset.as_expression() produces (asset, alias, asset_ref, any, all),
following the existing Annotated[Union[...], Discriminator] pattern. It is
used on every response that serves the field (DAG details, DAGs with latest
runs, and both partitioned dag run responses), types the next_run_assets UI
endpoint with a NextRunAssetsResponse model, regenerates the OpenAPI spec and
the TypeScript client, and removes the now-redundant hand-written union and
casts in the UI.

The asset leaf carries the optional id that DagModelOperation injects on
persistence; id is optional so a row written before id-enrichment, or
migrated from the pre-3.0 dataset format, still validates. For expressions
produced by current code the emitted JSON is unchanged, so this is not a
breaking change for API consumers; only the declared schema becomes precise.

The test_get_dags fixtures previously set asset_expression to a simplified
`{"any": [{"uri": ...}]}` shape that as_expression() never produces. That was
harmless against an untyped dict but the structured model correctly rejects
the bare leaf, so the fixtures now use the real `{"any": [{"asset": {...}}]}`
shape with each asset's name and group.

Report URL: https://github.com/apache/airflow/actions/runs/26795408262

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to