Browse Source

refactor(schema): implement new hocon_schema callbacks

Zaiming Shi 4 years atrás
parent
commit
5165fd6b30
35 changed files with 100 additions and 115 deletions
  1. 1 1
      apps/emqx/rebar.config
  2. 3 5
      apps/emqx/src/emqx_config.erl
  3. 5 4
      apps/emqx/src/emqx_schema.erl
  4. 2 2
      apps/emqx/test/emqx_plugins_SUITE_data/emqx_hocon_plugin/src/emqx_hocon_plugin_schema.erl
  5. 2 2
      apps/emqx_authn/src/emqx_authn_schema.erl
  6. 2 2
      apps/emqx_authn/src/enhanced_authn/emqx_enhanced_authn_scram_mnesia.erl
  7. 3 5
      apps/emqx_authn/src/simple_authn/emqx_authn_http.erl
  8. 3 5
      apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl
  9. 3 3
      apps/emqx_authn/src/simple_authn/emqx_authn_mnesia.erl
  10. 3 5
      apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl
  11. 2 2
      apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl
  12. 2 2
      apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl
  13. 3 5
      apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl
  14. 3 3
      apps/emqx_authz/src/emqx_authz_schema.erl
  15. 2 2
      apps/emqx_auto_subscribe/src/emqx_auto_subscribe_schema.erl
  16. 4 2
      apps/emqx_bridge_mqtt/src/emqx_bridge_mqtt_schema.erl
  17. 3 5
      apps/emqx_connector/src/emqx_connector_http.erl
  18. 5 5
      apps/emqx_connector/src/emqx_connector_ldap.erl
  19. 4 5
      apps/emqx_connector/src/emqx_connector_mongo.erl
  20. 3 5
      apps/emqx_connector/src/emqx_connector_mysql.erl
  21. 3 4
      apps/emqx_connector/src/emqx_connector_pgsql.erl
  22. 4 5
      apps/emqx_connector/src/emqx_connector_redis.erl
  23. 2 2
      apps/emqx_connector/src/emqx_connector_schema_lib.erl
  24. 2 2
      apps/emqx_dashboard/src/emqx_dashboard_schema.erl
  25. 3 3
      apps/emqx_data_bridge/src/emqx_data_bridge_schema.erl
  26. 2 2
      apps/emqx_exhook/src/emqx_exhook_schema.erl
  27. 2 6
      apps/emqx_gateway/src/emqx_gateway_schema.erl
  28. 8 5
      apps/emqx_machine/src/emqx_machine_schema.erl
  29. 2 2
      apps/emqx_management/src/emqx_management_schema.erl
  30. 5 4
      apps/emqx_modules/src/emqx_modules_schema.erl
  31. 2 2
      apps/emqx_prometheus/src/emqx_prometheus_schema.erl
  32. 2 2
      apps/emqx_retainer/src/emqx_retainer_schema.erl
  33. 2 2
      apps/emqx_rule_engine/src/emqx_rule_engine_schema.erl
  34. 2 2
      apps/emqx_statsd/src/emqx_statsd_schema.erl
  35. 1 2
      rebar.config.erl

+ 1 - 1
apps/emqx/rebar.config

