You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "fat-catTW (via GitHub)" <gi...@apache.org> on 2026/08/05 13:13:36 UTC

[PR] Add radio button rendering for enum Dag Params [airflow]

fat-catTW opened a new pull request, #71180:
URL: https://github.com/apache/airflow/pull/71180

    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull request.
   Write a good git commit message following this guide: https://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the documentation.
   
   For user-facing UI changes, please attach before/after screenshots (or a short
   screen recording) so reviewers can assess the visual impact.
   
   Feel free to ping (in general) for the review if you do not see reaction for a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ## Why
   
   Dag authors currently cannot choose a radio button UI for enum Params in the Trigger Dag form. This makes small, fixed choice sets less convenient, especially when the choices are generated from deployment-local configuration such as an INI file.
   
   ## Solution
   
   Add an opt-in `x-airflow-ui.widget = "radio"` schema hint for enum Params. Enum Params continue to render as dropdowns by default, while Params with the radio widget hint render as radio buttons.
   
   The Params documentation and tutorial Dag also show how to generate enum choices from a colocated INI file at Dag parse time, so the Trigger Dag form uses serialized Dag Params instead of calling a dynamic choice provider.
   
   Helps address #56632.
   
   
   
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - `[X]` Yes (please specify the tool below)
   
   
   Generated-by: [Codex] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Document config-backed enum Dag Params [airflow]

Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on PR #71180:
URL: https://github.com/apache/airflow/pull/71180#issuecomment-5353671207

   +1, thank you @fat-catTW!


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add radio button rendering for enum Dag Params [airflow]

Posted by "fat-catTW (via GitHub)" <gi...@apache.org>.
fat-catTW commented on PR #71180:
URL: https://github.com/apache/airflow/pull/71180#issuecomment-5200778108

   Good afternoon.
   Thanks for the review. I agree with the concerns here.
   
   To clarify the current state of this PR: 
   The example demonstrates that a Dag author can read an INI file at Dag parse time, filter the available interfaces, and pass those values into a Param enum. Airflow Params currently expect the enum choices to be materialized when the Dag is parsed; the trigger form reads the serialized Param schema and does not have a generic "choices source" mechanism that can load/filter options when the form opens.
   
   The trigger form already renders enum values as choices via the existing dropdown support, and this PR experiments with rendering the same enum values as radio buttons via `x-airflow-ui`. So this covers the “do not require free-text input” part, but it does not introduce a general dynamic choices provider or a reusable config-source mechanism.
   
   I also agree that the selector vs radio part is secondary. The main missing design question is how Airflow should expose UI presentation preferences for Params in a way that can be extended later. The current `x-airflow-ui` key may be too ad hoc without that broader shape being defined.
   
   Given that, I think there are two possible directions:
   
   1. Keep this PR smaller and use the existing enum dropdown behavior, documenting the INI-at-parse-time pattern without adding a new UI extension key.
   2. Expand this PR into a more deliberate Param UI presentation API, including how widgets such as dropdown/radio would be selected and how optional radio Params can be cleared.
   
   I’m happy to take either direction. If maintainers think this PR should define the broader UI extension shape, I can work on that here; otherwise I can reduce this PR to the existing enum dropdown/docs pattern.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add radio button rendering for enum Dag Params [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on PR #71180:
URL: https://github.com/apache/airflow/pull/71180#issuecomment-5205785935

   Let's go with option 1. I think smaller PRs are always a better start and that gets to the core use-case.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Document config-backed enum Dag Params [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #71180:
URL: https://github.com/apache/airflow/pull/71180


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add radio button rendering for enum Dag Params [airflow]

Posted by "fat-catTW (via GitHub)" <gi...@apache.org>.
fat-catTW commented on PR #71180:
URL: https://github.com/apache/airflow/pull/71180#issuecomment-5218667692

   Thanks, I updated the PR to follow option 1.
   
   The PR no longer adds `x-airflow-ui` or a radio widget path. It now keeps the existing enum dropdown behavior and documents/demonstrates the smaller pattern: read an external INI file while the Dag is parsed, filter the available choices, and pass the resulting list into a Param `enum`.
   
   I also verified this manually in the UI with `Params UI tutorial`: the new `Script interface` field renders as a dropdown with `Interface A` and `Interface C`, while `Interface B` is excluded because it is not `TYPE = Script`.
   
   <img width="750" height="598" alt="螢幕擷取畫面 2026-08-07 223941" src="https://github.com/user-attachments/assets/97871884-5ed2-4e48-b869-8a012e8a45b9" />


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org