fix: problems found by @thalesmg in code review

Co-authored-by: Thales Macedo Garitezi <thalesmg@gmail.com>
This commit is contained in:
Kjell Winblad 2023-11-10 15:43:32 +01:00 committed by Ivan Dyachkov
parent 49fdfef8c3
commit e93b71d8d5
4 changed files with 9 additions and 13 deletions

View File

@ -1,3 +1,5 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@ -146,7 +148,7 @@ action_info_modules() ->
lists:usort(lists:flatten(ActionInfoModules) ++ hard_coded_action_info_modules()).
action_info_modules(App) ->
case application:get_env(App, emqx, action_info_module) of
case application:get_env(App, emqx_action_info_module) of
{ok, Module} ->
[Module];
_ ->

View File

@ -101,7 +101,7 @@
%% Compatibility Layer API
%% All public functions for the compatibility layer should be prefixed with
%% birdge_v1_
%% bridge_v1_
-export([
bridge_v1_lookup_and_transform/2,

View File

@ -90,13 +90,10 @@ api_schema(Method) ->
hoconsc:union(bridge_api_union(EE ++ APISchemas)).
registered_api_schemas(Method) ->
%% We *must* do this to ensure the module is really loaded, especially when we use
%% `call_hocon' from `nodetool' to generate initial configurations.
_ = emqx_bridge_v2:module_info(),
RegistredSchmeas = emqx_action_info:registered_schema_modules(),
RegisteredSchemas = emqx_action_info:registered_schema_modules(),
[
api_ref(SchemaModule, atom_to_binary(BridgeV2Type), Method ++ "_bridge_v2")
|| {BridgeV2Type, SchemaModule} <- RegistredSchmeas
|| {BridgeV2Type, SchemaModule} <- RegisteredSchemas
].
api_ref(Module, Type, Method) ->
@ -148,9 +145,6 @@ roots() ->
end.
fields(actions) ->
%% We *must* do this to ensure the module is really loaded, especially when we use
%% `call_hocon' from `nodetool' to generate initial configurations.
_ = emqx_bridge_v2:module_info(),
enterprise_fields_actions() ++
registered_schema_fields().

View File

@ -527,17 +527,17 @@ fields(resource_opts) ->
SupportedFields = [health_check_interval],
CreationOpts = emqx_resource_schema:create_opts(_Overrides = []),
lists:filter(fun({Field, _}) -> lists:member(Field, SupportedFields) end, CreationOpts);
fields(bridge_v2_field) ->
fields(action_field) ->
{kafka_producer,
mk(
hoconsc:map(name, ref(emqx_bridge_kafka, kafka_producer_action)),
#{
desc => <<"Kafka Producer Bridge V2 Config">>,
desc => <<"Kafka Producer Action Config">>,
required => false
}
)};
fields(action) ->
fields(bridge_v2_field).
fields(action_field).
desc("config_connector") ->
?DESC("desc_config");