chore(gw): fix bad argument type

This commit is contained in:
JianBo He 2021-12-08 11:13:00 +08:00
parent 0eff5358ca
commit a937a3d4dc
2 changed files with 25 additions and 25 deletions

View File

@ -201,7 +201,7 @@ schema("/gateway/:name/stats") ->
params_gateway_name_in_path() -> params_gateway_name_in_path() ->
[{name, [{name,
mk(string(), mk(binary(),
#{ in => path #{ in => path
, desc => <<"Gateway Name">> , desc => <<"Gateway Name">>
})} })}
@ -209,7 +209,7 @@ params_gateway_name_in_path() ->
params_gateway_status_in_qs() -> params_gateway_status_in_qs() ->
[{status, [{status,
mk(string(), mk(binary(),
#{ in => query #{ in => query
, nullable => true , nullable => true
, desc => <<"Gateway Status">> , desc => <<"Gateway Status">>
@ -226,20 +226,20 @@ roots() ->
fields(gateway_overview) -> fields(gateway_overview) ->
[ {name, [ {name,
mk(string(), mk(binary(),
#{ desc => <<"Gateway Name">>})} #{ desc => <<"Gateway Name">>})}
, {status, , {status,
mk(hoconsc:enum([running, stopped, unloaded]), mk(hoconsc:enum([running, stopped, unloaded]),
#{ desc => <<"The Gateway status">>})} #{ desc => <<"The Gateway status">>})}
, {created_at, , {created_at,
mk(string(), mk(binary(),
#{desc => <<"The Gateway created datetime">>})} #{desc => <<"The Gateway created datetime">>})}
, {started_at, , {started_at,
mk(string(), mk(binary(),
#{ nullable => true #{ nullable => true
, desc => <<"The Gateway started datetime">>})} , desc => <<"The Gateway started datetime">>})}
, {stopped_at, , {stopped_at,
mk(string(), mk(binary(),
#{ nullable => true #{ nullable => true
, desc => <<"The Gateway stopped datetime">>})} , desc => <<"The Gateway stopped datetime">>})}
, {max_connections, , {max_connections,
@ -256,7 +256,7 @@ fields(gateway_overview) ->
]; ];
fields(gateway_listener_overview) -> fields(gateway_listener_overview) ->
[ {id, [ {id,
mk(string(), mk(binary(),
#{ desc => <<"Listener ID">>})} #{ desc => <<"Listener ID">>})}
, {running, , {running,
mk(boolean(), mk(boolean(),
@ -277,14 +277,14 @@ fields(Listener) when Listener == tcp_listener;
Listener == udp_listener; Listener == udp_listener;
Listener == dtls_listener -> Listener == dtls_listener ->
[ {id, [ {id,
mk(string(), mk(binary(),
#{ nullable => true #{ nullable => true
, desc => <<"Listener ID">>})} , desc => <<"Listener ID">>})}
, {type, , {type,
mk(hoconsc:union([tcp, ssl, udp, dtls]), mk(hoconsc:union([tcp, ssl, udp, dtls]),
#{ desc => <<"Listener type">>})} #{ desc => <<"Listener type">>})}
, {name, , {name,
mk(string(), mk(binary(),
#{ desc => <<"Listener Name">>})} #{ desc => <<"Listener Name">>})}
, {running, , {running,
mk(boolean(), mk(boolean(),
@ -293,7 +293,7 @@ fields(Listener) when Listener == tcp_listener;
] ++ emqx_gateway_schema:fields(Listener); ] ++ emqx_gateway_schema:fields(Listener);
fields(gateway_stats) -> fields(gateway_stats) ->
[{key, mk(string(), #{})}]. [{key, mk(binary(), #{})}].
schema_gateways_conf() -> schema_gateways_conf() ->
%% XXX: We need convert the emqx_gateway_schema's listener map %% XXX: We need convert the emqx_gateway_schema's listener map

View File

@ -593,7 +593,7 @@ roots() ->
]. ].
fields(test) -> fields(test) ->
[{key, mk(string(), #{ desc => <<"Desc">>})}]; [{key, mk(binary(), #{ desc => <<"Desc">>})}];
fields(stomp_client) -> fields(stomp_client) ->
common_client_props(); common_client_props();
@ -603,7 +603,7 @@ fields(coap_client) ->
common_client_props(); common_client_props();
fields(lwm2m_client) -> fields(lwm2m_client) ->
[ {endpoint_name, [ {endpoint_name,
mk(string(), mk(binary(),
#{ desc => <<"The LwM2M client endpoint name">>})} #{ desc => <<"The LwM2M client endpoint name">>})}
, {lifetime, , {lifetime,
mk(integer(), mk(integer(),
@ -614,7 +614,7 @@ fields(exproto_client) ->
fields(subscription) -> fields(subscription) ->
[ {topic, [ {topic,
mk(string(), mk(binary(),
#{ desc => <<"Topic Fillter">>})} #{ desc => <<"Topic Fillter">>})}
, {qos, , {qos,
mk(integer(), mk(integer(),
@ -634,30 +634,30 @@ fields(subscription) ->
]; ];
fields(extra_sub_props) -> fields(extra_sub_props) ->
[ {subid, [ {subid,
mk(string(), mk(binary(),
#{ desc => <<"Only stomp protocol, an uniquely identity for " #{ desc => <<"Only stomp protocol, an uniquely identity for "
"the subscription. range: 1-65535.">>})} "the subscription. range: 1-65535.">>})}
]. ].
common_client_props() -> common_client_props() ->
[ {node, [ {node,
mk(string(), mk(binary(),
#{ desc => <<"Name of the node to which the client is " #{ desc => <<"Name of the node to which the client is "
"connected">>})} "connected">>})}
, {clientid, , {clientid,
mk(string(), mk(binary(),
#{ desc => <<"Client identifier">>})} #{ desc => <<"Client identifier">>})}
, {username, , {username,
mk(string(), mk(binary(),
#{ desc => <<"Username of client when connecting">>})} #{ desc => <<"Username of client when connecting">>})}
, {proto_name, , {proto_name,
mk(string(), mk(binary(),
#{ desc => <<"Client protocol name">>})} #{ desc => <<"Client protocol name">>})}
, {proto_ver, , {proto_ver,
mk(string(), mk(binary(),
#{ desc => <<"Protocol version used by the client">>})} #{ desc => <<"Protocol version used by the client">>})}
, {ip_address, , {ip_address,
mk(string(), mk(binary(),
#{ desc => <<"Client's IP address">>})} #{ desc => <<"Client's IP address">>})}
, {port, , {port,
mk(integer(), mk(integer(),
@ -667,10 +667,10 @@ common_client_props() ->
#{ desc => <<"Indicates whether the client is connected via " #{ desc => <<"Indicates whether the client is connected via "
"bridge">>})} "bridge">>})}
, {connected_at, , {connected_at,
mk(string(), mk(binary(),
#{ desc => <<"Client connection time">>})} #{ desc => <<"Client connection time">>})}
, {disconnected_at, , {disconnected_at,
mk(string(), mk(binary(),
#{ desc => <<"Client offline time, This field is only valid and " #{ desc => <<"Client offline time, This field is only valid and "
"returned when connected is false">>})} "returned when connected is false">>})}
, {connected, , {connected,
@ -681,10 +681,10 @@ common_client_props() ->
%% want it %% want it
%% %%
%, {will_msg, %, {will_msg,
% mk(string(), % mk(binary(),
% #{ desc => <<"Client will message">>})} % #{ desc => <<"Client will message">>})}
%, {zone, %, {zone,
% mk(string(), % mk(binary(),
% #{ desc => <<"Indicate the configuration group used by the " % #{ desc => <<"Indicate the configuration group used by the "
% "client">>})} % "client">>})}
, {keepalive, , {keepalive,
@ -699,7 +699,7 @@ common_client_props() ->
#{ desc => <<"Session expiration interval, with the unit of " #{ desc => <<"Session expiration interval, with the unit of "
"second">>})} "second">>})}
, {created_at, , {created_at,
mk(string(), mk(binary(),
#{ desc => <<"Session creation time">>})} #{ desc => <<"Session creation time">>})}
, {subscriptions_cnt, , {subscriptions_cnt,
mk(integer(), mk(integer(),