fix(elvis): elvis warning

This commit is contained in:
zhongwencool 2021-12-09 15:46:40 +08:00
parent cf11f3f8ee
commit 0614c157ec
5 changed files with 25 additions and 22 deletions

View File

@ -126,7 +126,8 @@ EMQ X can be configured with:
<br> <br>
<ul> <ul>
<li><code>[]</code>: The default value, it allows *ALL* logins</li> <li><code>[]</code>: The default value, it allows *ALL* logins</li>
<li>one: For example <code>{enable:true,backend:\"built-in-database\",mechanism=\"password-based\"}</code></li> <li>one: For example <code>{enable:true,backend:\"built-in-database\",mechanism=\"password-based\"}
</code></li>
<li>chain: An array of structs.</li> <li>chain: An array of structs.</li>
</ul> </ul>
<br> <br>
@ -1479,7 +1480,8 @@ authentication(Desc) ->
%% the type checks are done in emqx_auth application when it boots. %% the type checks are done in emqx_auth application when it boots.
%% and in emqx_authentication_config module for rutime changes. %% and in emqx_authentication_config module for rutime changes.
Default = hoconsc:lazy(hoconsc:union([typerefl:map(), hoconsc:array(typerefl:map())])), 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. %% is for now only affecting document generation.
%% maybe in the future, we can find a more straightforward way to support %% maybe in the future, we can find a more straightforward way to support
%% * document generation (at compile time) %% * document generation (at compile time)

View File

@ -45,8 +45,8 @@ start_listeners() ->
components => #{ components => #{
schemas => #{}, schemas => #{},
'securitySchemes' => #{ 'securitySchemes' => #{
basicAuth => #{type => http, scheme => basic}, 'basicAuth' => #{type => http, scheme => basic},
bearerAuth => #{type => http, scheme => bearer} 'bearerAuth' => #{type => http, scheme => bearer}
}}}, }}},
Dispatch = Dispatch =
case os:getenv("_EMQX_ENABLE_DASHBOARD") of case os:getenv("_EMQX_ENABLE_DASHBOARD") of
@ -62,7 +62,7 @@ start_listeners() ->
base_path => ?BASE_PATH, base_path => ?BASE_PATH,
modules => minirest_api:find_api_modules(apps()), modules => minirest_api:find_api_modules(apps()),
authorization => Authorization, authorization => Authorization,
security => [#{basicAuth => []}, #{bearerAuth => []}], security => [#{'basicAuth' => []}, #{'bearerAuth' => []}],
swagger_global_spec => GlobalSpec, swagger_global_spec => GlobalSpec,
dispatch => Dispatch, dispatch => Dispatch,
middlewares => [cowboy_router, ?EMQX_MIDDLE, cowboy_handler] middlewares => [cowboy_router, ?EMQX_MIDDLE, cowboy_handler]

View File

@ -123,7 +123,8 @@ schema("/users/:username") ->
#{in => path, example => <<"admin">>})}], #{in => path, example => <<"admin">>})}],
'requestBody' => [ 'requestBody' => [
{ description { description
, mk(emqx_schema:unicode_binary(), #{desc => <<"User description">>, example => <<"administrator">>})} , mk(emqx_schema:unicode_binary(),
#{desc => <<"User description">>, example => <<"administrator">>})}
], ],
responses => #{ responses => #{
200 => mk( ref(?MODULE, user) 200 => mk( ref(?MODULE, user)