Merge pull request #8517 from zhongwencool/fix-bad-swagger-format
fix: fix bad swagger format
This commit is contained in:
commit
9c094a8611
|
@ -13,6 +13,7 @@
|
||||||
* Fix statistics related system topic name error
|
* Fix statistics related system topic name error
|
||||||
* Fix AuthN JWKS SSL schema. Using schema in `emqx_schema`. [#8458](https://github.com/emqx/emqx/pull/8458)
|
* Fix AuthN JWKS SSL schema. Using schema in `emqx_schema`. [#8458](https://github.com/emqx/emqx/pull/8458)
|
||||||
* `sentinel` field should be required when AuthN/AuthZ Redis using sentinel mode. [#8458](https://github.com/emqx/emqx/pull/8458)
|
* `sentinel` field should be required when AuthN/AuthZ Redis using sentinel mode. [#8458](https://github.com/emqx/emqx/pull/8458)
|
||||||
|
* Fix bad swagger format. [#8517](https://github.com/emqx/emqx/pull/8517)
|
||||||
|
|
||||||
## Enhancements
|
## Enhancements
|
||||||
|
|
||||||
|
|
|
@ -66,15 +66,7 @@ schema("/authentication/:id/import_users") ->
|
||||||
tags => ?API_TAGS_GLOBAL,
|
tags => ?API_TAGS_GLOBAL,
|
||||||
description => ?DESC(authentication_id_import_users_post),
|
description => ?DESC(authentication_id_import_users_post),
|
||||||
parameters => [emqx_authn_api:param_auth_id()],
|
parameters => [emqx_authn_api:param_auth_id()],
|
||||||
'requestBody' => #{
|
'requestBody' => emqx_dashboard_swagger:file_schema(filename),
|
||||||
content => #{
|
|
||||||
'multipart/form-data' => #{
|
|
||||||
schema => #{
|
|
||||||
filename => file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Users imported">>,
|
204 => <<"Users imported">>,
|
||||||
400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
|
400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
|
||||||
|
@ -89,15 +81,7 @@ schema("/listeners/:listener_id/authentication/:id/import_users") ->
|
||||||
tags => ?API_TAGS_SINGLE,
|
tags => ?API_TAGS_SINGLE,
|
||||||
description => ?DESC(listeners_listener_id_authentication_id_import_users_post),
|
description => ?DESC(listeners_listener_id_authentication_id_import_users_post),
|
||||||
parameters => [emqx_authn_api:param_listener_id(), emqx_authn_api:param_auth_id()],
|
parameters => [emqx_authn_api:param_listener_id(), emqx_authn_api:param_auth_id()],
|
||||||
'requestBody' => #{
|
'requestBody' => emqx_dashboard_swagger:file_schema(filename),
|
||||||
content => #{
|
|
||||||
'multipart/form-data' => #{
|
|
||||||
schema => #{
|
|
||||||
filename => file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Users imported">>,
|
204 => <<"Users imported">>,
|
||||||
400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
|
400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
|
||||||
|
|
|
@ -565,58 +565,64 @@ bin(Term) -> erlang:iolist_to_binary(io_lib:format("~p", [Term])).
|
||||||
|
|
||||||
status_metrics_example() ->
|
status_metrics_example() ->
|
||||||
#{
|
#{
|
||||||
resource_metrics => #{
|
'metrics_example' => #{
|
||||||
matched => 0,
|
summary => <<"Showing a typical metrics example">>,
|
||||||
success => 0,
|
value =>
|
||||||
failed => 0,
|
#{
|
||||||
rate => 0.0,
|
resource_metrics => #{
|
||||||
rate_last5m => 0.0,
|
matched => 0,
|
||||||
rate_max => 0.0
|
success => 0,
|
||||||
},
|
failed => 0,
|
||||||
node_resource_metrics => [
|
rate => 0.0,
|
||||||
#{
|
rate_last5m => 0.0,
|
||||||
node => node(),
|
rate_max => 0.0
|
||||||
metrics => #{
|
},
|
||||||
matched => 0,
|
node_resource_metrics => [
|
||||||
success => 0,
|
#{
|
||||||
failed => 0,
|
node => node(),
|
||||||
rate => 0.0,
|
metrics => #{
|
||||||
rate_last5m => 0.0,
|
matched => 0,
|
||||||
rate_max => 0.0
|
success => 0,
|
||||||
}
|
failed => 0,
|
||||||
}
|
rate => 0.0,
|
||||||
],
|
rate_last5m => 0.0,
|
||||||
metrics => #{
|
rate_max => 0.0
|
||||||
total => 0,
|
}
|
||||||
allow => 0,
|
}
|
||||||
deny => 0,
|
],
|
||||||
nomatch => 0,
|
metrics => #{
|
||||||
rate => 0.0,
|
total => 0,
|
||||||
rate_last5m => 0.0,
|
allow => 0,
|
||||||
rate_max => 0.0
|
deny => 0,
|
||||||
},
|
nomatch => 0,
|
||||||
node_metrics => [
|
rate => 0.0,
|
||||||
#{
|
rate_last5m => 0.0,
|
||||||
node => node(),
|
rate_max => 0.0
|
||||||
metrics => #{
|
},
|
||||||
total => 0,
|
node_metrics => [
|
||||||
allow => 0,
|
#{
|
||||||
deny => 0,
|
node => node(),
|
||||||
nomatch => 0,
|
metrics => #{
|
||||||
rate => 0.0,
|
total => 0,
|
||||||
rate_last5m => 0.0,
|
allow => 0,
|
||||||
rate_max => 0.0
|
deny => 0,
|
||||||
}
|
nomatch => 0,
|
||||||
}
|
rate => 0.0,
|
||||||
],
|
rate_last5m => 0.0,
|
||||||
|
rate_max => 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
status => connected,
|
status => connected,
|
||||||
node_status => [
|
node_status => [
|
||||||
#{
|
#{
|
||||||
node => node(),
|
node => node(),
|
||||||
status => connected
|
status => connected
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}.
|
}.
|
||||||
|
|
||||||
create_authz_file(Body) ->
|
create_authz_file(Body) ->
|
||||||
|
|
|
@ -180,7 +180,6 @@ field(username_in_path) ->
|
||||||
{username,
|
{username,
|
||||||
mk(binary(), #{
|
mk(binary(), #{
|
||||||
desc => ?DESC(username),
|
desc => ?DESC(username),
|
||||||
'maxLength' => 100,
|
|
||||||
example => <<"admin">>,
|
example => <<"admin">>,
|
||||||
in => path,
|
in => path,
|
||||||
required => true
|
required => true
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
-export([namespace/0, namespace/1, fields/1]).
|
-export([namespace/0, namespace/1, fields/1]).
|
||||||
-export([schema_with_example/2, schema_with_examples/2]).
|
-export([schema_with_example/2, schema_with_examples/2]).
|
||||||
-export([error_codes/1, error_codes/2]).
|
-export([error_codes/1, error_codes/2]).
|
||||||
|
-export([file_schema/1]).
|
||||||
|
|
||||||
-export([filter_check_request/2, filter_check_request_and_translate_body/2]).
|
-export([filter_check_request/2, filter_check_request_and_translate_body/2]).
|
||||||
|
|
||||||
|
@ -165,6 +166,20 @@ error_codes(Codes = [_ | _], MsgDesc) ->
|
||||||
})}
|
})}
|
||||||
].
|
].
|
||||||
|
|
||||||
|
file_schema(FileName) ->
|
||||||
|
#{
|
||||||
|
content => #{
|
||||||
|
'multipart/form-data' => #{
|
||||||
|
schema => #{
|
||||||
|
type => object,
|
||||||
|
properties => #{
|
||||||
|
FileName => #{type => string, format => binary}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% Private functions
|
%% Private functions
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{application, emqx_gateway, [
|
{application, emqx_gateway, [
|
||||||
{description, "The Gateway management application"},
|
{description, "The Gateway management application"},
|
||||||
{vsn, "0.1.1"},
|
{vsn, "0.1.2"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{mod, {emqx_gateway_app, []}},
|
{mod, {emqx_gateway_app, []}},
|
||||||
{applications, [kernel, stdlib, grpc, emqx, emqx_authn]},
|
{applications, [kernel, stdlib, grpc, emqx, emqx_authn]},
|
||||||
|
|
|
@ -124,15 +124,7 @@ schema("/gateway/:name/authentication/import_users") ->
|
||||||
#{
|
#{
|
||||||
desc => ?DESC(emqx_gateway_api_authn, import_users),
|
desc => ?DESC(emqx_gateway_api_authn, import_users),
|
||||||
parameters => params_gateway_name_in_path(),
|
parameters => params_gateway_name_in_path(),
|
||||||
'requestBody' => #{
|
'requestBody' => emqx_dashboard_swagger:file_schema(filename),
|
||||||
content => #{
|
|
||||||
'multipart/form-data' => #{
|
|
||||||
schema => #{
|
|
||||||
filename => file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
responses =>
|
responses =>
|
||||||
?STANDARD_RESP(#{204 => <<"Imported">>})
|
?STANDARD_RESP(#{204 => <<"Imported">>})
|
||||||
}
|
}
|
||||||
|
@ -145,15 +137,7 @@ schema("/gateway/:name/listeners/:id/authentication/import_users") ->
|
||||||
desc => ?DESC(emqx_gateway_api_listeners, import_users),
|
desc => ?DESC(emqx_gateway_api_listeners, import_users),
|
||||||
parameters => params_gateway_name_in_path() ++
|
parameters => params_gateway_name_in_path() ++
|
||||||
params_listener_id_in_path(),
|
params_listener_id_in_path(),
|
||||||
'requestBody' => #{
|
'requestBody' => emqx_dashboard_swagger:file_schema(filename),
|
||||||
content => #{
|
|
||||||
'multipart/form-data' => #{
|
|
||||||
schema => #{
|
|
||||||
filename => file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
responses =>
|
responses =>
|
||||||
?STANDARD_RESP(#{204 => <<"Imported">>})
|
?STANDARD_RESP(#{204 => <<"Imported">>})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue