Explorar el Código

fix(meta): update object type meta

1. Fix meta file by discuss with manager team
2. Update config load to adapt to the new object json

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang hace 2 años
padre
commit
9e67a2e4f3

+ 26 - 15
etc/sinks/edgex.json

@@ -236,7 +236,7 @@
       "name": "optional",
       "optional": true,
       "control": "list",
-      "type": "list_object",
+      "type": "object",
       "connection_related": true,
       "hint": {
         "en_US": "If MQTT message bus is used, some other optional configurations can be specified. Please notice that all of values in optional are string type, so values for these configurations should be string - such as KeepAlive: \"5000\".",
@@ -246,8 +246,8 @@
         "en_US": "Optional",
         "zh_CN": "选项"
       },
-      "default": [
-        {
+      "default": {
+        "ClientId": {
           "name": "ClientId",
           "default": "",
           "optional": true,
@@ -261,7 +261,8 @@
             "en_US": "MQTT clientID",
             "zh_CN": "MQTT 客户端 ID"
           }
-        }, {
+        },
+        "Username": {
           "name": "Username",
           "default": "",
           "optional": true,
@@ -275,7 +276,8 @@
             "en_US": "MQTT username",
             "zh_CN": "MQTT 用户名"
           }
-        }, {
+        },
+        "Password": {
           "name": "Password",
           "default": "",
           "optional": true,
@@ -289,7 +291,8 @@
             "en_US": "MQTT password",
             "zh_CN": "MQTT 密码"
           }
-        }, {
+        },
+        "Qos": {
           "name": "Qos",
           "default": "",
           "optional": true,
@@ -303,7 +306,8 @@
             "en_US": "MQTT QoS",
             "zh_CN": "MQTT 服务质量"
           }
-        }, {
+        },
+        "KeepAlive": {
           "name": "KeepAlive",
           "default": "",
           "optional": true,
@@ -317,7 +321,8 @@
             "en_US": "MQTT keepalive",
             "zh_CN": "MQTT keepalive"
           }
-        }, {
+        },
+        "Retained": {
           "name": "Retained",
           "default": "",
           "optional": true,
@@ -331,7 +336,8 @@
             "en_US": "MQTT retained",
             "zh_CN": "MQTT retained"
           }
-        }, {
+        },
+        "ConnectionPayload": {
           "name": "ConnectionPayload",
           "default": "",
           "optional": true,
@@ -345,7 +351,8 @@
             "en_US": "MQTT connection payload",
             "zh_CN": "MQTT connection payload"
           }
-        }, {
+        },
+        "CertFile": {
           "name": "CertFile",
           "default": "",
           "optional": true,
@@ -359,7 +366,8 @@
             "en_US": "MQTT cert file",
             "zh_CN": "MQTT cert file"
           }
-        }, {
+        },
+        "KeyFile": {
           "name": "KeyFile",
           "default": "",
           "optional": true,
@@ -373,7 +381,8 @@
             "en_US": "MQTT key file",
             "zh_CN": "MQTT key file"
           }
-        }, {
+        },
+        "CertPEMBlock": {
           "name": "CertPEMBlock",
           "default": "",
           "optional": true,
@@ -387,7 +396,8 @@
             "en_US": "MQTT cert PEM block",
             "zh_CN": "MQTT cert PEM block"
           }
-        }, {
+        },
+        "KeyPEMBlock": {
           "name": "KeyPEMBlock",
           "default": "",
           "optional": true,
@@ -401,7 +411,8 @@
             "en_US": "MQTT key PEM block",
             "zh_CN": "MQTT key PEM block"
           }
-        }, {
+        },
+        "SkipCertVerify": {
           "name": "SkipCertVerify",
           "default": "",
           "optional": true,
@@ -416,7 +427,7 @@
             "zh_CN": "MQTT skip cert verify"
           }
         }
