chore(ftschema): mention `translate` is for tests purpose only
This commit is contained in:
parent
e3c16be3c4
commit
ce8cc05cc8
|
@ -25,9 +25,12 @@
|
||||||
|
|
||||||
-export([schema/1]).
|
-export([schema/1]).
|
||||||
|
|
||||||
-export([translate/1]).
|
%% Utilities
|
||||||
-export([backend/1]).
|
-export([backend/1]).
|
||||||
|
|
||||||
|
%% Test-only helpers
|
||||||
|
-export([translate/1]).
|
||||||
|
|
||||||
-type json_value() ::
|
-type json_value() ::
|
||||||
null
|
null
|
||||||
| boolean()
|
| boolean()
|
||||||
|
@ -327,11 +330,7 @@ converter(unicode_string) ->
|
||||||
ref(Ref) ->
|
ref(Ref) ->
|
||||||
ref(?MODULE, Ref).
|
ref(?MODULE, Ref).
|
||||||
|
|
||||||
translate(Conf) ->
|
%% Utilities
|
||||||
[Root] = roots(),
|
|
||||||
RootRaw = atom_to_binary(Root),
|
|
||||||
ConfChecked = hocon_tconf:check_plain(?MODULE, #{RootRaw => Conf}, #{}, [Root]),
|
|
||||||
emqx_utils_maps:unsafe_atom_key_map(maps:get(RootRaw, ConfChecked)).
|
|
||||||
|
|
||||||
-spec backend(emqx_config:config()) ->
|
-spec backend(emqx_config:config()) ->
|
||||||
{_Type :: atom(), emqx_config:config()}.
|
{_Type :: atom(), emqx_config:config()}.
|
||||||
|
@ -342,3 +341,13 @@ backend(Config) ->
|
||||||
no_return().
|
no_return().
|
||||||
emit_enabled(Type, BConf = #{enable := Enabled}) ->
|
emit_enabled(Type, BConf = #{enable := Enabled}) ->
|
||||||
Enabled andalso throw({Type, BConf}).
|
Enabled andalso throw({Type, BConf}).
|
||||||
|
|
||||||
|
%% Test-only helpers
|
||||||
|
|
||||||
|
-spec translate(emqx_config:raw_config()) ->
|
||||||
|
emqx_config:config().
|
||||||
|
translate(Conf) ->
|
||||||
|
[Root] = roots(),
|
||||||
|
RootRaw = atom_to_binary(Root),
|
||||||
|
ConfChecked = hocon_tconf:check_plain(?MODULE, #{RootRaw => Conf}, #{}, [Root]),
|
||||||
|
emqx_utils_maps:unsafe_atom_key_map(maps:get(RootRaw, ConfChecked)).
|
||||||
|
|
Loading…
Reference in New Issue