From 4fb484d4cffcd6cf789312fc43c1682a930f87bf Mon Sep 17 00:00:00 2001 From: zmstone Date: Mon, 13 May 2024 10:54:33 +0200 Subject: [PATCH] chore(emqx_schema): change atom array to enum array for alarm.actions --- apps/emqx/src/emqx_schema.erl | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index 6ab133757..c69fb75a3 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -93,7 +93,6 @@ validate_heap_size/1, validate_packet_size/1, user_lookup_fun_tr/2, - validate_alarm_actions/1, validate_keepalive_multiplier/1, non_empty_string/1, validations/0, @@ -1617,10 +1616,9 @@ fields("alarm") -> [ {"actions", sc( - hoconsc:array(atom()), + hoconsc:array(hoconsc:enum([log, publish])), #{ default => [log, publish], - validator => fun ?MODULE:validate_alarm_actions/1, example => [log, publish], desc => ?DESC(alarm_actions) } @@ -2731,15 +2729,6 @@ validate_keepalive_multiplier(Multiplier) when validate_keepalive_multiplier(_Multiplier) -> {error, #{reason => keepalive_multiplier_out_of_range, min => 1, max => 65535}}. -validate_alarm_actions(Actions) -> - UnSupported = lists:filter( - fun(Action) -> Action =/= log andalso Action =/= publish end, Actions - ), - case UnSupported of - [] -> ok; - Error -> {error, Error} - end. - validate_tcp_keepalive(Value) -> case iolist_to_binary(Value) of <<"none">> ->