fix: improve generated openapi.json (#584)

* fix: /bots/{bot}

Paths "/bots/{bot}" and "/bots/{target}" must not be equivalent.

Signed-off-by: Damocles078 <hellodamocles078@gmail.com>

* fix: /channels/{group_id}/recipients/{member_id}

Paths "/channels/{group_id}/recipients/{member_id}" and "/channels/{target}/recipients/{member}" must not be equivalent.

Signed-off-by: Damocles078 <hellodamocles078@gmail.com>

* fix: /channels/{channel_id}/webhook

Paths "/channels/{target}/webhooks" and "/channels/{channel_id}/webhooks" must not be equivalent.

Signed-off-by: Damocles078 <hellodamocles078@gmail.com>

* fix: /servers/{server_id}/members/{member_id}

Paths "/servers/{target}/members/{member}" and "/servers/{server}/members/{member}" must not be equivalent.

Signed-off-by: Damocles078 <hellodamocles078@gmail.com>

* fix: /custom/emoji/{emoji_id}

Paths "/custom/emoji/{id}" and "/custom/emoji/{emoji_id}" must not be equivalent.

Signed-off-by: Damocles078 <hellodamocles078@gmail.com>

---------

Signed-off-by: Damocles078 <hellodamocles078@gmail.com>
Signed-off-by: Damocles <106018783+Damocles078@users.noreply.github.com>
This commit is contained in:
Damocles
2026-03-27 17:31:57 -07:00
committed by GitHub
parent c2d4369e16
commit 52ed5100c2
9 changed files with 43 additions and 43 deletions
@@ -15,11 +15,11 @@ use validator::Validate;
///
/// Creates a webhook which 3rd party platforms can use to send messages
#[openapi(tag = "Webhooks")]
#[post("/<target>/webhooks", data = "<data>")]
#[post("/<channel_id>/webhooks", data = "<data>")]
pub async fn create_webhook(
db: &State<Database>,
user: User,
target: Reference<'_>,
channel_id: Reference<'_>,
data: Json<v0::CreateWebhookBody>,
) -> Result<Json<v0::Webhook>> {
let data = data.into_inner();
@@ -29,7 +29,7 @@ pub async fn create_webhook(
})
})?;
let channel = target.as_channel(db).await?;
let channel = channel_id.as_channel(db).await?;
if !matches!(channel, Channel::TextChannel { .. } | Channel::Group { .. }) {
return Err(create_error!(InvalidOperation));