@@ -28,7 +28,7 @@
        [{deps,
            [ meck
            , {bbmustache,"1.10.0"}
-           , {emqx_ct_helpers, {git,"https://github.com/emqx/emqx-ct-helpers.git", {branch,"hocon"}}}
+           , {emqx_ct_helpers, {git,"https://github.com/emqx/emqx-ct-helpers.git", {tag,"2.1.0"}}}
            , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.3"}}}
            ]},
          {extra_src_dirs, [{"test",[recursive]}]}

+ 3 - 5
apps/emqx/src/emqx_config.erl

@@ -298,10 +298,11 @@ read_override_conf() ->
 
 -spec save_schema_mod_and_names(module()) -> ok.
 save_schema_mod_and_names(SchemaMod) ->
-    RootNames = SchemaMod:structs(),
+    RootNames = hocon_schema:root_names(SchemaMod),
     OldMods = get_schema_mod(),
     OldNames = get_root_names(),
-    NewMods = maps:from_list([{root_bin(Name), SchemaMod} || Name <- RootNames]),
+    %% map from root name to schema module name
+    NewMods = maps:from_list([{Name, SchemaMod} || Name <- RootNames]),
     persistent_term:put(?PERSIS_SCHEMA_MODS, #{
         mods => maps:merge(OldMods, NewMods),
         names => lists:usort(OldNames ++ RootNames)
@@ -442,6 +443,3 @@ conf_key(?CONF, RootName) ->
     atom(RootName);
 conf_key(?RAW_CONF, RootName) ->
     bin(RootName).
-
-root_bin({array, Bin}) -> bin(Bin);
-root_bin(Bin) -> bin(Bin).

+ 5 - 4
apps/emqx/src/emqx_schema.erl

@@ -65,14 +65,15 @@
                 cipher/0,
                 comma_separated_atoms/0]).
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 -export([t/1, t/3, t/4, ref/1]).
 -export([conf_get/2, conf_get/3, keys/2, filter/1]).
 -export([ssl/1]).
 
-structs() -> ["zones", "mqtt", "flapping_detect", "force_shutdown", "force_gc",
-    "conn_congestion", "rate_limit", "quota", "listeners", "broker", "plugins",
-    "stats", "sysmon", "alarm", "authorization"].
+roots() ->
+    ["zones", "mqtt", "flapping_detect", "force_shutdown", "force_gc",
+     "conn_congestion", "rate_limit", "quota", "listeners", "broker", "plugins",
+     "stats", "sysmon", "alarm", "authorization"].
 
 fields("stats") ->
     [ {"enable", t(boolean(), undefined, true)}

+ 2 - 2
apps/emqx/test/emqx_plugins_SUITE_data/emqx_hocon_plugin/src/emqx_hocon_plugin_schema.erl

@@ -2,11 +2,11 @@
 
 -include_lib("typerefl/include/types.hrl").
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 -behaviour(hocon_schema).
 
-structs() -> ["emqx_hocon_plugin"].
+roots() -> ["emqx_hocon_plugin"].
 
 fields("emqx_hocon_plugin") ->
     [{name, fun name/1}].

+ 2 - 2
apps/emqx_authn/src/emqx_authn_schema.erl

@@ -21,7 +21,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         ]).
 
@@ -32,7 +32,7 @@
 -export([ authenticators/1
         ]).
 
-structs() -> [ "authentication" ].
+roots() -> [ "authentication" ].
 
 fields("authentication") ->
     [ {enable, fun enable/1}

+ 2 - 2
apps/emqx_authn/src/enhanced_authn/emqx_enhanced_authn_scram_mnesia.erl

@@ -21,7 +21,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         ]).
 
@@ -74,7 +74,7 @@ mnesia(copy) ->
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [config].
+roots() -> [config].
 
 fields(config) ->
     [ {name,            fun emqx_authn_schema:authenticator_name/1}

+ 3 - 5
apps/emqx_authn/src/simple_authn/emqx_authn_http.erl

@@ -22,7 +22,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         , validations/0
         ]).
@@ -37,13 +37,11 @@
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [""].
-
-fields("") ->
+roots() ->
     [ {config, {union, [ hoconsc:t(get)
                        , hoconsc:t(post)
                        ]}}
-    ];
+    ].
 
 fields(get) ->
     [ {method,          #{type => get,

+ 3 - 5
apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl

@@ -20,7 +20,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         ]).
 
