From a937a3d4dcb3dd17cb83ae03a74282db7874aae3 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Wed, 8 Dec 2021 11:13:00 +0800 Subject: [PATCH] chore(gw): fix bad argument type --- apps/emqx_gateway/src/emqx_gateway_api.erl | 20 ++++++------- .../src/emqx_gateway_api_clients.erl | 30 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/emqx_gateway/src/emqx_gateway_api.erl b/apps/emqx_gateway/src/emqx_gateway_api.erl index 7c961223d..34165d492 100644 --- a/apps/emqx_gateway/src/emqx_gateway_api.erl +++ b/apps/emqx_gateway/src/emqx_gateway_api.erl @@ -201,7 +201,7 @@ schema("/gateway/:name/stats") -> params_gateway_name_in_path() -> [{name, - mk(string(), + mk(binary(), #{ in => path , desc => <<"Gateway Name">> })} @@ -209,7 +209,7 @@ params_gateway_name_in_path() -> params_gateway_status_in_qs() -> [{status, - mk(string(), + mk(binary(), #{ in => query , nullable => true , desc => <<"Gateway Status">> @@ -226,20 +226,20 @@ roots() -> fields(gateway_overview) -> [ {name, - mk(string(), + mk(binary(), #{ desc => <<"Gateway Name">>})} , {status, mk(hoconsc:enum([running, stopped, unloaded]), #{ desc => <<"The Gateway status">>})} , {created_at, - mk(string(), + mk(binary(), #{desc => <<"The Gateway created datetime">>})} , {started_at, - mk(string(), + mk(binary(), #{ nullable => true , desc => <<"The Gateway started datetime">>})} , {stopped_at, - mk(string(), + mk(binary(), #{ nullable => true , desc => <<"The Gateway stopped datetime">>})} , {max_connections, @@ -256,7 +256,7 @@ fields(gateway_overview) -> ]; fields(gateway_listener_overview) -> [ {id, - mk(string(), + mk(binary(), #{ desc => <<"Listener ID">>})} , {running, mk(boolean(), @@ -277,14 +277,14 @@ fields(Listener) when Listener == tcp_listener; Listener == udp_listener; Listener == dtls_listener -> [ {id, - mk(string(), + mk(binary(), #{ nullable => true , desc => <<"Listener ID">>})} , {type, mk(hoconsc:union([tcp, ssl, udp, dtls]), #{ desc => <<"Listener type">>})} , {name, - mk(string(), + mk(binary(), #{ desc => <<"Listener Name">>})} , {running, mk(boolean(), @@ -293,7 +293,7 @@ fields(Listener) when Listener == tcp_listener; ] ++ emqx_gateway_schema:fields(Listener); fields(gateway_stats) -> - [{key, mk(string(), #{})}]. + [{key, mk(binary(), #{})}]. schema_gateways_conf() -> %% XXX: We need convert the emqx_gateway_schema's listener map diff --git a/apps/emqx_gateway/src/emqx_gateway_api_clients.erl b/apps/emqx_gateway/src/emqx_gateway_api_clients.erl index 7d6feacf8..b67961e12 100644 --- a/apps/emqx_gateway/src/emqx_gateway_api_clients.erl +++ b/apps/emqx_gateway/src/emqx_gateway_api_clients.erl @@ -593,7 +593,7 @@ roots() -> ]. fields(test) -> - [{key, mk(string(), #{ desc => <<"Desc">>})}]; + [{key, mk(binary(), #{ desc => <<"Desc">>})}]; fields(stomp_client) -> common_client_props(); @@ -603,7 +603,7 @@ fields(coap_client) -> common_client_props(); fields(lwm2m_client) -> [ {endpoint_name, - mk(string(), + mk(binary(), #{ desc => <<"The LwM2M client endpoint name">>})} , {lifetime, mk(integer(), @@ -614,7 +614,7 @@ fields(exproto_client) -> fields(subscription) -> [ {topic, - mk(string(), + mk(binary(), #{ desc => <<"Topic Fillter">>})} , {qos, mk(integer(), @@ -634,30 +634,30 @@ fields(subscription) -> ]; fields(extra_sub_props) -> [ {subid, - mk(string(), + mk(binary(), #{ desc => <<"Only stomp protocol, an uniquely identity for " "the subscription. range: 1-65535.">>})} ]. common_client_props() -> [ {node, - mk(string(), + mk(binary(), #{ desc => <<"Name of the node to which the client is " "connected">>})} , {clientid, - mk(string(), + mk(binary(), #{ desc => <<"Client identifier">>})} , {username, - mk(string(), + mk(binary(), #{ desc => <<"Username of client when connecting">>})} , {proto_name, - mk(string(), + mk(binary(), #{ desc => <<"Client protocol name">>})} , {proto_ver, - mk(string(), + mk(binary(), #{ desc => <<"Protocol version used by the client">>})} , {ip_address, - mk(string(), + mk(binary(), #{ desc => <<"Client's IP address">>})} , {port, mk(integer(), @@ -667,10 +667,10 @@ common_client_props() -> #{ desc => <<"Indicates whether the client is connected via " "bridge">>})} , {connected_at, - mk(string(), + mk(binary(), #{ desc => <<"Client connection time">>})} , {disconnected_at, - mk(string(), + mk(binary(), #{ desc => <<"Client offline time, This field is only valid and " "returned when connected is false">>})} , {connected, @@ -681,10 +681,10 @@ common_client_props() -> %% want it %% %, {will_msg, - % mk(string(), + % mk(binary(), % #{ desc => <<"Client will message">>})} %, {zone, - % mk(string(), + % mk(binary(), % #{ desc => <<"Indicate the configuration group used by the " % "client">>})} , {keepalive, @@ -699,7 +699,7 @@ common_client_props() -> #{ desc => <<"Session expiration interval, with the unit of " "second">>})} , {created_at, - mk(string(), + mk(binary(), #{ desc => <<"Session creation time">>})} , {subscriptions_cnt, mk(integer(),