diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl
index 54740db61..21b2dd255 100644
--- a/apps/emqx/src/emqx_schema.erl
+++ b/apps/emqx/src/emqx_schema.erl
@@ -126,7 +126,8 @@ EMQ X can be configured with:
[]
: The default value, it allows *ALL* logins
-- one: For example
{enable:true,backend:\"built-in-database\",mechanism=\"password-based\"}
+- one: For example
{enable:true,backend:\"built-in-database\",mechanism=\"password-based\"}
+
- chain: An array of structs.
@@ -1479,7 +1480,8 @@ authentication(Desc) ->
%% the type checks are done in emqx_auth application when it boots.
%% and in emqx_authentication_config module for rutime changes.
Default = hoconsc:lazy(hoconsc:union([typerefl:map(), hoconsc:array(typerefl:map())])),
- %% as the type is lazy, the runtime module injection from EMQX_AUTHENTICATION_SCHEMA_MODULE_PT_KEY
+ %% as the type is lazy, the runtime module injection
+ %% from EMQX_AUTHENTICATION_SCHEMA_MODULE_PT_KEY
%% is for now only affecting document generation.
%% maybe in the future, we can find a more straightforward way to support
%% * document generation (at compile time)
diff --git a/apps/emqx_dashboard/src/emqx_dashboard.erl b/apps/emqx_dashboard/src/emqx_dashboard.erl
index b01695f13..953e3e52b 100644
--- a/apps/emqx_dashboard/src/emqx_dashboard.erl
+++ b/apps/emqx_dashboard/src/emqx_dashboard.erl
@@ -45,8 +45,8 @@ start_listeners() ->
components => #{
schemas => #{},
'securitySchemes' => #{
- basicAuth => #{type => http, scheme => basic},
- bearerAuth => #{type => http, scheme => bearer}
+ 'basicAuth' => #{type => http, scheme => basic},
+ 'bearerAuth' => #{type => http, scheme => bearer}
}}},
Dispatch =
case os:getenv("_EMQX_ENABLE_DASHBOARD") of
@@ -62,7 +62,7 @@ start_listeners() ->
base_path => ?BASE_PATH,
modules => minirest_api:find_api_modules(apps()),
authorization => Authorization,
- security => [#{basicAuth => []}, #{bearerAuth => []}],
+ security => [#{'basicAuth' => []}, #{'bearerAuth' => []}],
swagger_global_spec => GlobalSpec,
dispatch => Dispatch,
middlewares => [cowboy_router, ?EMQX_MIDDLE, cowboy_handler]
diff --git a/apps/emqx_dashboard/src/emqx_dashboard_admin.erl b/apps/emqx_dashboard/src/emqx_dashboard_admin.erl
index 5a14d53e7..b3b97ad28 100644
--- a/apps/emqx_dashboard/src/emqx_dashboard_admin.erl
+++ b/apps/emqx_dashboard/src/emqx_dashboard_admin.erl
@@ -115,11 +115,11 @@ hash(Password) ->
verify_hash(Origin, SaltHash) ->
case SaltHash of
- <> ->
- case Hash =:= sha256(Salt, Origin) of
- true -> ok;
- false -> error
- end;
+ <> ->
+ case Hash =:= sha256(Salt, Origin) of
+ true -> ok;
+ false -> error
+ end;
_ -> error
end.
diff --git a/apps/emqx_dashboard/src/emqx_dashboard_api.erl b/apps/emqx_dashboard/src/emqx_dashboard_api.erl
index 5e233f165..45a3b7c56 100644
--- a/apps/emqx_dashboard/src/emqx_dashboard_api.erl
+++ b/apps/emqx_dashboard/src/emqx_dashboard_api.erl
@@ -123,7 +123,8 @@ schema("/users/:username") ->
#{in => path, example => <<"admin">>})}],
'requestBody' => [
{ description
- , mk(emqx_schema:unicode_binary(), #{desc => <<"User description">>, example => <<"administrator">>})}
+ , mk(emqx_schema:unicode_binary(),
+ #{desc => <<"User description">>, example => <<"administrator">>})}
],
responses => #{
200 => mk( ref(?MODULE, user)
diff --git a/apps/emqx_management/src/emqx_mgmt_api_app.erl b/apps/emqx_management/src/emqx_mgmt_api_app.erl
index 47999b78d..fdf48b8c6 100644
--- a/apps/emqx_management/src/emqx_mgmt_api_app.erl
+++ b/apps/emqx_management/src/emqx_mgmt_api_app.erl
@@ -95,7 +95,7 @@ fields(app) ->
#{desc => "No longer valid datetime",
example => <<"2021-12-05T02:01:34.186Z">>,
nullable => true
- })},
+ })},
{created_at, hoconsc:mk(emqx_schema:rfc3339_system_time(),
#{desc => "ApiKey create datetime",
example => <<"2021-12-01T00:00:00.000Z">>
@@ -105,20 +105,20 @@ fields(app) ->
{enable, hoconsc:mk(boolean(), #{desc => "Enable/Disable", nullable => true})}
];
fields(name) ->
- [{name, hoconsc:mk(binary(),
- #{
- desc => <<"[a-zA-Z0-9-_]">>,
- example => <<"EMQX-API-KEY-1">>,
- in => path,
- validator => fun ?MODULE:validate_name/1
- })}
- ].
+ [{name, hoconsc:mk(binary(),
+ #{
+ desc => <<"[a-zA-Z0-9-_]">>,
+ example => <<"EMQX-API-KEY-1">>,
+ in => path,
+ validator => fun ?MODULE:validate_name/1
+ })}
+ ].
-define(NAME_RE, "^[A-Za-z]+[A-Za-z0-9-_]*$").
validate_name(Name) ->
NameLen = byte_size(Name),
- case NameLen > 0 andalso NameLen =< 256 of
+ case NameLen > 0 andalso NameLen =< 256 of
true ->
case re:run(Name, ?NAME_RE) of
nomatch -> {error, "Name should be " ?NAME_RE};
@@ -131,7 +131,7 @@ delete(Keys, Fields) ->
lists:foldl(fun(Key, Acc) -> lists:keydelete(Key, 1, Acc) end, Fields, Keys).
api_key(get, _) ->
- {200, [format(App) ||App <- emqx_mgmt_auth:list()]};
+ {200, [format(App) || App <- emqx_mgmt_auth:list()]};
api_key(post, #{body := App}) ->
#{
<<"name">> := Name,