Merge pull request #11493 from kjellwinblad/kjell/fix/11488

fix: HTTP API /api/v5/publish schema
This commit is contained in:
Kjell Winblad 2023-08-24 17:46:29 +02:00 committed by GitHub
commit aad9b1c27d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -57,7 +57,7 @@ schema("/publish") ->
responses => #{
?ALL_IS_WELL => hoconsc:mk(hoconsc:ref(?MODULE, publish_ok)),
?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))
}
}
@ -196,11 +196,13 @@ fields(bad_request) ->
[
{code,
hoconsc:mk(string(), #{
desc => <<"BAD_REQUEST">>
desc => <<"BAD_REQUEST">>,
example => ?RC_TOPIC_NAME_INVALID
})},
{message,
hoconsc:mk(binary(), #{
desc => ?DESC(error_message)
desc => ?DESC(error_message),
example => to_binary(emqx_reason_codes:name(?RC_TOPIC_NAME_INVALID))
})}
].

View File

@ -0,0 +1 @@
Examples and documentation for /api/v5/publish bad request response have been fixed. Previously the documentation example said that the bad request response could return a list in the body which was not actually the case.