refactor(api): swagger api tag `mqtt`
This commit is contained in:
parent
8ac63f823d
commit
1a0862913e
|
@ -1,5 +1,23 @@
|
|||
%%--------------------------------------------------------------------
|
||||
%% Copyright (c) 2021-2022 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.
|
||||
%% You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing, software
|
||||
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
%% See the License for the specific language governing permissions and
|
||||
%% limitations under the License.
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%% The destination URL for the telemetry data report
|
||||
-define(TELEMETRY_URL, "https://telemetry.emqx.io/api/telemetry").
|
||||
|
||||
%% Interval for reporting telemetry data, Default: 7d
|
||||
-define(REPORT_INTERVAR, 604800).
|
||||
|
||||
-define(API_TAG_MQTT, [<<"mqtt">>]).
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
-behaviour(minirest_api).
|
||||
|
||||
-include_lib("typerefl/include/types.hrl").
|
||||
-include("emqx_modules.hrl").
|
||||
|
||||
-import(hoconsc, [mk/2, ref/1, ref/2]).
|
||||
|
||||
|
@ -62,7 +63,7 @@ schema("/mqtt/delayed") ->
|
|||
#{
|
||||
'operationId' => status,
|
||||
get => #{
|
||||
tags => [<<"mqtt">>],
|
||||
tags => ?API_TAG_MQTT,
|
||||
description => <<"Get delayed status">>,
|
||||
summary => <<"Get delayed status">>,
|
||||
responses => #{
|
||||
|
@ -70,7 +71,7 @@ schema("/mqtt/delayed") ->
|
|||
}
|
||||
},
|
||||
put => #{
|
||||
tags => [<<"mqtt">>],
|
||||
tags => ?API_TAG_MQTT,
|
||||
description => <<"Enable or disable delayed, set max delayed messages">>,
|
||||
'requestBody' => ref(emqx_modules_schema, "delayed"),
|
||||
responses => #{
|
||||
|
@ -85,7 +86,7 @@ schema("/mqtt/delayed") ->
|
|||
schema("/mqtt/delayed/messages/:msgid") ->
|
||||
#{'operationId' => delayed_message,
|
||||
get => #{
|
||||
tags => [<<"mqtt">>],
|
||||
tags => ?API_TAG_MQTT,
|
||||
description => <<"Get delayed message">>,
|
||||
parameters => [{msgid, mk(binary(), #{in => path, desc => <<"delay message ID">>})}],
|
||||
responses => #{
|
||||
|
@ -97,7 +98,7 @@ schema("/mqtt/delayed/messages/:msgid") ->
|
|||
}
|
||||
},
|
||||
delete => #{
|
||||
tags => [<<"mqtt">>],
|
||||
tags => ?API_TAG_MQTT,
|
||||
description => <<"Delete delayed message">>,
|
||||
parameters => [{msgid, mk(binary(), #{in => path, desc => <<"delay message ID">>})}],
|
||||
responses => #{
|
||||
|
@ -113,7 +114,7 @@ schema("/mqtt/delayed/messages") ->
|
|||
#{
|
||||
'operationId' => delayed_messages,
|
||||
get => #{
|
||||
tags => [<<"mqtt">>],
|
||||
tags => ?API_TAG_MQTT,
|
||||
description => <<"List delayed messages">>,
|
||||
parameters => [ref(emqx_dashboard_swagger, page), ref(emqx_dashboard_swagger, limit)],
|
||||
responses => #{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
-behaviour(minirest_api).
|
||||
-include_lib("typerefl/include/types.hrl").
|
||||
-include("emqx_modules.hrl").
|
||||
|
||||
-export([api_spec/0, paths/0, schema/1]).
|
||||
|
||||
|
@ -42,7 +43,7 @@ schema("/mqtt/topic_rewrite") ->
|
|||
#{
|
||||
operationId => topic_rewrite,
|
||||
get => #{
|
||||
tags => [mqtt],
|
||||
tags => ?API_TAG_MQTT,
|
||||
description => <<"List rewrite topic.">>,
|
||||
responses => #{
|
||||
200 => hoconsc:mk(hoconsc:array(hoconsc:ref(emqx_modules_schema, "rewrite")),
|
||||
|
@ -51,6 +52,7 @@ schema("/mqtt/topic_rewrite") ->
|
|||
},
|
||||
put => #{
|
||||
description => <<"Update rewrite topic">>,
|
||||
tags => ?API_TAG_MQTT,
|
||||
requestBody => hoconsc:mk(hoconsc:array(hoconsc:ref(emqx_modules_schema, "rewrite")),#{}),
|
||||
responses => #{
|
||||
200 => hoconsc:mk(hoconsc:array(hoconsc:ref(emqx_modules_schema, "rewrite")),
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
-behaviour(minirest_api).
|
||||
|
||||
-include_lib("typerefl/include/types.hrl").
|
||||
-include("emqx_modules.hrl").
|
||||
|
||||
-import( hoconsc
|
||||
, [ mk/2
|
||||
|
@ -46,9 +47,6 @@
|
|||
-define(BAD_RPC, 'BAD_RPC').
|
||||
-define(BAD_REQUEST, 'BAD_REQUEST').
|
||||
|
||||
-define(API_TAG_MQTT, [<<"mqtt">>]).
|
||||
|
||||
|
||||
api_spec() ->
|
||||
emqx_dashboard_swagger:spec(?MODULE, #{check_schema => true}).
|
||||
|
||||
|
|
Loading…
Reference in New Issue