fix(schema): add namespaces

This commit is contained in:
Zaiming (Stone) Shi 2023-11-28 12:07:42 +01:00
parent 1b1cea24f3
commit 6c85e62d26
6 changed files with 21 additions and 5 deletions

View File

@ -24,7 +24,7 @@
%%======================================================================================
%% Hocon Schema Definitions
namespace() -> "bridge_webhook".
namespace() -> "bridge_http".
roots() -> [].

View File

@ -12,7 +12,7 @@
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
-include_lib("hocon/include/hoconsc.hrl").
-export([roots/0, fields/1, desc/1, connector_examples/1]).
-export([namespace/0, roots/0, fields/1, desc/1, connector_examples/1]).
%% `emqx_resource' API
-export([
@ -44,6 +44,8 @@
%% -------------------------------------------------------------------------------------------------
%% api
namespace() -> "syskeeper_forwarder".
connector_examples(Method) ->
[
#{

View File

@ -306,7 +306,7 @@ gen_flat_doc(RootNames, #{full_name := FullName, fields := Fields} = S) ->
ShortName = short_name(FullName),
case is_missing_namespace(ShortName, to_bin(FullName), RootNames) of
true ->
io:format(standard_error, "WARN: no_namespace_for: ~s~n", [FullName]);
error({no_namespace, FullName, S});
false ->
ok
end,

View File

@ -4,12 +4,18 @@
-module(emqx_gbt32960_schema).
-behaviour(hocon_schema).
-include("emqx_gbt32960.hrl").
-include_lib("hocon/include/hoconsc.hrl").
-include_lib("typerefl/include/types.hrl").
%% config schema provides
-export([fields/1, desc/1]).
-export([namespace/0, roots/0, fields/1, desc/1]).
namespace() -> "gateway_gbt32960".
roots() -> [].
fields(gbt32960) ->
[

View File

@ -10,7 +10,11 @@
-define(DEFAULT_MOUNTPOINT, <<"ocpp/">>).
%% config schema provides
-export([fields/1, desc/1]).
-export([namespace/0, roots/0, fields/1, desc/1]).
namespace() -> "gateway_ocpp".
roots() -> [].
fields(ocpp) ->
[

View File

@ -24,6 +24,7 @@
}).
-export([
namespace/0,
roots/0,
fields/1,
desc/1
@ -37,6 +38,9 @@
-define(CONNECTOR_TYPE, pgsql).
namespace() ->
"connector_postgres".
roots() ->
[].