fix: HTTP API /api/v5/publish schema
The schema for the /api/v5/publish HTTP API endpoint was incorrect. For 400 (Bad Request) error it cannot return a list but the incorrect schema declared that the response could include a list. Fixes: https://emqx.atlassian.net/browse/EMQX-10837 https://github.com/emqx/emqx/issues/11488
This commit is contained in:
parent
999988cab4
commit
3ffbb7decf
|
@ -57,7 +57,7 @@ schema("/publish") ->
|
||||||
responses => #{
|
responses => #{
|
||||||
?ALL_IS_WELL => hoconsc:mk(hoconsc:ref(?MODULE, publish_ok)),
|
?ALL_IS_WELL => hoconsc:mk(hoconsc:ref(?MODULE, publish_ok)),
|
||||||
?PARTIALLY_OK => hoconsc:mk(hoconsc:ref(?MODULE, publish_error)),
|
?PARTIALLY_OK => hoconsc:mk(hoconsc:ref(?MODULE, publish_error)),
|
||||||
?BAD_REQUEST => bad_request_schema(),
|
?BAD_REQUEST => hoconsc:mk(hoconsc:ref(?MODULE, bad_request)),
|
||||||
?DISPATCH_ERROR => hoconsc:mk(hoconsc:ref(?MODULE, publish_error))
|
?DISPATCH_ERROR => hoconsc:mk(hoconsc:ref(?MODULE, publish_error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,11 +196,13 @@ fields(bad_request) ->
|
||||||
[
|
[
|
||||||
{code,
|
{code,
|
||||||
hoconsc:mk(string(), #{
|
hoconsc:mk(string(), #{
|
||||||
desc => <<"BAD_REQUEST">>
|
desc => <<"BAD_REQUEST">>,
|
||||||
|
example => ?RC_TOPIC_NAME_INVALID
|
||||||
})},
|
})},
|
||||||
{message,
|
{message,
|
||||||
hoconsc:mk(binary(), #{
|
hoconsc:mk(binary(), #{
|
||||||
desc => ?DESC(error_message)
|
desc => ?DESC(error_message),
|
||||||
|
example => to_binary(emqx_reason_codes:name(?RC_TOPIC_NAME_INVALID))
|
||||||
})}
|
})}
|
||||||
].
|
].
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue