Skip to content

UI: Show an empty object for object params with no value - #71710

Merged
bbovenzi merged 1 commit into
apache:mainfrom
arose26:fix/object-param-empty-value
Aug 20, 2026
Merged

UI: Show an empty object for object params with no value#71710
bbovenzi merged 1 commit into
apache:mainfrom
arose26:fix/object-param-empty-value

Conversation

@arose26

@arose26 arose26 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

FieldObject renders the JSON editor for params whose declared type is objectFieldSelector routes arrays to FieldStringArray, FieldAdvancedArray and FieldMultiSelect, so an array never reaches it. It nonetheless falls back to an empty array when the param has no value:

value={JSON.stringify(param.value ?? [], undefined, 2)}

So a param declared as an object but left unset opens the trigger form's editor showing [], and anyone editing it starts from the wrong JSON literal for the field's declared type.

The submitted conf is built from param.value rather than the editor text, so an untouched field still submits null — this is about what the user is shown and edits from, not about the value sent when the field is left alone.

related: #55213

Tests

Adds FieldObject.test.tsx covering both branches of the fallback — a param with no value, and one with an existing value. The first fails before this change (Expected {} / Received []) and passes after.

pnpm lint (eslint + tsc) is clean and the full ui suite passes — 935 tests across 121 files.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

A param declared as an object but left without a value pre-filled the
trigger form's JSON editor with an empty array, so anyone editing it
started from the wrong JSON literal for the field's declared type.
@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Aug 17, 2026
@boring-cyborg

boring-cyborg Bot commented Aug 17, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@choo121600

choo121600 commented Aug 18, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution!
Could you also attach screenshots showing the UI before and after the changes?
this would be helpful for reviewers to better understand the changes :)

@arose26

arose26 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review — screenshots below.

Both show the trigger form's Run Parameters section for a DAG param declared as type: ["object", "null"] that has not been given a value. Only the one line in FieldObject.tsx differs between them.

Before — the editor opens on [], an array literal, for a param whose declared type is object:

image

After — it opens on {}, matching the declared type:

image

The rest of the field is unchanged: same label, same description, same editor.

For transparency about how these were produced: rather than stand up a full Airflow instance, I rendered the real FlexibleForm in a local Vite page, mounted the same way ConfigForm mounts it in the trigger dialog (same Accordion.Root props, no noAccordion), seeded with a single object param. So the accordion section, the Row layout and the Monaco editor are the actual components with the actual styling — nothing mocked or redrawn. What is not pictured is the surrounding dialog chrome, since that comes from the modal rather than from this field.

@bbovenzi bbovenzi added this to the Airflow 3.3.2 milestone Aug 18, 2026
@bbovenzi bbovenzi added the backport-to-v3-3-test Backport to v3-3-test label Aug 18, 2026
@bbovenzi
bbovenzi merged commit 0cfc4ef into apache:main Aug 20, 2026
88 of 89 checks passed
@boring-cyborg

boring-cyborg Bot commented Aug 20, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test PR Link

bbovenzi pushed a commit that referenced this pull request Aug 20, 2026
…71710) (#71876)

A param declared as an object but left without a value pre-filled the
trigger form's JSON editor with an empty array, so anyone editing it
started from the wrong JSON literal for the field's declared type.
(cherry picked from commit 0cfc4ef)

Co-authored-by: Kole Harvey <145766958+arose26@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-3-test Backport to v3-3-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants