From 49b95b0aa8617509c2bdf360f8b8c1d1f8fed75e Mon Sep 17 00:00:00 2001 From: Zhongwen Deng Date: Wed, 17 Aug 2022 23:32:19 +0800 Subject: [PATCH] chore: improve swagger tags --- apps/emqx_gateway/src/coap/emqx_coap_api.erl | 2 +- apps/emqx_gateway/src/lwm2m/emqx_lwm2m_api.erl | 8 ++++---- .../src/emqx_mgmt_api_configs.erl | 17 +++++++++-------- apps/emqx_modules/include/emqx_modules.hrl | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/apps/emqx_gateway/src/coap/emqx_coap_api.erl b/apps/emqx_gateway/src/coap/emqx_coap_api.erl index f42bdcf9f..9d20ac6dc 100644 --- a/apps/emqx_gateway/src/coap/emqx_coap_api.erl +++ b/apps/emqx_gateway/src/coap/emqx_coap_api.erl @@ -48,7 +48,7 @@ schema(?PREFIX ++ "/request") -> #{ operationId => request, post => #{ - tags => [<<"CoAP gateway">>], + tags => [<<"CoAP">>], desc => ?DESC(send_coap_request), parameters => request_parameters(), requestBody => request_body(), diff --git a/apps/emqx_gateway/src/lwm2m/emqx_lwm2m_api.erl b/apps/emqx_gateway/src/lwm2m/emqx_lwm2m_api.erl index 1cd7d48a4..d8cb6b0a4 100644 --- a/apps/emqx_gateway/src/lwm2m/emqx_lwm2m_api.erl +++ b/apps/emqx_gateway/src/lwm2m/emqx_lwm2m_api.erl @@ -43,7 +43,7 @@ schema(?PATH("/lookup")) -> #{ 'operationId' => lookup, get => #{ - tags => [<<"lwm2m">>], + tags => [<<"LwM2M">>], desc => ?DESC(lookup_resource), parameters => [ {clientid, mk(binary(), #{in => path, example => "urn:oma:lwm2m:oma:2"})}, @@ -67,7 +67,7 @@ schema(?PATH("/observe")) -> #{ 'operationId' => observe, post => #{ - tags => [<<"lwm2m">>], + tags => [<<"LwM2M">>], desc => ?DESC(observe_resource), parameters => [ {clientid, mk(binary(), #{in => path, example => "urn:oma:lwm2m:oma:2"})}, @@ -85,7 +85,7 @@ schema(?PATH("/read")) -> #{ 'operationId' => read, post => #{ - tags => [<<"lwm2m">>], + tags => [<<"LwM2M">>], desc => ?DESC(read_resource), parameters => [ {clientid, mk(binary(), #{in => path, example => "urn:oma:lwm2m:oma:2"})}, @@ -102,7 +102,7 @@ schema(?PATH("/write")) -> 'operationId' => write, post => #{ desc => ?DESC(write_resource), - tags => [<<"lwm2m">>], + tags => [<<"LwM2M">>], parameters => [ {clientid, mk(binary(), #{in => path, example => "urn:oma:lwm2m:oma:2"})}, {path, mk(binary(), #{in => query, required => true, example => "/3/0/7"})}, diff --git a/apps/emqx_management/src/emqx_mgmt_api_configs.erl b/apps/emqx_management/src/emqx_mgmt_api_configs.erl index ab18ec488..7435e5e0d 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_configs.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_configs.erl @@ -37,6 +37,7 @@ -define(PREFIX_RESET, "/configs_reset/"). -define(ERR_MSG(MSG), list_to_binary(io_lib:format("~p", [MSG]))). -define(OPTS, #{rawconf_with_defaults => true, override_to => cluster}). +-define(TAGS, ["Configs"]). -define(EXCLUDES, [ @@ -85,7 +86,7 @@ schema("/configs") -> #{ 'operationId' => configs, get => #{ - tags => [conf], + tags => ?TAGS, description => <<"Get all the configurations of the specified node, including hot and non-hot updatable items.">>, parameters => [ @@ -111,7 +112,7 @@ schema("/configs_reset/:rootname") -> #{ 'operationId' => config_reset, post => #{ - tags => [conf], + tags => ?TAGS, description => << "Reset the config entry specified by the query string parameter `conf_path`.
\n" @@ -149,12 +150,12 @@ schema("/configs/global_zone") -> #{ 'operationId' => global_zone_configs, get => #{ - tags => [conf], + tags => ?TAGS, description => <<"Get the global zone configs">>, responses => #{200 => Schema} }, put => #{ - tags => [conf], + tags => ?TAGS, description => <<"Update globbal zone configs">>, 'requestBody' => Schema, responses => #{ @@ -180,7 +181,7 @@ schema("/configs/global_zone") -> %% #{ %% 'operationId' => config, %% get => #{ -%% tags => [conf], +%% tags => ?TAGS, %% description => <<"Get config of this limiter">>, %% parameters => Parameters, %% responses => #{ @@ -189,7 +190,7 @@ schema("/configs/global_zone") -> %% } %% }, %% put => #{ -%% tags => [conf], +%% tags => ?TAGS, %% description => <<"Update config of this limiter">>, %% parameters => Parameters, %% 'requestBody' => Schema, @@ -204,7 +205,7 @@ schema(Path) -> #{ 'operationId' => config, get => #{ - tags => [conf], + tags => ?TAGS, description => iolist_to_binary([ <<"Get the sub-configurations under *">>, RootKey, @@ -216,7 +217,7 @@ schema(Path) -> } }, put => #{ - tags => [conf], + tags => ?TAGS, description => iolist_to_binary([ <<"Update the sub-configurations under *">>, RootKey, diff --git a/apps/emqx_modules/include/emqx_modules.hrl b/apps/emqx_modules/include/emqx_modules.hrl index 244b4c0cf..0e27bd56e 100644 --- a/apps/emqx_modules/include/emqx_modules.hrl +++ b/apps/emqx_modules/include/emqx_modules.hrl @@ -20,5 +20,5 @@ %% Interval for reporting telemetry data, Default: 7d -define(REPORT_INTERVAL, 604800). --define(API_TAG_MQTT, [<<"mqtt">>]). +-define(API_TAG_MQTT, [<<"MQTT">>]). -define(API_SCHEMA_MODULE, emqx_modules_schema).