fix: add namespace to schema

This commit is contained in:
Zhongwen Deng 2022-04-24 15:13:36 +08:00
parent a27caff5af
commit 7d9403d056
6 changed files with 14 additions and 6 deletions

View File

@ -102,7 +102,7 @@
-elvis([{elvis_style, god_modules, disable}]). -elvis([{elvis_style, god_modules, disable}]).
namespace() -> undefined. namespace() -> broker.
roots() -> roots() ->
%% TODO change config importance to a field metadata %% TODO change config importance to a field metadata
@ -2219,7 +2219,7 @@ authentication(Desc) ->
undefined -> Default; undefined -> Default;
Module -> hoconsc:lazy(Module:root_type()) Module -> hoconsc:lazy(Module:root_type())
end, end,
desc_id => authentication_0, desc_id => "authentication_0",
desc => iolist_to_binary([ desc => iolist_to_binary([
Desc, Desc,
"\nAuthentication can be one single authenticator instance or a chain of " "\nAuthentication can be one single authenticator instance or a chain of "

View File

@ -62,7 +62,7 @@
, emqx_slow_subs_schema , emqx_slow_subs_schema
]). ]).
namespace() -> undefined. namespace() -> cluster.
roots() -> roots() ->
PtKey = ?EMQX_AUTHENTICATION_SCHEMA_MODULE_PT_KEY, PtKey = ?EMQX_AUTHENTICATION_SCHEMA_MODULE_PT_KEY,

View File

@ -22,7 +22,7 @@
-import(hoconsc, [mk/2, ref/2]). -import(hoconsc, [mk/2, ref/2]).
-export([roots/0, fields/1, desc/1]). -export([namespace/0, roots/0, fields/1, desc/1]).
-export([ get_response/0 -export([ get_response/0
, put_request/0 , put_request/0
@ -51,6 +51,8 @@ http_schema(Method) ->
%%====================================================================================== %%======================================================================================
%% Hocon Schema Definitions %% Hocon Schema Definitions
namespace() -> connector.
roots() -> ["connectors"]. roots() -> ["connectors"].
fields(connectors) -> fields("connectors"); fields(connectors) -> fields("connectors");

View File

@ -21,7 +21,8 @@
-behaviour(hocon_schema). -behaviour(hocon_schema).
-export([ roots/0 -export([ namespace/0
, roots/0
, fields/1 , fields/1
, desc/1 , desc/1
]). ]).
@ -34,6 +35,8 @@
-import(emqx_schema, [mk_duration/2]). -import(emqx_schema, [mk_duration/2]).
namespace() -> "connector-mqtt".
roots() -> roots() ->
fields("config"). fields("config").

View File

@ -24,7 +24,7 @@
desc/1 desc/1
]). ]).
namespace() -> <<"dashboard">>. namespace() -> dashboard.
roots() -> ["dashboard"]. roots() -> ["dashboard"].
fields("dashboard") -> fields("dashboard") ->

View File

@ -22,12 +22,15 @@
-include_lib("hocon/include/hoconsc.hrl"). -include_lib("hocon/include/hoconsc.hrl").
-export([ -export([
namespace/0,
roots/0, roots/0,
fields/1 fields/1
]). ]).
-import(emqx_schema, [sc/2]). -import(emqx_schema, [sc/2]).
namespace() -> "authn-psk".
roots() -> ["psk_authentication"]. roots() -> ["psk_authentication"].
fields("psk_authentication") -> fields("psk_authentication") ->