@@ -34,14 +34,12 @@
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [""].
-
-fields("") ->
+roots() ->
     [ {config, {union, [ hoconsc:t('hmac-based')
                        , hoconsc:t('public-key')
                        , hoconsc:t('jwks')
                        ]}}
-    ];
+    ].
 
 fields('hmac-based') ->
     [ {use_jwks,              {enum, [false]}}

+ 3 - 3
apps/emqx_authn/src/simple_authn/emqx_authn_mnesia.erl

@@ -21,7 +21,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0, fields/1 ]).
+-export([ roots/0, fields/1 ]).
 
 -export([ create/1
         , update/2
@@ -79,7 +79,7 @@ mnesia(copy) ->
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [config].
+roots() -> [config].
 
 fields(config) ->
     [ {name,                    fun emqx_authn_schema:authenticator_name/1}
@@ -391,4 +391,4 @@ to_binary(L) when is_list(L) ->
     iolist_to_binary(L).
 
 serialize_user_info(#user_info{user_id = {_, UserID}, superuser = Superuser}) ->
-    #{user_id => UserID, superuser => Superuser}.
+    #{user_id => UserID, superuser => Superuser}.

+ 3 - 5
apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl

@@ -22,7 +22,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         ]).
 
@@ -36,14 +36,12 @@
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [""].
-
-fields("") ->
+roots() ->
     [ {config, {union, [ hoconsc:t(standalone)
                        , hoconsc:t('replica-set')
                        , hoconsc:t('sharded-cluster')
                        ]}}
-    ];
+    ].
 
 fields(standalone) ->
     common_fields() ++ emqx_connector_mongo:fields(single);

+ 2 - 2
apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl

@@ -22,7 +22,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         ]).
 
@@ -36,7 +36,7 @@
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [config].
+roots() -> [config].
 
 fields(config) ->
     [ {name,                    fun emqx_authn_schema:authenticator_name/1}

+ 2 - 2
apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl

@@ -23,7 +23,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0, fields/1 ]).
+-export([ roots/0, fields/1 ]).
 
 -export([ create/1
         , update/2
@@ -35,7 +35,7 @@
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [config].
+roots() -> [config].
 
 fields(config) ->
     [ {name,                    fun emqx_authn_schema:authenticator_name/1}

+ 3 - 5
apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl

@@ -22,7 +22,7 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         ]).
 
@@ -36,14 +36,12 @@
 %% Hocon Schema
 %%------------------------------------------------------------------------------
 
-structs() -> [""].
-
-fields("") ->
+roots() ->
     [ {config, {union, [ hoconsc:t(standalone)
                        , hoconsc:t(cluster)
                        , hoconsc:t(sentinel)
                        ]}}
-    ];
+    ].
 
 fields(standalone) ->
     common_fields() ++ emqx_connector_redis:fields(single);

+ 3 - 3
apps/emqx_authz/src/emqx_authz_schema.erl

@@ -13,11 +13,11 @@
 -type permission() :: allow | deny.
 -type url() :: emqx_http_lib:uri_map().
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         ]).
 
-structs() -> ["authorization"].
+roots() -> ["authorization"].
 
 fields("authorization") ->
     [ {sources, sources()}
@@ -180,4 +180,4 @@ connector_fields(DB) ->
     [ {type, #{type => DB}}
     , {enable, #{type => boolean(),
                  default => true}}
-    ] ++ Mod:fields("").
+    ] ++ Mod:roots().

+ 2 - 2
apps/emqx_auto_subscribe/src/emqx_auto_subscribe_schema.erl

@@ -19,10 +19,10 @@
 
 -include_lib("typerefl/include/types.hrl").
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
-structs() ->
+roots() ->
     ["auto_subscribe"].
 
 fields("auto_subscribe") ->

+ 4 - 2
apps/emqx_bridge_mqtt/src/emqx_bridge_mqtt_schema.erl

