Skip to content

Commit f03beb9

Browse files
Migrate mongo connection UI metadata to YAML (#62444)
1 parent 37c480d commit f03beb9

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

providers/mongo/provider.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,28 @@ hooks:
8686
connection-types:
8787
- hook-class-name: airflow.providers.mongo.hooks.mongo.MongoHook
8888
connection-type: mongo
89+
conn-fields:
90+
srv:
91+
label: Srv
92+
schema:
93+
type:
94+
- boolean
95+
- 'null'
96+
ssl:
97+
label: Ssl
98+
schema:
99+
type:
100+
- boolean
101+
- 'null'
102+
allow_insecure:
103+
label: Allow Insecure
104+
schema:
105+
type:
106+
- boolean
107+
- 'null'
108+
ui-field-behaviour:
109+
relabeling:
110+
login: Username
111+
schema: Default DB
112+
placeholders:
113+
port: 'Note: port should not be set for SRV connections'

providers/mongo/src/airflow/providers/mongo/get_provider_info.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ def get_provider_info():
3939
],
4040
"hooks": [{"integration-name": "MongoDB", "python-modules": ["airflow.providers.mongo.hooks.mongo"]}],
4141
"connection-types": [
42-
{"hook-class-name": "airflow.providers.mongo.hooks.mongo.MongoHook", "connection-type": "mongo"}
42+
{
43+
"hook-class-name": "airflow.providers.mongo.hooks.mongo.MongoHook",
44+
"connection-type": "mongo",
45+
"conn-fields": {
46+
"srv": {"label": "Srv", "schema": {"type": ["boolean", "null"]}},
47+
"ssl": {"label": "Ssl", "schema": {"type": ["boolean", "null"]}},
48+
"allow_insecure": {"label": "Allow Insecure", "schema": {"type": ["boolean", "null"]}},
49+
},
50+
"ui-field-behaviour": {
51+
"relabeling": {"login": "Username", "schema": "Default DB"},
52+
"placeholders": {"port": "Note: port should not be set for SRV connections"},
53+
},
54+
}
4355
],
4456
}

0 commit comments

Comments
 (0)