amoghrajesh commented on code in PR #60410:
URL: https://github.com/apache/airflow/pull/60410#discussion_r2787119151


##########
contributing-docs/23_provider_hook_migration_to_yaml.rst:
##########
@@ -0,0 +1,108 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+Provider hook to yaml Migration
+===============================
+
+We can now, redefine connection form metadata declaratively in 
``provider.yaml`` of a provider instead of Python hook code,
+reducing dependencies and improving API server startup performance.
+
+**The outline for this document in GitHub is available at top-right corner 
button (with 3-dots and 3 lines).**
+
+Background
+----------
+
+Previously, connection form UI metadata was defined in hook code of a provider 
using:
+
+* ``get_connection_form_widgets()`` - Custom form fields
+* ``get_ui_field_behaviour()`` - Field customizations (hidden, relabeling, 
placeholders)
+
+These methods required importing heavy dependencies ``flask_appbuilder`` and 
``wtforms``, adding unnecessary dependencies
+to the API server and having API server to load all the provider hook code 
just to display a static form.
+The new yaml approach allows metadata to be loaded without importing hook 
classes.
+
+
+YAML Schema Structure
+---------------------
+
+Connection metadata is defined under ``connection-types`` in ``provider.yaml`` 
of a provider:
+
+ui-field-behaviour
+~~~~~~~~~~~~~~~~~~
+
+Customizations for standard connection fields:
+
+.. code-block:: yaml
+
+    ui-field-behaviour:
+      hidden-fields:
+        - schema
+        - extra
+      relabeling:
+        host: Registry URL
+        login: Username
+      placeholders:
+        port: '5432'
+
+conn-fields
+~~~~~~~~~~~
+
+Custom fields stored which will be stored within ``Connection.extra``:

Review Comment:
   I don't think there is a need since the people who will be running the 
scripts will not need to know that info, the script will spit it out.



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