dsuhinin commented on PR #76606:
URL: https://github.com/apache/airflow/pull/76606#issuecomment-6707285089
> The screenshots make the bug obvious, and keying enum entries by their
JSON form is the right way to give object choices an identity in react-select.
I verified the value round trip: `toOptionValue` is used for both `options` and
`currentValue`, so `handleChange` maps the selected key back to the original
object instead of submitting the key. Two things I would like addressed before
this merges, both about how that key is produced.
ok, addressed main points and a bit adjust demo Dag, so now configuration
looks like:
```
from __future__ import annotations
import json
from airflow.sdk import DAG, Param, task
ENVS = [
{"name": "dev", "replicas": 1},
{"name": "staging", "replicas": 2},
{"name": "prod", "replicas": 5},
]
with DAG(
"object_enum_demo",
params={
"env": Param(
ENVS[0],
type="object",
enum=ENVS,
values_display={json.dumps(env): env["name"].title() for env in
ENVS},
description="Should render as a dropdown with 3 object choices
(issue #42524).",
),
"envs_multi": Param(
[ENVS[0]],
type="array",
examples=ENVS,
items={"type": "object", "enum": ENVS},
values_display={json.dumps(env): env["name"].title() for env in
ENVS},
description="Multi-select over object choices; items.enum
validates each selected object.",
),
},
) as dag:
@task
def show_params(params=None):
print(f"env={params['env']!r} ({type(params['env']).__name__})")
print(f"envs_multi={params['envs_multi']!r}")
show_params()
```
which produces:
<img width="898" height="869" alt="Screenshot 2026-11-07 at 14 01 30"
src="https://github.com/user-attachments/assets/57153c68-2ad3-4158-81b6-1e3b16efb010"
/>
<img width="913" height="862" alt="Screenshot 2026-11-07 at 14 01 44"
src="https://github.com/user-attachments/assets/395abab2-e631-4d5c-8bdb-3e6ac799989f"
/>
<img width="903" height="875" alt="Screenshot 2026-11-07 at 14 01 58"
src="https://github.com/user-attachments/assets/11c29c35-f3e1-4d5d-885a-809c6174631b"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]