test: trigger hocon validators when checking schema
This commit is contained in:
parent
bb050d9767
commit
1edf284fed
|
@ -132,22 +132,26 @@ parse_and_check(Kind, Type, Name, InnerConfigMap0) ->
|
||||||
end,
|
end,
|
||||||
TypeBin = emqx_utils_conv:bin(Type),
|
TypeBin = emqx_utils_conv:bin(Type),
|
||||||
RawConf = #{RootBin => #{TypeBin => #{Name => InnerConfigMap0}}},
|
RawConf = #{RootBin => #{TypeBin => #{Name => InnerConfigMap0}}},
|
||||||
#{RootBin := #{TypeBin := #{Name := InnerConfigMap}}} = hocon_tconf:check_plain(
|
do_parse_and_check(RootBin, TypeBin, Name, emqx_bridge_v2_schema, RawConf).
|
||||||
emqx_bridge_v2_schema,
|
|
||||||
RawConf,
|
|
||||||
#{
|
|
||||||
required => false,
|
|
||||||
atom_key => false,
|
|
||||||
make_serializable => true
|
|
||||||
}
|
|
||||||
),
|
|
||||||
InnerConfigMap.
|
|
||||||
|
|
||||||
parse_and_check_connector(Type, Name, InnerConfigMap0) ->
|
parse_and_check_connector(Type, Name, InnerConfigMap0) ->
|
||||||
TypeBin = emqx_utils_conv:bin(Type),
|
TypeBin = emqx_utils_conv:bin(Type),
|
||||||
RawConf = #{<<"connectors">> => #{TypeBin => #{Name => InnerConfigMap0}}},
|
RawConf = #{<<"connectors">> => #{TypeBin => #{Name => InnerConfigMap0}}},
|
||||||
#{<<"connectors">> := #{TypeBin := #{Name := InnerConfigMap}}} = hocon_tconf:check_plain(
|
do_parse_and_check(<<"connectors">>, TypeBin, Name, emqx_connector_schema, RawConf).
|
||||||
emqx_connector_schema,
|
|
||||||
|
do_parse_and_check(RootBin, TypeBin, NameBin, SchemaMod, RawConf) ->
|
||||||
|
#{RootBin := #{TypeBin := #{NameBin := _}}} = hocon_tconf:check_plain(
|
||||||
|
SchemaMod,
|
||||||
|
RawConf,
|
||||||
|
#{
|
||||||
|
required => false,
|
||||||
|
atom_key => false,
|
||||||
|
%% to trigger validators that otherwise aren't triggered
|
||||||
|
make_serializable => false
|
||||||
|
}
|
||||||
|
),
|
||||||
|
#{RootBin := #{TypeBin := #{NameBin := InnerConfigMap}}} = hocon_tconf:check_plain(
|
||||||
|
SchemaMod,
|
||||||
RawConf,
|
RawConf,
|
||||||
#{
|
#{
|
||||||
required => false,
|
required => false,
|
||||||
|
|
Loading…
Reference in New Issue