Skip to content

fix(ui): Connection Form Extras not inferring the correct type#55492

Merged
jscheffl merged 2 commits intoapache:mainfrom
yangyulely:fix_extra_edit_issue
Sep 11, 2025
Merged

fix(ui): Connection Form Extras not inferring the correct type#55492
jscheffl merged 2 commits intoapache:mainfrom
yangyulely:fix_extra_edit_issue

Conversation

@yangyulely
Copy link
Contributor

closes: #53961
related: #53961

Problem Analysis

The issue was that when editing non-string fields (like lists, booleans, etc.) through the "Extra fields" in the Connection Form (not using the JSON editor), the fields were being converted to strings instead of maintaining their original data types.

Root Cause

The problem was in the FieldSelector.tsx component. The inferType function was only using the initialParamDict (which contains schema definitions) to determine field types, but it wasn't considering the actual current values stored in paramsDict when editing existing connections.

Solution Implemented

I modified the FieldSelector component in airflow-core/src/airflow/ui/src/components/FlexibleForm/FieldSelector.tsx to:

  1. Use both parameter dictionaries: The component now accesses both initialParamDict (for schema information) and paramsDict (for current values) from the useParamStore.

  2. Combine schema with actual values: Created a combined parameter object that uses:

    • Schema information from initialParamDict
    • Actual current values from paramsDict
  3. Preserve original data types: This ensures that when editing existing extra fields, the type inference is based on the actual stored values rather than just the schema defaults, preventing arrays, booleans, numbers, and objects from being converted to strings.

Improvement

Extra Fields JSON

{
  "string": "hello world",
  "list": [
    "p1",
    "p2",
    "p3",
    "p4"
  ],
  "bool": true,
  "num": 1234,
  "object": {
    "key": "value"
  }
}
Before After
before_fix fix_extra_fields

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Sep 11, 2025
@jscheffl jscheffl added this to the Airflow 3.1.0 milestone Sep 11, 2025
@jscheffl jscheffl added the type:bug-fix Changelog: Bug Fixes label Sep 11, 2025
@jscheffl jscheffl modified the milestones: Airflow 3.1.0, Airflow 3.0.7 Sep 11, 2025
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! That sounds reasonable.

@jscheffl jscheffl merged commit a697436 into apache:main Sep 11, 2025
57 checks passed
@yangyulely yangyulely deleted the fix_extra_edit_issue branch September 12, 2025 01:27
@kaxil kaxil modified the milestones: Airflow 3.0.7, Airflow 3.1.0 Sep 13, 2025
kaxil pushed a commit that referenced this pull request Sep 15, 2025
suman-himanshu pushed a commit to suman-himanshu/airflow that referenced this pull request Sep 17, 2025
Brunda10 pushed a commit to Brunda10/airflow that referenced this pull request Sep 17, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Sep 30, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 1, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 2, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 3, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 4, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 5, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 5, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 7, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 8, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 9, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 10, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 11, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 12, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 14, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 15, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 17, 2025
abdulrahman305 bot pushed a commit to qenex-ai/airflow that referenced this pull request Oct 19, 2025
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. type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI - Connection Form Extras not inferring the correct type

3 participants