fix(ft): make ee schema aware of ee fields

This commit is contained in:
Ilya Averyanov 2023-04-05 13:36:34 +03:00
parent 18aa39f892
commit 2f1970adbc
2 changed files with 19 additions and 2 deletions

View File

@ -35,7 +35,7 @@
-reflect_type([json_value/0]).
-import(hoconsc, [ref/1, ref/2, mk/2]).
-import(hoconsc, [ref/2, mk/2]).
namespace() -> file_transfer.
@ -217,3 +217,6 @@ converter(checksum) ->
_ = byte_size(Hex) =:= 64 orelse throw({expected_length, 64}),
{sha256, binary:decode_hex(Hex)}
end.
ref(Ref) ->
ref(?MODULE, Ref).

View File

@ -26,10 +26,24 @@ roots() ->
).
fields(Name) ->
emqx_conf_schema:fields(Name).
ee_fields(?EE_SCHEMA_MODULES, Name).
translations() ->
emqx_conf_schema:translations().
translation(Name) ->
emqx_conf_schema:translation(Name).
%%------------------------------------------------------------------------------
%% helpers
%%------------------------------------------------------------------------------
ee_fields([EEMod | EEMods], Name) ->
case lists:member(Name, apply(EEMod, roots, [])) of
true ->
apply(EEMod, fields, [Name]);
false ->
ee_fields(EEMods, Name)
end;
ee_fields([], Name) ->
emqx_conf_schema:fields(Name).