refactor(schema): add namespace/0 to all schema modules

This commit is contained in:
Zaiming (Stone) Shi 2023-11-08 23:13:26 +01:00
parent 7b59d46854
commit d603de10e6
5 changed files with 14 additions and 4 deletions

View File

@ -20,7 +20,7 @@
-behaviour(ecpool_worker). -behaviour(ecpool_worker).
%% hocon_schema callbacks %% hocon_schema callbacks
-export([roots/0, fields/1]). -export([namespace/0, roots/0, fields/1]).
%% HTTP API callbacks %% HTTP API callbacks
-export([values/1]). -export([values/1]).
@ -43,6 +43,8 @@
%% Internal callbacks %% Internal callbacks
-export([publish_messages/3]). -export([publish_messages/3]).
namespace() -> "rabbitmq".
roots() -> roots() ->
[{config, #{type => hoconsc:ref(?MODULE, config)}}]. [{config, #{type => hoconsc:ref(?MODULE, config)}}].

View File

@ -13,12 +13,14 @@
-behaviour(hocon_schema). -behaviour(hocon_schema).
-export([roots/0, fields/1, validations/0, desc/1, tags/0]). -export([namespace/0, roots/0, fields/1, validations/0, desc/1, tags/0]).
-export([ -export([
default_license/0 default_license/0
]). ]).
namespace() -> "license".
roots() -> roots() ->
[ [
{license, {license,

View File

@ -24,7 +24,7 @@
-export([check_params/2]). -export([check_params/2]).
-export([roots/0, fields/1]). -export([namespace/0, roots/0, fields/1]).
-type tag() :: rule_creation | rule_test | rule_engine. -type tag() :: rule_creation | rule_test | rule_engine.
@ -46,6 +46,8 @@ check_params(Params, Tag) ->
%%====================================================================================== %%======================================================================================
%% Hocon Schema Definitions %% Hocon Schema Definitions
namespace() -> "rule_engine".
roots() -> roots() ->
[ [
{"rule_engine", sc(ref("rule_engine"), #{desc => ?DESC("root_rule_engine")})}, {"rule_engine", sc(ref("rule_engine"), #{desc => ?DESC("root_rule_engine")})},

View File

@ -22,11 +22,15 @@
-behaviour(hocon_schema). -behaviour(hocon_schema).
-export([ -export([
namespace/0,
roots/0, roots/0,
fields/1, fields/1,
desc/1 desc/1
]). ]).
%% 'emqxtel' to distinguish open-telemetry
namespace() -> "emqxtel".
roots() -> ["telemetry"]. roots() -> ["telemetry"].
fields("telemetry") -> fields("telemetry") ->