-      ]
+      }
     }
   ],
   "node": {

+ 18 - 18
etc/sinks/rest.json

@@ -209,7 +209,7 @@
       "name": "oauth",
       "optional": true,
       "control": "list",
-      "type": "list_object",
+      "type": "object",
       "hint": {
         "en_US": "Configure the oauth authentication flow.",
         "zh_CN": "配置 OAuth 验证流程。"
@@ -218,12 +218,12 @@
         "en_US": "OAuth",
         "zh_CN": "OAuth"
       },
-      "default":[
-        {
+      "default":{
+        "access": {
           "name": "access",
           "optional": true,
           "control": "list",
-          "type": "list_object",
+          "type": "object",
           "hint": {
             "en_US": "Configure how to fetch the access token.",
             "zh_CN": "配置如何获取访问令牌。"
@@ -232,8 +232,8 @@
             "en_US": "Access token request",
             "zh_CN": "访问令牌请求"
           },
-          "default": [
-            {
+          "default": {
+            "url": {
               "name": "url",
               "default": "",
               "optional": true,
@@ -248,7 +248,7 @@
                 "zh_CN": "访问令牌 URL"
               }
             },
-            {
+            "body": {
               "name": "body",
               "default": "",
               "optional": true,
@@ -263,7 +263,7 @@
                 "zh_CN": "访问令牌请求的正文"
               }
             },
-            {
+            "expire": {
               "name": "expire",
               "default": "",
               "optional": true,
@@ -278,13 +278,13 @@
                 "zh_CN": "过期时间"
               }
             }
-          ]
+          }
         },
-        {
+        "refresh":{
           "name": "refresh",
           "optional": true,
           "control": "list",
-          "type": "list_object",
+          "type": "object",
           "hint": {
             "en_US": "Configure how to refresh token after expiration.",
             "zh_CN": "配置令牌过期后如何更新令牌。"
@@ -293,8 +293,8 @@
             "en_US": "Refresh token request",
             "zh_CN": "更新令牌请求"
           },
-          "default": [
-            {
+          "default": {
+            "url":{
               "name": "url",
               "default": "",
               "optional": true,
@@ -309,11 +309,11 @@
                 "zh_CN": "更新令牌 URL"
               }
             },
-            {
+            "headers":{
               "name": "headers",
               "optional": true,
               "control": "list",
-              "type": "list_object",
+              "type": "object",
               "hint": {
                 "en_US": "The HTTP request headers that you want to send along with the HTTP refresh request.",
                 "zh_CN": "需要与刷新 Token HTTP 请求一起发送的 HTTP 请求标头。"
@@ -323,7 +323,7 @@
                 "zh_CN": "刷新令牌请求标头"
               }
             },
-            {
+            "body":{
               "name": "body",
               "default": "",
               "optional": true,
@@ -338,9 +338,9 @@
                 "zh_CN": "刷新令牌请求的正文"
               }
             }
-          ]
+          }
         }
-      ]
+      }
     }
   ],
   "node": {

+ 26 - 26
etc/sources/edgex.json

@@ -146,7 +146,20 @@
 			},
 			{
 				"name": "optional",
-				"default": [{
+				"optional": true,
+				"control": "list",
+				"type": "object",
+				"connection_related": true,
+				"hint": {
+					"en_US": "If MQTT message bus is used, some other optional configurations can be specified. Please notice that all of values in optional are string type, so values for these configurations should be string - such as KeepAlive: \"5000\".",
+					"zh_CN": "如果使用了 MQTT 消息总线,还可以指定别的一些可选配置项。请注意,所有在可选的配置项里指定的值都必须为**字符类型**,因此这里出现的所有的配置应该是字符类型的 - 例如 KeepAlive: \"5000\"。"
+				},
+				"label": {
+					"en_US": "Optional",
+					"zh_CN": "选项"
+				},
+				"default": {
+					"ClientId": {
 						"name": "ClientId",
 						"default": "",
 						"optional": true,
@@ -161,7 +174,7 @@
 							"zh_CN": "MQTT 客户端 ID"
 						}
 					},
-					{
+					"Username": {
 						"name": "Username",
 						"default": "",
 						"optional": true,
@@ -176,7 +189,7 @@
 							"zh_CN": "MQTT 用户名"
 						}
 					},
-					{
+					"Password": {
 						"name": "Password",
 						"default": "",
 						"optional": true,
@@ -191,13 +204,12 @@
 							"zh_CN": "MQTT 密码"
 						}
 					},
-					{
+					"Qos": {
 						"name": "Qos",
 						"default": "",
 						"optional": true,
-						"control": "select",
+						"control": "text",
 						"type": "string",
-						"values": [0, 1, 2],
 						"hint": {
 							"en_US": "MQTT QoS",
 							"zh_CN": "MQTT 服务质量"
@@ -207,7 +219,7 @@
 							"zh_CN": "MQTT 服务质量"
 						}
 					},
-					{
+					"KeepAlive": {
 						"name": "KeepAlive",
 						"default": "",
 						"optional": true,
@@ -222,7 +234,7 @@
 							"zh_CN": "MQTT keepalive"
 						}
 					},
-					{
+					"Retained": {
 						"name": "Retained",
 						"default": "",
 						"optional": true,
@@ -237,7 +249,7 @@
 							"zh_CN": "MQTT retained"
 						}
 					},
-					{
+					"ConnectionPayload": {
 						"name": "ConnectionPayload",
 						"default": "",
 						"optional": true,
@@ -252,7 +264,7 @@
 							"zh_CN": "MQTT connection payload"
 						}
 					},
-					{
+					"CertFile": {
 						"name": "CertFile",
 						"default": "",
 						"optional": true,
@@ -267,7 +279,7 @@
 							"zh_CN": "MQTT cert file"
 						}
 					},
-					{
+					"KeyFile": {
 						"name": "KeyFile",
 						"default": "",
 						"optional": true,
@@ -282,7 +294,7 @@
 							"zh_CN": "MQTT key file"
 						}
 					},
-					{
+					"CertPEMBlock": {
 						"name": "CertPEMBlock",
 						"default": "",
 						"optional": true,
@@ -297,7 +309,7 @@
 							"zh_CN": "MQTT cert PEM block"
 						}
 					},
-					{
+					"KeyPEMBlock": {
 						"name": "KeyPEMBlock",
 						"default": "",
 						"optional": true,
@@ -312,7 +324,7 @@
 							"zh_CN": "MQTT key PEM block"
 						}
 					},
-					{
+					"SkipCertVerify": {
 						"name": "SkipCertVerify",
 						"default": "",
 						"optional": true,
@@ -327,18 +339,6 @@
 							"zh_CN": "MQTT skip cert verify"
 						}
 					}
-				],
-				"optional": true,
-				"control": "list",
-				"connection_related": true,
-				"type": "list_object",
-				"hint": {
-					"en_US": "If MQTT message bus is used, some other optional configurations can be specified. Please notice that all of values in optional are string type, so values for these configurations should be string - such as KeepAlive: \"5000\".",
-					"zh_CN": "如果使用了 MQTT 消息总线,还可以指定别的一些可选配置项。请注意,所有在可选的配置项里指定的值都必须为**字符类型**,因此这里出现的所有的配置应该是字符类型的 - 例如 KeepAlive: \"5000\"。"
-				},
-				"label": {
-					"en_US": "Optional",
-					"zh_CN": "选项"
 				}
 			}
 		]

+ 126 - 138
etc/sources/httppull.json

@@ -188,24 +188,10 @@
 			}
 		}, {
 			"name": "headers",
-			"default": [{                                                 
-				"name": "Accept",
-				"default": "application/json",
-				"optional": true,
-				"control": "text",
-				"type": "string",
-				"hint": {
-					"en_US": "HTTP headers",
-					"zh_CN": "HTTP标头"      
-				},                                                              
-				"label": {
-					"en_US": "HTTP headers",
-					"zh_CN": "HTTP标头"
-				}                                                     
-			}],
+			"default": {"Accept": "application/json"},
 			"optional": true,
 			"control": "list",
-			"type": "list_object",
+			"type": "object",
 			"hint": {
 				"en_US": "The HTTP request headers that you want to send along with the HTTP request.",
 				"zh_CN": "需要与 HTTP 请求一起发送的 HTTP 请求标头。"
@@ -235,140 +221,142 @@
 			}
 		},
 		{
-			"name": "oauth",
-			"optional": true,
-			"control": "list",
-			"type": "list_object",
-			"hint": {
-				"en_US": "Configure the oAuth authentication flow.",
-				"zh_CN": "配置 OAuth 验证流程。"
-			},
-			"label": {
-				"en_US": "OAuth",
-				"zh_CN": "OAuth"
-			},
-			"default":[
-				{
-					"name": "access",
-					"optional": true,
-					"control": "list",
-					"type": "list_object",
-					"hint": {
-						"en_US": "Configure how to fetch the access token.",
-						"zh_CN": "配置如何获取访问令牌。"
-					},
-					"label": {
-						"en_US": "Access token request",
-						"zh_CN": "访问令牌请求"
-					},
-					"default": [
-						{
-							"name": "url",
-							"default": "",
-							"optional": true,
-							"control": "text",
-							"type": "string",
-							"hint": {
-								"en_US": "The URL where to get the access token.",
-								"zh_CN": "获取访问令牌的 URL"
-							},
-							"label": {
-								"en_US": "Access Token URL",
-								"zh_CN": "访问令牌 URL"
-							}
+				"name": "oauth",
+				"optional": true,
+				"control": "list",
+				"type": "object",
+				"hint": {
+					"en_US": "Configure the oauth authentication flow.",
+					"zh_CN": "配置 OAuth 验证流程。"
+				},
+				"label": {
+					"en_US": "OAuth",
+					"zh_CN": "OAuth"
+				},
+				"default":{
+					"access": {
+						"name": "access",
+						"optional": true,
+						"control": "list",
+						"type": "object",
+						"hint": {
+							"en_US": "Configure how to fetch the access token.",
+							"zh_CN": "配置如何获取访问令牌。"
 						},
-						{
-							"name": "body",
-							"default": "",
-							"optional": true,
-							"control": "textarea",
-							"type": "string",
-							"hint": {
-								"en_US": "The body of access token request",
-								"zh_CN": "访问令牌请求的正文"
-							},
-							"label": {
-								"en_US": "Access Token Request Body",
-								"zh_CN": "访问令牌请求的正文"
-							}
+						"label": {
+							"en_US": "Access token request",
+							"zh_CN": "访问令牌请求"
 						},
-						{
-							"name": "expire",
-							"default": "",
-							"optional": true,
-							"control": "text",
-							"type": "string",
-							"hint": {
-								"en_US": "The expire time or expire time template",
-								"zh_CN": "过期时间"
+						"default": {
+							"url": {
+								"name": "url",
+								"default": "",
+								"optional": true,
+								"control": "text",
+								"type": "string",
+								"hint": {
+									"en_US": "The URL where to get the access token.",
+									"zh_CN": "获取访问令牌的 URL"
+								},
+								"label": {
+									"en_US": "Access Token URL",
+									"zh_CN": "访问令牌 URL"
+								}
+							},
+							"body": {
+								"name": "body",
+								"default": "",
+								"optional": true,
+								"control": "textarea",
+								"type": "string",
+								"hint": {
+									"en_US": "The body of access token request",
+									"zh_CN": "访问令牌请求的正文"
+								},
+								"label": {
+									"en_US": "Access Token Request Body",
+									"zh_CN": "访问令牌请求的正文"
+								}
 							},
-							"label": {
-								"en_US": "Expire Time",
-								"zh_CN": "过期时间"
+							"expire": {
+								"name": "expire",
+								"default": "",
+								"optional": true,
+								"control": "text",
+								"type": "string",
+								"hint": {
+									"en_US": "The expire time or expire time template",
+									"zh_CN": "过期时间"
+								},
+								"label": {
+									"en_US": "Expire Time",
+									"zh_CN": "过期时间"
+								}
 							}
 						}
-					]
-				},
-				{
-					"name": "refresh",
-					"optional": true,
-					"control": "list",
-					"type": "list_object",
-					"hint": {
-						"en_US": "Configure how to refresh token after expiration.",
-						"zh_CN": "配置令牌过期后如何更新令牌。"
-					},
-					"label": {
-						"en_US": "Refresh token request",
-						"zh_CN": "更新令牌请求"
 					},
-					"default": [
-						{
-							"name": "url",
-							"optional": true,
-							"control": "text",
-							"type": "string",
-							"hint": {
-								"en_US": "The URL where to get the refresh token.",
-								"zh_CN": "获取更新令牌的 URL"
-							},
-							"label": {
-								"en_US": "Refresh Token URL",
-								"zh_CN": "更新令牌 URL"
-							}
+					"refresh":{
+						"name": "refresh",
+						"optional": true,
+						"control": "list",
+						"type": "object",
+						"hint": {
+							"en_US": "Configure how to refresh token after expiration.",
+							"zh_CN": "配置令牌过期后如何更新令牌。"
 						},
-						{
-							"name": "headers",
-							"optional": true,
-							"control": "list",
-							"type": "list_object",
-							"hint": {
-								"en_US": "The HTTP request headers that you want to send along with the HTTP refresh request.",
-								"zh_CN": "需要与刷新 Token HTTP 请求一起发送的 HTTP 请求标头。"
-							},
-							"label": {
-								"en_US": "Refresh token request headers",
-								"zh_CN": "刷新令牌请求标头"
-							}
+						"label": {
+							"en_US": "Refresh token request",
+							"zh_CN": "更新令牌请求"
 						},
-						{
-							"name": "body",
-							"optional": true,
-							"control": "textarea",
-							"type": "string",
-							"hint": {
-								"en_US": "The body of refresh token request",
-								"zh_CN": "刷新令牌请求的正文"
+						"default": {
+							"url":{
+								"name": "url",
+								"default": "",
+								"optional": true,
+								"control": "text",
+								"type": "string",
+								"hint": {
+									"en_US": "The URL where to get the refresh token.",
+									"zh_CN": "获取更新令牌的 URL"
+								},
+								"label": {
+									"en_US": "Refresh Token URL",
+									"zh_CN": "更新令牌 URL"
+								}
 							},
-							"label": {
-								"en_US": "Refresh token request body",
-								"zh_CN": "刷新令牌请求的正文"
+							"headers":{
+								"name": "headers",
+								"optional": true,
+								"control": "list",
+								"type": "object",
+								"hint": {
+									"en_US": "The HTTP request headers that you want to send along with the HTTP refresh request.",
+									"zh_CN": "需要与刷新 Token HTTP 请求一起发送的 HTTP 请求标头。"
+								},
+								"label": {
+									"en_US": "Refresh token request headers",
+									"zh_CN": "刷新令牌请求标头"
+								}
+							},
+							"body":{
+								"name": "body",
+								"default": "",
+								"optional": true,
+								"control": "textarea",
+								"type": "string",
+								"hint": {
+									"en_US": "The body of refresh token request",
+									"zh_CN": "刷新令牌请求的正文"
+								},
+								"label": {
+									"en_US": "Refresh token request body",
+									"zh_CN": "刷新令牌请求的正文"
+								}
 							}
 						}
-					]
+					}
 				}
-			]
-		}
+			}
 		]
 	},
 	"outputs": [

+ 4 - 4
extensions/sources/random/random.json

@@ -66,8 +66,8 @@
       },
       {
         "name": "pattern",
-        "default": [
-          {
+        "default": {
+          "count": {
             "name": "count",
             "default": 50,
             "optional": false,
@@ -82,10 +82,10 @@
               "zh_CN": "字段名"
             }
           }
-        ],
+        },
         "optional": false,
         "control": "list",
-        "type": "list_object",
+        "type": "object",
         "hint": {
           "en_US": "The style generated by the source can define multiple fields. The style is json, for example {\"count\":50}.",
           "zh_CN": "源生成的样式,可定义多个字段。样式为json,例如{\"count\":50}"

+ 23 - 23
extensions/sources/sql/sql.json

@@ -62,8 +62,8 @@
       },
       {
         "name": "internalSqlQueryCfg",
-        "default": [
-          {
+        "default": {
+          "table":{
             "name": "table",
             "default": "tableName",
             "optional": false,
@@ -78,7 +78,7 @@
               "zh_CN": "表名"
             }
           },
-          {
+          "indexField": {
             "name": "indexField",
             "default": "",
             "optional": true,
@@ -93,7 +93,7 @@
               "zh_CN": "索引字段名"
             }
           },
-          {
+          "indexValue": {
             "name": "indexValue",
             "default": "",
             "optional": true,
@@ -108,7 +108,7 @@
               "zh_CN": "索引字段初始值"
             }
           },
-          {
+          "limit": {
             "name": "limit",
             "default": 10,
             "optional": true,
@@ -123,7 +123,7 @@
               "zh_CN": "查询条数限制"
             }
           },
-          {
+          "indexFieldType": {
             "name": "indexFieldType",
             "default": "",
             "optional": true,
@@ -139,7 +139,7 @@
               "zh_CN": "索引字段格式"
             }
           },
-          {
+          "dateTimeFormat": {
             "name": "dateTimeFormat",
             "default": "",
             "optional": true,
@@ -154,10 +154,10 @@
               "zh_CN": "时间格式"
             }
           }
-        ],
+        },
         "optional": true,
         "control": "list",
-        "type": "list_object",
+        "type": "object",
         "hint": {
           "en_US": "basic configuration for the query",
           "zh_CN": "查询基础配置"
@@ -169,8 +169,8 @@
       },
       {
         "name": "templateSqlQueryCfg",
-        "default": [
-          {
+        "default": {
+          "TemplateSql": {
             "name": "TemplateSql",
             "default": "",
             "optional": false,
@@ -185,7 +185,7 @@
               "zh_CN": "查询语句模版"
             }
           },
-          {
+          "indexField": {
             "name": "indexField",
             "default": "",
             "optional": true,
@@ -200,7 +200,7 @@
               "zh_CN": "索引字段名"
             }
           },
-          {
+          "indexValue": {
             "name": "indexValue",
             "default": "",
             "optional": true,
@@ -215,7 +215,7 @@
               "zh_CN": "索引字段初始值"
             }
           },
-          {
+          "indexFieldType":{
             "name": "indexFieldType",
             "default": "",
             "optional": true,
@@ -231,7 +231,7 @@
               "zh_CN": "索引字段格式"
             }
           },
-          {
+          "dateTimeFormat": {
             "name": "dateTimeFormat",
             "default": "",
             "optional": true,
@@ -246,10 +246,10 @@
               "zh_CN": "时间格式"
             }
           }
-        ],
+        },
         "optional": true,
         "control": "list",
-        "type": "list_object",
+        "type": "object",
         "hint": {
           "en_US": "Query Template",
           "zh_CN": "查询模版"
@@ -261,8 +261,8 @@
       },
       {
         "name": "lookup",
-        "default": [
-          {
+        "default": {
+          "cache": {
             "name": "cache",
             "default": true,
             "optional": false,
@@ -277,7 +277,7 @@
               "zh_CN": "开启查询缓存"
             }
           },
-          {
+          "cacheTtl": {
             "name": "cacheTtl",
             "default": "600",
             "optional": true,
@@ -292,7 +292,7 @@
               "zh_CN": "缓存时间"
             }
           },
-          {
+          "cacheMissingKey": {
             "name": "cacheMissingKey",
             "default": true,
             "optional": false,
@@ -307,10 +307,10 @@
               "zh_CN": "缓存未命中的 Key"
             }
           }
-        ],
+        },
         "optional": true,
         "control": "list",
-        "type": "list_object",
+        "type": "object",
         "hint": {
           "en_US": "Lookup table configuration, only effective when using as a lookup table",
           "zh_CN": "查询表配置,仅在作为查询表使用时生效"

+ 24 - 11
internal/conf/load.go

@@ -1,4 +1,4 @@
-// Copyright 2021-2022 EMQ Technologies Co., Ltd.
+// Copyright 2021-2023 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -278,20 +278,33 @@ func extractNamesFromProperties(jsonMap map[string]interface{}) ([]string, error
 func extractNamesFromElement(jsonMap map[string]interface{}) []string {
 	result := make([]string, 0)
 	list := jsonMap["default"]
-	if interfaceList, isList := list.([]interface{}); isList {
-		for _, element := range interfaceList {
-			if m, isMap := element.(map[string]interface{}); isMap {
-				re := extractNamesFromElement(m)
-				result = append(result, re...)
+	switch lt := list.(type) {
+	case []interface{}:
+		if len(lt) != 0 {
+			for _, element := range lt {
+				if m, isMap := element.(map[string]interface{}); isMap {
+					re := extractNamesFromElement(m)
+					result = append(result, re...)
+				}
 			}
+			return result
 		}
-	} else {
-		n := jsonMap["name"]
-		if s, isString := n.(string); isString {
-			result = append(result, s)
+	case map[string]interface{}:
+		if len(lt) != 0 {
+			for _, element := range lt {
+				if m, isMap := element.(map[string]interface{}); isMap {
+					re := extractNamesFromElement(m)
+					result = append(result, re...)
+				}
+			}
+			return result
 		}
 	}
-
+	// If not a list/map, or an empty list/map, then it's a single element
+	n := jsonMap["name"]
+	if s, isString := n.(string); isString {
+		result = append(result, s)
+	}
 	return result
 }
 

+ 3 - 3
internal/topo/node/source_node_test.go

@@ -35,7 +35,7 @@ func TestGetConf_Apply(t *testing.T) {
 		"incremental":        false,
 		"insecureSkipVerify": true,
 		"headers": map[string]interface{}{
-			"Accept": "application/json",
+			"accept": "application/json",
 		},
 	}
 	n := NewSourceNode("test", ast.TypeStream, nil, &ast.Options{
@@ -61,7 +61,7 @@ func TestGetConfAndConvert_Apply(t *testing.T) {
 		"incremental":        true,
 		"insecureSkipVerify": true,
 		"headers": map[string]interface{}{
-			"Accept": "application/json",
+			"accept": "application/json",
 		},
 	}
 	n := NewSourceNode("test", ast.TypeStream, nil, &ast.Options{
@@ -84,7 +84,7 @@ func TestGetConfAndConvert_Apply(t *testing.T) {
 		BodyType:           "json",
 		InsecureSkipVerify: true,
 		Headers: map[string]interface{}{
-			"Accept": "application/json",
+			"accept": "application/json",
 		},
 	}