ソースを参照

fix: include ref's desc

Zhongwen Deng 3 年 前
コミット
09e5f35f5c

+ 4 - 4
apps/emqx_conf/i18n/emqx_conf_schema.conf

@@ -944,8 +944,8 @@ until the RPC connection is considered lost."""
       zh: """需要持久化到文件的日志处理进程列表。默认只有 default 一个处理进程。"""
     }
     label {
-      en: "File Handlers"
-      zh: "File Handlers"
+      en: "File Handler"
+      zh: "File Handler"
     }
   }
 
@@ -1389,8 +1389,8 @@ Each sink is represented by a _log handler_, which can be configured independent
       zh: """日志处理进程将日志事件打印到 EMQX 控制台。"""
     }
     label {
-      en: "Console Log Handler"
-      zh: "控制台日志处理进程"
+      en: "Console Handler"
+      zh: "Console Handler"
     }
   }
 

+ 17 - 2
apps/emqx_dashboard/src/emqx_dashboard_swagger.erl

@@ -429,8 +429,23 @@ trans_label(Spec, Hocon, Default) ->
 
 desc_struct(Hocon) ->
     case hocon_schema:field_schema(Hocon, desc) of
-        undefined -> hocon_schema:field_schema(Hocon, description);
-        Struct -> Struct
+        undefined ->
+            case hocon_schema:field_schema(Hocon, description) of
+                undefined ->
+                    case Hocon of
+                        ?R_REF(Mod, Name) ->
+                            case erlang:function_exported(Mod, desc, 1) of
+                                true -> Mod:desc(Name);
+                                false -> undefined
+                            end;
+                        _ ->
+                            undefined
+                    end;
+                Struct1 ->
+                    Struct1
+            end;
+        Struct ->
+            Struct
     end.
 
 request_body(#{content := _} = Content, _Module, _Options) ->