Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation error in SubcommandIncomingDiscordOptionList #70

Open
NotOats opened this issue Oct 10, 2021 · 0 comments
Open

Validation error in SubcommandIncomingDiscordOptionList #70

NotOats opened this issue Oct 10, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@NotOats
Copy link

NotOats commented Oct 10, 2021

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
}

@ms7m ms7m added the bug Something isn't working label Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants