Merge pull request #5382 from DDDHuang/publish_api_fix

fix: publish api params
This commit is contained in:
DDDHuang 2021-08-04 14:39:05 +08:00 committed by GitHub
commit ac2084daeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 16 deletions

View File

@ -26,36 +26,32 @@
api_spec() -> api_spec() ->
{ {
[publish_api(), publish_batch_api()], [publish_api(), publish_bulk_api()],
[message_schema()] [message_schema()]
}. }.
publish_api() -> publish_api() ->
Schema = #{
type => object,
properties => maps:without([id], message_properties())
},
MeteData = #{ MeteData = #{
post => #{ post => #{
description => <<"Publish">>, description => <<"Publish">>,
'requestBody' => #{ 'requestBody' => emqx_mgmt_util:request_body_schema(Schema),
content => #{
'application/json' => #{
schema => #{
type => object,
properties => maps:with([id], message_properties())}}}},
responses => #{ responses => #{
<<"200">> => emqx_mgmt_util:response_schema(<<"publish ok">>, message)}}}, <<"200">> => emqx_mgmt_util:response_schema(<<"publish ok">>, message)}}},
{"/publish", MeteData, publish}. {"/publish", MeteData, publish}.
publish_batch_api() -> publish_bulk_api() ->
Schema = #{
type => object,
properties => maps:without([id], message_properties())
},
MeteData = #{ MeteData = #{
post => #{ post => #{
description => <<"publish">>, description => <<"publish">>,
'requestBody' => #{ 'requestBody' => emqx_mgmt_util:request_body_array_schema(Schema),
content => #{
'application/json' => #{
schema => #{
type => array,
items => #{
type => object,
properties => maps:with([id], message_properties())}}}}},
responses => #{ responses => #{
<<"200">> => emqx_mgmt_util:response_array_schema(<<"publish ok">>, message)}}}, <<"200">> => emqx_mgmt_util:response_array_schema(<<"publish ok">>, message)}}},
{"/publish/bulk", MeteData, publish_batch}. {"/publish/bulk", MeteData, publish_batch}.