Skip to content

Incorrect error response when setting too many rules in membership screening #2519

@advaith1

Description

@advaith1

Description

When setting over 16 (the limit) rules in membership screening, the error response is formatted wrong.

Steps to Reproduce
PATCH https://discord.com/api/v8/guilds/:id/member-verification with

{
    "form_fields": "[{\"field_type\":\"TERMS\",\"label\":\"hello world\",\"values\":[\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\",\"test\"],\"required\":true}]"
}

Expected Behavior

an error response like this:

{
    "code": 50035,
    "errors": {
        "form_fields": {
            "values": {
                "_errors": [
                    {
                        "code": "BASE_TYPE_MAX_LENGTH",
                        "message": "Must be 16 or fewer in length."
                    }
                ]
            }
        }
    },
    "message": "Invalid Form Body"
}

Current Behavior

this error response, with two _errors arrays:

{
    "code": 50035,
    "errors": {
        "form_fields": {
            "values": {
                "_errors": [
                    {
                        "_errors": [
                            {
                                "code": "BASE_TYPE_MAX_LENGTH",
                                "message": "Must be 16 or fewer in length."
                            }
                        ]
                    }
                ]
            }
        }
    },
    "message": "Invalid Form Body"
}

Screenshots/Videos

image

Client and System Information

Tested in Postman, first noticed by discord.js not properly handling the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions