discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

API returns wrong error when AutoMod trigger_metadata is not sent

Open advaith1 opened this issue 1 year ago • 0 comments

Description

When the trigger_metadata field is not sent, but the trigger type requires it, the API returns an error saying a field named metadata is required, but it actually requires a trigger_metadata field. If a metadata field is sent, it is ignored and the error is still returned.

Steps to Reproduce

POST https://discord.com/api/v10/guilds/:id/auto-moderation/rules

{
    "name": "test",
    "event_type": 1,
    "trigger_type": 1,
    "actions": [
        {
            "type": 1
        }
    ]
}

Expected Behavior

An error about trigger_metadata being missing

Current Behavior

{
    "code": 50035,
    "errors": {
        "metadata": {
            "_errors": [
                {
                    "code": "BASE_TYPE_REQUIRED",
                    "message": "This field is required"
                }
            ]
        }
    },
    "message": "Invalid Form Body"
}

Screenshots/Videos

No response

Client and System Information

Postman on Windows 11

advaith1 avatar Jul 19 '22 22:07 advaith1

looks like this has been fixed

advaith1 avatar Sep 19 '22 23:09 advaith1

looks like this has been fixed

Wow you noticed it less than an hour after it got deployed. Thanks for reporting this, and sorry it took us this long to address this.

hemu avatar Sep 20 '22 02:09 hemu