Validation error in SubcommandIncomingDiscordOptionList
Opened this issue · 0 comments
NotOats commented
I think the options field in SubcommandIncomingDiscordOptionList needs be tagged as Optional.
I am unsure if this will break any existing features. The only reference to that class I could find was in determine_event_information which currently supports the field being optional.
Below is the validation error, command schema, and discord request.
Validation error
File "/.venv/lib/python3.8/site-packages/dispike/server.py", line 146, in handle_interactions
_parse_to_object = IncomingDiscordSlashInteraction(**_get_request_body)
│ └ {'application_id': '<cleaned>', 'channel_id': '<cleaned>', 'data': {'id': '<cleaned>', 'name': 'op...
└ <class 'dispike.incoming.incoming_interactions.IncomingDiscordSlashInteraction'>
File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 2 validation errors for IncomingDiscordSlashInteraction
data -> options -> 0 -> value
field required (type=value_error.missing)
data -> options -> 0 -> options
field required (type=value_error.missing)
Command schema
DiscordCommand(
name="options",
description=(
"Various options for the server owner to play with. "
"These apply to **your** server only."
),
options=[
CommandOption(
name="authenticated_role",
description="The role to give to authenticated users.",
type=OptionTypes.SUB_COMMAND,
options=[
CommandOption(
name="set",
description="Value to change this option to.",
type=OptionTypes.STRING,
required=False,
)
],
)
],
),
Discord command and request
/options authenticated_role
'data': {
'id': '',
'name': 'options',
'options': [{
'name': 'authenticated_role',
'type': 1
}
],
'type': 1
}