Jelajahi Sumber

fix(ft): add descriptions for missing ft schema fields

Ilya Averyanov 3 tahun lalu
induk
melakukan
eae2478678

+ 6 - 1
apps/emqx_s3/src/emqx_s3_schema.erl

@@ -9,7 +9,7 @@
 
 
 -import(hoconsc, [mk/2, ref/2]).
 -import(hoconsc, [mk/2, ref/2]).
 
 
--export([roots/0, fields/1, namespace/0, tags/0]).
+-export([roots/0, fields/1, namespace/0, tags/0, desc/1]).
 
 
 -export([translate/1]).
 -export([translate/1]).
 
 
@@ -125,6 +125,11 @@ fields(transport_options) ->
             [headers, max_retries, request_timeout], emqx_connector_http:fields("request")
             [headers, max_retries, request_timeout], emqx_connector_http:fields("request")
         ).
         ).
 
 
+desc(s3) ->
+    "S3 connection options";
+desc(transport_options) ->
+    "Options for the HTTP transport layer used by the S3 client".
+
 translate(Conf) ->
 translate(Conf) ->
     Options = #{atom_key => true},
     Options = #{atom_key => true},
     #{s3 := TranslatedConf} = hocon_tconf:check_plain(
     #{s3 := TranslatedConf} = hocon_tconf:check_plain(

+ 20 - 14
lib-ee/emqx_ee_conf/src/emqx_ee_conf_schema.erl

@@ -6,10 +6,11 @@
 
 
 -behaviour(hocon_schema).
 -behaviour(hocon_schema).
 
 
--export([namespace/0, roots/0, fields/1, translations/0, translation/1]).
+-export([namespace/0, roots/0, fields/1, translations/0, translation/1, desc/1]).
 
 
 -define(EE_SCHEMA_MODULES, [
 -define(EE_SCHEMA_MODULES, [
     emqx_license_schema,
     emqx_license_schema,
+    emqx_s3_schema,
     emqx_ft_schema
     emqx_ft_schema
 ]).
 ]).
 
 
@@ -17,16 +18,10 @@ namespace() ->
     emqx_conf_schema:namespace().
     emqx_conf_schema:namespace().
 
 
 roots() ->
 roots() ->
-    lists:foldl(
-        fun(Module, Roots) ->
-            Roots ++ apply(Module, roots, [])
-        end,
-        emqx_conf_schema:roots(),
-        ?EE_SCHEMA_MODULES
-    ).
+    emqx_conf_schema:roots() ++ ee_roots().
 
 
 fields(Name) ->
 fields(Name) ->
-    ee_fields(?EE_SCHEMA_MODULES, Name).
+    ee_delegate(fields, ?EE_SCHEMA_MODULES, Name).
 
 
 translations() ->
 translations() ->
     emqx_conf_schema:translations().
     emqx_conf_schema:translations().
@@ -34,16 +29,27 @@ translations() ->
 translation(Name) ->
 translation(Name) ->
     emqx_conf_schema:translation(Name).
     emqx_conf_schema:translation(Name).
 
 
+desc(Name) ->
+    ee_delegate(desc, ?EE_SCHEMA_MODULES, Name).
+
 %%------------------------------------------------------------------------------
 %%------------------------------------------------------------------------------
 %% helpers
 %% helpers
 %%------------------------------------------------------------------------------
 %%------------------------------------------------------------------------------
 
 
-ee_fields([EEMod | EEMods], Name) ->
+ee_roots() ->
+    lists:flatmap(
+        fun(Module) ->
+            apply(Module, roots, [])
+        end,
+        ?EE_SCHEMA_MODULES
+    ).
+
+ee_delegate(Method, [EEMod | EEMods], Name) ->
     case lists:member(Name, apply(EEMod, roots, [])) of
     case lists:member(Name, apply(EEMod, roots, [])) of
         true ->
         true ->
-            apply(EEMod, fields, [Name]);
+            EEMod:Method(Name);
         false ->
         false ->
-            ee_fields(EEMods, Name)
+            ee_delegate(Method, EEMods, Name)
     end;
     end;
-ee_fields([], Name) ->
-    emqx_conf_schema:fields(Name).
+ee_delegate(Method, [], Name) ->
+    emqx_conf_schema:Method(Name).