Merge pull request #6512 from terry-xiaoyu/fix_rule_api_swagger
Fix rule api swagger
This commit is contained in:
commit
967989075c
|
@ -68,6 +68,7 @@ fields("rule_events") ->
|
||||||
fields("rule_test") ->
|
fields("rule_test") ->
|
||||||
[ {"context", sc(hoconsc:union([ ref("ctx_pub")
|
[ {"context", sc(hoconsc:union([ ref("ctx_pub")
|
||||||
, ref("ctx_sub")
|
, ref("ctx_sub")
|
||||||
|
, ref("ctx_unsub")
|
||||||
, ref("ctx_delivered")
|
, ref("ctx_delivered")
|
||||||
, ref("ctx_acked")
|
, ref("ctx_acked")
|
||||||
, ref("ctx_dropped")
|
, ref("ctx_dropped")
|
||||||
|
|
|
@ -257,11 +257,16 @@ format_output(Outputs) ->
|
||||||
[do_format_output(Out) || Out <- Outputs].
|
[do_format_output(Out) || Out <- Outputs].
|
||||||
|
|
||||||
do_format_output(#{mod := Mod, func := Func, args := Args}) ->
|
do_format_output(#{mod := Mod, func := Func, args := Args}) ->
|
||||||
#{function => list_to_binary(lists:concat([Mod,":",Func])),
|
#{function => printable_function_name(Mod, Func),
|
||||||
args => maps:remove(preprocessed_tmpl, Args)};
|
args => maps:remove(preprocessed_tmpl, Args)};
|
||||||
do_format_output(BridgeChannelId) when is_binary(BridgeChannelId) ->
|
do_format_output(BridgeChannelId) when is_binary(BridgeChannelId) ->
|
||||||
BridgeChannelId.
|
BridgeChannelId.
|
||||||
|
|
||||||
|
printable_function_name(emqx_rule_outputs, Func) ->
|
||||||
|
Func;
|
||||||
|
printable_function_name(Mod, Func) ->
|
||||||
|
list_to_binary(lists:concat([Mod,":",Func])).
|
||||||
|
|
||||||
get_rule_metrics(Id) ->
|
get_rule_metrics(Id) ->
|
||||||
Format = fun (Node, #{matched := Matched,
|
Format = fun (Node, #{matched := Matched,
|
||||||
rate := Current,
|
rate := Current,
|
||||||
|
|
|
@ -182,6 +182,7 @@ rule_name() ->
|
||||||
{"name", sc(binary(),
|
{"name", sc(binary(),
|
||||||
#{ desc => "The name of the rule"
|
#{ desc => "The name of the rule"
|
||||||
, default => ""
|
, default => ""
|
||||||
|
, nullable => false
|
||||||
, example => "foo"
|
, example => "foo"
|
||||||
})}.
|
})}.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue