Repository: slackapi/python-slack-sdk

Issue:
Add `expand` attribute to SectionBlock
The [API docs list the attribute `expand`](https://api.slack.com/reference/block-kit/blocks#section), which is currently missing from the SDK version in SectionBlock class.

### Category (place an `x` in each of the `[ ]`)

- [ ] **slack_sdk.web.WebClient (sync/async)** (Web API client)
- [ ] **slack_sdk.webhook.WebhookClient (sync/async)** (Incoming Webhook, response_url sender)
- [X] **slack_sdk.models** (UI component builders)
- [ ] **slack_sdk.oauth** (OAuth Flow Utilities)
- [ ] **slack_sdk.socket_mode** (Socket Mode client)
- [ ] **slack_sdk.audit_logs** (Audit Logs API client)
- [ ] **slack_sdk.scim** (SCIM API client)
- [ ] **slack_sdk.rtm** (RTM client)
- [ ] **slack_sdk.signature** (Request Signature Verifier)

### Requirements

Please read the [Contributing guidelines](https://github.com/slackapi/python-slack-sdk/blob/main/.github/contributing.md) and [Code of Conduct](https://slackhq.github.io/code-of-conduct) before creating this issue or pull request. By submitting, you are agreeing to those rules.

Discussion:
@henrinormak: I am willing to also contribute a PR with this - I might need some help with it (feedback via code review), but in general I think I understand how the model definition works.@hello-ashleyintech: @henrinormak Thank you for raising this, @henrinormak! If you are able to open a PR for this, I would be happy to give you a code review! If not, let me know and I can open a PR for this!

Solution patch:
diff --git a/slack_sdk/models/blocks/blocks.py b/slack_sdk/models/blocks/blocks.py
index 59ebac6..3b39af5 100644
--- a/slack_sdk/models/blocks/blocks.py
+++ b/slack_sdk/models/blocks/blocks.py
@@ -115,7 +115,7 @@ class SectionBlock(Block):
 
     @property
     def attributes(self) -> Set[str]:  # type: ignore[override]
-        return super().attributes.union({"text", "fields", "accessory"})
+        return super().attributes.union({"text", "fields", "accessory", "expand"})
 
     def __init__(
         self,
@@ -124,6 +124,7 @@ class SectionBlock(Block):
         text: Optional[Union[str, dict, TextObject]] = None,
         fields: Optional[Sequence[Union[str, dict, TextObject]]] = None,
         accessory: Optional[Union[dict, BlockElement]] = None,
+        expand: Optional[bool] = None,
         **others: dict,
     ):
         """A section is one of the most flexible blocks available.
@@ -144,6 +145,10 @@ class SectionBlock(Block):
                 in a compact format that allows for 2 columns of side-by-side text.
                 Maximum number of items is 10. Maximum length for the text in each item is 2000 characters.
             accessory: One of the available element objects.
+            expand: Whether or not this section block's text should always expand when rendered.
+                If false or not provided, it may be rendered with a 'see more' option to expand and show the full text.
+                For AI Assistant apps, this allows the app to post long messages without users needing
+                to click 'see more' to expand the message.
         """
         super().__init__(type=self.type, block_id=block_id)
         show_unknown_key_warning(self, others)
@@ -166,6 +171,7 @@ class SectionBlock(Block):
                 self.logger.warning(f"Unsupported filed detected and skipped {f}")
         self.fields = field_objects
         self.accessory = BlockElement.parse(accessory)  # type: ignore[arg-type]
+        self.expand = expand
 
     @JsonValidator("text or fields attribute must be specified")
     def _validate_text_or_fields_populated(self):


Test patch:
diff --git a/tests/slack_sdk/models/test_blocks.py b/tests/slack_sdk/models/test_blocks.py
index 940669b..ade4bfe 100644
--- a/tests/slack_sdk/models/test_blocks.py
+++ b/tests/slack_sdk/models/test_blocks.py
@@ -127,6 +127,18 @@ class SectionBlockTests(unittest.TestCase):
         }
         self.assertDictEqual(input, SectionBlock(**input).to_dict())
 
+    def test_parse_2(self):
+        input = {
+            "type": "section",
+            "text": {
+                "type": "plain_text",
+                "text": "This is a plain text section block.",
+                "emoji": True,
+            },
+            "expand": True,
+        }
+        self.assertDictEqual(input, SectionBlock(**input).to_dict())
+
     def test_json(self):
         self.assertDictEqual(
             {