Skip to content

Empty users list in UsergroupsUsersUpdateRequest returns invalid_arguments #1573

@rozza-sb

Description

@rozza-sb

The SDK converts the users list into a comma delimited list of user ID strings to confirm with the form request it is making. However, for an empty List this is captured as an empty string, which is not valid for form requests. Ideally I would like to be able to set a usergroup to have 0 members via an empty List in the request object.

From testing with curl, it seems that for an empty list a value of [] can be provided into the url encoded form data to represent no users in a usergroup. This could be used instead of an empty value when an empty Java list is provided into the users parameter of a UsergroupUsersUpdateRequest object (either directly or via a request builder).

Reproducible in:

The Slack SDK version

+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0
|    +--- com.slack.api:slack-api-model:1.48.0
+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0 (c)
+--- com.slack.api:slack-api-model:{strictly 1.48.0} -> 1.48.0 (c)
+--- com.slack.api:slack-api-client:1.48.0 (n)
+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0
|    +--- com.slack.api:slack-api-model:1.48.0
|    +--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0 (*)
+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0 (c)
+--- com.slack.api:slack-api-model:{strictly 1.48.0} -> 1.48.0 (c)
+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0
|    +--- com.slack.api:slack-api-model:1.48.0
+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0 (c)
+--- com.slack.api:slack-api-model:{strictly 1.48.0} -> 1.48.0 (c)
+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0
|    +--- com.slack.api:slack-api-model:1.48.0
|    +--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0 (*)
+--- com.slack.api:slack-api-client:{strictly 1.48.0} -> 1.48.0 (c)
+--- com.slack.api:slack-api-model:{strictly 1.48.0} -> 1.48.0 (c)

Java Runtime version

openjdk version "21.0.3" 2024-04-16
OpenJDK Runtime Environment JBR-21.0.3+13-453.2-jcef (build 21.0.3+13-b453.2)
OpenJDK 64-Bit Server VM JBR-21.0.3+13-453.2-jcef (build 21.0.3+13-b453.2, mixed mode, sharing)

OS info

ProductName:    macOS
ProductVersion: 26.4
BuildVersion:   25E246

Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., pom.xml/build.gradle))

  1. Create a UsergroupsUsersUpdateRequest object with the users property set as an empty List, and appropriate values for the other properties
  2. Make the request with the above object - this can be done via either async or sync methods

Expected result:

The targeted usergroup would be updated to have 0 users, with an appropriate OK response object.

Actual result:

A not-OK response is returned, with the error invalid_arguments.

{"ok":false,"error":"invalid_arguments"}

Requirements

Please make sure if this topic is specific to this SDK. For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions