fix(emqx_resource): fix schema schema definition
This commit is contained in:
parent
49f844b1dd
commit
9a78f812e1
|
@ -1,6 +1,5 @@
|
|||
-module(emqx_schema).
|
||||
|
||||
% tmp
|
||||
-dialyzer(no_return).
|
||||
-dialyzer(no_match).
|
||||
-dialyzer(no_contracts).
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
-include_lib("typerefl/include/types.hrl").
|
||||
-include_lib("emqx_resource/include/emqx_resource_behaviour.hrl").
|
||||
|
||||
-export([ schema/0
|
||||
-export([ structs/0
|
||||
, fields/1
|
||||
]).
|
||||
|
||||
%% callbacks of behaviour emqx_resource
|
||||
|
@ -34,6 +35,10 @@
|
|||
-export([do_health_check/1]).
|
||||
|
||||
%%=====================================================================
|
||||
|
||||
structs() -> ["config"].
|
||||
fields("config") -> schema().
|
||||
|
||||
schema() ->
|
||||
emqx_connector_schema_lib:relational_db_fields() ++
|
||||
emqx_connector_schema_lib:ssl_fields().
|
||||
|
|
|
@ -18,21 +18,6 @@
|
|||
|
||||
-export([check/2]).
|
||||
|
||||
-export([structs/0, fields/1]).
|
||||
|
||||
-behaviour(hocon_schema).
|
||||
|
||||
check(SchemaMod, Conf) ->
|
||||
_ = erlang:erase(res_schema_mod),
|
||||
erlang:put(res_schema_mod, SchemaMod),
|
||||
hocon_schema:check(?MODULE, Conf).
|
||||
hocon_schema:check(SchemaMod, Conf, #{nullable => false}).
|
||||
|
||||
structs() -> ["config"].
|
||||
|
||||
fields("config") ->
|
||||
[fun(type) -> "schema";
|
||||
(_) -> undefined
|
||||
end];
|
||||
fields("schema") ->
|
||||
SchemaMod = erlang:get(res_schema_mod),
|
||||
SchemaMod:schema().
|
||||
|
|
Loading…
Reference in New Issue