@@ -20,10 +20,12 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
-structs() -> [{array, "bridge_mqtt"}].
+roots() -> [array("bridge_mqtt")].
+
+array(Name) -> {Name, hoconsc:array(hoconsc:ref(Name))}.
 
 fields("bridge_mqtt") ->
     [ {name, emqx_schema:t(string(), undefined, true)}

+ 3 - 5
apps/emqx_connector/src/emqx_connector_http.erl

@@ -32,7 +32,7 @@
 -reflect_type([url/0]).
 -typerefl_from_string({url/0, emqx_http_lib, uri_parse}).
 
--export([ structs/0
+-export([ roots/0
         , fields/1
         , validations/0]).
 
@@ -47,10 +47,8 @@
 
 %%=====================================================================
 %% Hocon schema
-structs() -> [""].
-
-fields("") ->
-    [{config, #{type => hoconsc:ref(?MODULE, config)}}];
+roots() ->
+    [{config, #{type => hoconsc:ref(?MODULE, config)}}].
 
 fields(config) ->
     [ {base_url,          fun base_url/1}

+ 5 - 5
apps/emqx_connector/src/emqx_connector_ldap.erl

@@ -19,7 +19,7 @@
 -include_lib("typerefl/include/types.hrl").
 -include_lib("emqx_resource/include/emqx_resource_behaviour.hrl").
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 %% callbacks of behaviour emqx_resource
 -export([ on_start/2
@@ -35,11 +35,11 @@
 
 -export([search/4]).
 %%=====================================================================
-structs() -> [""].
+roots() ->
+    ldap_fields() ++ emqx_connector_schema_lib:ssl_fields().
 
-fields("") ->
-    ldap_fields() ++
-    emqx_connector_schema_lib:ssl_fields().
+%% this schema has no sub-structs
+fields(_) -> [].
 
 on_jsonify(Config) ->
     Config.

+ 4 - 5
apps/emqx_connector/src/emqx_connector_mongo.erl

@@ -33,19 +33,18 @@
 
 -export([connect/1]).
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 -export([mongo_query/5]).
 %%=====================================================================
-structs() -> [""].
-
-fields("") ->
+roots() ->
     [ {config, #{type => hoconsc:union(
                           [ hoconsc:ref(?MODULE, single)
                           , hoconsc:ref(?MODULE, rs)
                           , hoconsc:ref(?MODULE, sharded)
                           ])}}
-    ];
+    ].
+
 fields(single) ->
     [ {mongo_type, #{type => single,
                      default => single}}

+ 3 - 5
apps/emqx_connector/src/emqx_connector_mysql.erl

@@ -28,16 +28,14 @@
 
 -export([connect/1]).
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 -export([do_health_check/1]).
 
 %%=====================================================================
 %% Hocon schema
-structs() -> [""].
-
-fields("") ->
-    [{config, #{type => hoconsc:ref(?MODULE, config)}}];
+roots() ->
+    [{config, #{type => hoconsc:ref(?MODULE, config)}}].
 
 fields(config) ->
     emqx_connector_schema_lib:relational_db_fields() ++

+ 3 - 4
apps/emqx_connector/src/emqx_connector_pgsql.erl

@@ -18,7 +18,7 @@
 -include_lib("typerefl/include/types.hrl").
 -include_lib("emqx_resource/include/emqx_resource_behaviour.hrl").
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 %% callbacks of behaviour emqx_resource
 -export([ on_start/2
@@ -35,10 +35,9 @@
 -export([do_health_check/1]).
 
 %%=====================================================================
-structs() -> [""].
 
-fields("") ->
-    [{config, #{type => hoconsc:ref(?MODULE, config)}}];
+roots() ->
+    [{config, #{type => hoconsc:ref(?MODULE, config)}}].
 
 fields(config) ->
     emqx_connector_schema_lib:relational_db_fields() ++

+ 4 - 5
apps/emqx_connector/src/emqx_connector_redis.erl

@@ -23,7 +23,7 @@
 -reflect_type([server/0]).
 -typerefl_from_string({server/0, emqx_connector_schema_lib, to_ip_port}).
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 %% callbacks of behaviour emqx_resource
 -export([ on_start/2
@@ -40,16 +40,15 @@
 -export([cmd/3]).
 
 %%=====================================================================
-structs() -> [""].
-
-fields("") ->
+roots() ->
     [ {config, #{type => hoconsc:union(
                   [ hoconsc:ref(?MODULE, cluster)
                   , hoconsc:ref(?MODULE, single)
                   , hoconsc:ref(?MODULE, sentinel)
                   ])}
       }
-    ];
+    ].
+
 fields(single) ->
     [ {server, #{type => server()}}
     , {redis_type, #{type => hoconsc:enum([single]),

+ 2 - 2
apps/emqx_connector/src/emqx_connector_schema_lib.erl

@@ -51,9 +51,9 @@
               , servers/0
              ]).
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
-structs() -> [ssl_on, ssl_off].
+roots() -> [ssl_on, ssl_off].
 
 fields(ssl_on) ->
     [ {enable, #{type => true}}

+ 2 - 2
apps/emqx_dashboard/src/emqx_dashboard_schema.erl

@@ -17,10 +17,10 @@
 
 -include_lib("typerefl/include/types.hrl").
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
-structs() -> ["emqx_dashboard"].
+roots() -> ["emqx_dashboard"].
 
 fields("emqx_dashboard") ->
     [ {listeners, hoconsc:array(hoconsc:union([hoconsc:ref(?MODULE, "http"),

+ 3 - 3
apps/emqx_data_bridge/src/emqx_data_bridge_schema.erl

@@ -1,6 +1,6 @@
 -module(emqx_data_bridge_schema).
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 %%======================================================================================
 %% Hocon Schema Definitions
@@ -8,7 +8,7 @@
 -define(TYPES, [mysql, pgsql, mongo, redis, ldap]).
 -define(BRIDGES, [hoconsc:ref(?MODULE, T) || T <- ?TYPES]).
 
-structs() -> ["emqx_data_bridge"].
+roots() -> ["emqx_data_bridge"].
 
 fields("emqx_data_bridge") ->
     [{bridges, #{type => hoconsc:array(hoconsc:union(?BRIDGES)),
@@ -23,4 +23,4 @@ fields(ldap)  -> connector_fields(ldap).
 connector_fields(DB) ->
     Mod = list_to_existing_atom(io_lib:format("~s_~s",[emqx_connector, DB])),
     [{name, hoconsc:t(typerefl:binary())},
-     {type, #{type => DB}}] ++ Mod:fields("").
+     {type, #{type => DB}}] ++ Mod:roots().

+ 2 - 2
apps/emqx_exhook/src/emqx_exhook_schema.erl

@@ -32,11 +32,11 @@
 
 -reflect_type([duration/0]).
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 -export([t/1, t/3, t/4, ref/1]).
 
-structs() -> [exhook].
+roots() -> [exhook].
 
 fields(exhook) ->
     [ {request_failed_action, t(union([deny, ignore]), undefined, deny)}

+ 2 - 6
apps/emqx_gateway/src/emqx_gateway_schema.erl

@@ -43,14 +43,10 @@
               , ip_port/0
               ]).
 
--export([structs/0 , fields/1]).
-
+-export([roots/0 , fields/1]).
 -export([t/1, t/3, t/4, ref/1]).
 
-%%--------------------------------------------------------------------
-%% Structs
-
-structs() -> [gateway].
+roots() -> [gateway].
 
 fields(gateway) ->
     [{stomp, t(ref(stomp_structs))},

+ 8 - 5
apps/emqx_machine/src/emqx_machine_schema.erl

@@ -34,7 +34,7 @@
                 file/0,
                 cipher/0]).
 
--export([structs/0, fields/1, translations/0, translation/1]).
+-export([roots/0, fields/1, translations/0, translation/1]).
 -export([t/1, t/3, t/4, ref/1]).
 -export([conf_get/2, conf_get/3, keys/2, filter/1]).
 
@@ -59,9 +59,9 @@
         ]).
 
 %% TODO: add a test case to ensure the list elements are unique
-structs() ->
+roots() ->
     ["cluster", "node", "rpc", "log"]
-    ++ lists:flatmap(fun(Mod) -> Mod:structs() end, ?MERGED_CONFIGS).
+    ++ lists:flatmap(fun(Mod) -> Mod:roots() end, ?MERGED_CONFIGS).
 
 fields("cluster") ->
     [ {"name", t(atom(), "ekka.cluster_name", emqxcl)}
@@ -215,8 +215,7 @@ fields(Name) ->
 find_field(Name, []) ->
     error({unknown_config_struct_field, Name});
 find_field(Name, [SchemaModule | Rest]) ->
-    case lists:member(Name, SchemaModule:structs()) orelse
-        lists:keymember(Name, 2, SchemaModule:structs()) of
+    case lists:member(bin(Name), hocon_schema:root_names(SchemaModule)) of
         true -> SchemaModule:fields(Name);
         false -> find_field(Name, Rest)
     end.
@@ -475,3 +474,7 @@ to_atom(Str) when is_list(Str) ->
     list_to_atom(Str);
 to_atom(Bin) when is_binary(Bin) ->
     binary_to_atom(Bin, utf8).
+
+bin(Atom) when is_atom(Atom) -> atom_to_binary(Atom, utf8);
+bin(Bin) when is_binary(Bin) -> Bin;
+bin(L) when is_list(L) -> iolist_to_binary(L).

+ 2 - 2
apps/emqx_management/src/emqx_management_schema.erl

@@ -19,9 +19,9 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
-structs() -> [].
+roots() -> [].
 
 fields(_) -> [].

+ 5 - 4
apps/emqx_modules/src/emqx_modules_schema.erl

@@ -20,16 +20,16 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
-structs() ->
+roots() ->
     ["delayed",
      "recon",
      "telemetry",
      "event_message",
-     {array, "rewrite"},
-     {array, "topic_metrics"}].
+     array("rewrite"),
+     array("topic_metrics")].
 
 fields(Name) when Name =:= "recon";
                   Name =:= "telemetry" ->
@@ -61,3 +61,4 @@ fields("event_message") ->
 fields("topic_metrics") ->
     [{topic, emqx_schema:t(binary())}].
 
+array(Name) -> {Name, hoconsc:array(hoconsc:ref(Name))}.

+ 2 - 2
apps/emqx_prometheus/src/emqx_prometheus_schema.erl

@@ -19,10 +19,10 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
-structs() -> ["prometheus"].
+roots() -> ["prometheus"].
 
 fields("prometheus") ->
     [ {push_gateway_server, emqx_schema:t(string())}

+ 2 - 2
apps/emqx_retainer/src/emqx_retainer_schema.erl

@@ -2,11 +2,11 @@
 
 -include_lib("typerefl/include/types.hrl").
 
--export([structs/0, fields/1]).
+-export([roots/0, fields/1]).
 
 -define(TYPE(Type), hoconsc:t(Type)).
 
-structs() -> ["emqx_retainer"].
+roots() -> ["emqx_retainer"].
 
 fields("emqx_retainer") ->
     [ {enable, t(boolean(), false)}

+ 2 - 2
apps/emqx_rule_engine/src/emqx_rule_engine_schema.erl

@@ -20,10 +20,10 @@
 
 -behaviour(hocon_schema).
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
-structs() -> ["emqx_rule_engine"].
+roots() -> ["emqx_rule_engine"].
 
 fields("emqx_rule_engine") ->
     [{ignore_sys_message, emqx_schema:t(boolean(), undefined, true)}].

+ 2 - 2
apps/emqx_statsd/src/emqx_statsd_schema.erl

@@ -6,12 +6,12 @@
 
 -export([to_ip_port/1]).
 
--export([ structs/0
+-export([ roots/0
         , fields/1]).
 
 -typerefl_from_string({ip_port/0, emqx_statsd_schema, to_ip_port}).
 
-structs() -> ["statsd"].
+roots() -> ["statsd"].
 
 fields("statsd") ->
     [ {enable, emqx_schema:t(boolean(), undefined, false)}

+ 1 - 2
rebar.config.erl

@@ -127,8 +127,7 @@ test_plugins() ->
 
 test_deps() ->
     [ {bbmustache, "1.10.0"}
-    %, {emqx_ct_helpers, {git, "https://github.com/emqx/emqx-ct-helpers", {tag, "2.0.0"}}}
-    , {emqx_ct_helpers, {git, "https://github.com/emqx/emqx-ct-helpers", {branch, "hocon"}}}
+    , {emqx_ct_helpers, {git, "https://github.com/emqx/emqx-ct-helpers", {tag, "2.1.0"}}}
     , meck
     ].