Merge pull request #5382 from DDDHuang/publish_api_fix
fix: publish api params
This commit is contained in:
commit
ac2084daeb
|
@ -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}.
|
||||||
|
|
Loading…
Reference in New Issue