Taragolis commented on PR #24425:
URL: https://github.com/apache/airflow/pull/24425#issuecomment-1155079492

   > It's also for all other cases (like API) - it's just "preventive sorting" 
- if you use it later
   
   Seems like API doesn't use it yet, so it also could be sorted later in API 
when it implemented
   
   > Many people don't think empathetically about the users.
   
   The reason of this change is actually thinking about user. I've accidentally 
found it when I've tried implement extra fields for AWS Connection and found 
that doesn't matter how I define it in `get_connection_form_widgets()` in ui it 
appear in the order of keys like.
   
   Expectation
   ```json
   {
     "extra__aws__aws_session_token": "placeholder PasswordField()",
     "extra__aws__region_name": "placeholder StringField()",
     "extra__aws__profile": "placeholder StringField()",
     "extra__aws__role_arn": "placeholder StringField()",
     "extra__aws__assume_role_method": "placeholder StringField()",
     "extra__aws__assume_role_kwargs": "placeholder StringField()"
   }
   ```
   
   Actually
   ```json
   {
     "extra__aws__assume_role_kwargs": "placeholder StringField()",
     "extra__aws__assume_role_method": "placeholder StringField()",
     "extra__aws__aws_session_token": "placeholder PasswordField()",
     "extra__aws__profile": "placeholder StringField()",
     "extra__aws__region_name": "placeholder StringField()",
     "extra__aws__role_arn": "placeholder StringField()"
   }
   ```
   
   In this case I've expected that in UI:
   * _extra__aws__aws_session_token_ in a top of the extra fields
   * _extra__aws__role_arn_, _extra__aws__assume_role_method_, 
_extra__aws__assume_role_kwargs_  placed together
   
   And also nice to have ability to place very rarely used arguments and 
deprecated in the bottom of the connection UI.
   
   At that moment it could be only implemented by some hacks (which produces 
more issues rather than benefits) such as
   ```
   {
     "extra__aws__01_aws_session_token": "placeholder PasswordField()",
     "extra__aws__02_region_name": "placeholder StringField()",
     "extra__aws__03_profile": "placeholder StringField()",
     "extra__aws__04_role_arn": "placeholder StringField()",
     "extra__aws__05_assume_role_method": "placeholder StringField()",
     "extra__aws__06_assume_role_kwargs": "placeholder StringField()"
   }
   ``` 
   
   Or add additional field which returns by `get_ui_field_behaviour()` like 
**ui_sorting_order** which required makes changes in provider manager, UI, JSON 
schema
   
   **I guessed it wrong initially** that my simple change doesn't use effect 
anything rather than UI. My fault
   But what I've suggest now, it keep natural sort in UI and additionally sorts 
in cli
   
   > I believe that when you write code, you should optimize for reading, not 
writing. While you can produce less code by removing Ordered Dict (and 
technically you can do it and effect of it is the same), sometimes writing more 
explicit code expressing the intention is better.
   
   I would rather move discussion about OrderdDict in direct messages, such a 
slack, if you would like. Personally for me see OrderedDict more confusing 
rather than dict, because I thought is it for compatibility or for some 
additional methods of OrderedDict.


-- 
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]

Reply via email to