8000 slack_sdk.models.blocks.Option's "description" value is invalid in blocks · Issue #990 · slackapi/python-slack-sdk · GitHub
[go: up one dir, main page]

Skip to content

slack_sdk.models.blocks.Option's "description" value is invalid in blocks #990

@seratch

Description

@seratch

The description value in slack_sdk.models.blocks.Option class has been invalid. The values must be an plain_text typed text object. However, the current implementation embeds the values as a string value in JSON payloads.

See also: https://api.slack.com/reference/block-kit/composition-objects#option

Thanks a lot for reporting this:
https://twitter.com/notmatt/status/1378092778379341826

Reproducible in:

option = Option(
    text="*this is plain_text text*",
    value="value-0",
    description="The most important choice!"
)

The Slack SDK version

Any versions

Python runtime version

Any versions

OS info

Any

Expected result:

{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "test"
      },
      "accessory": {
        "type": "static_select",
        "placeholder": {
          "type": "plain_text",
          "text": "Select an item"
        },
        "options": [
          {
            "text": {
              "type": "plain_text",
              "text": "*this is plain_text text*"
            },
            "value": "value-0",
            "description": {
              "type": "plain_text",
              "text": "The most important choice!"
            }
          }
        ],
        "action_id": "static_select-action"
      }
    }
  ]
}

Actual result:

{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "test"
      },
      "accessory": {
        "type": "static_select",
        "placeholder": {
          "type": "plain_text",
          "text": "Select an item"
        },
        "options": [
          {
            "text": {
              "type": "plain_text",
              "text": "*this is plain_text text*"
            },
            "value": "value-0",
            "description": "The most important choice!"
          }
        ],
        "action_id": "static_select-action"
      }
    }
  ]
}

Requirements

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 are agreeing to those rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Version: 3xbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0