feat(models): add data_table Block Kit block - #1900
Open
zimeg wants to merge 8 commits into
Open
Conversation
Add the net-new `data_table` block to the Block Kit models. The block displays structured, paginated data with a required caption. - DataTableBlock with rows (required), caption (required), page_size, row_header_column_index, and block_id - register the type in Block.parse and export it from slack_sdk.models.blocks - validators for required rows/caption and page_size range (1-100) - tests mirroring the existing TableBlock tests Ref: https://docs.slack.dev/reference/block-kit/blocks/data-table-block Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1900 +/- ##
==========================================
+ Coverage 84.13% 84.17% +0.04%
==========================================
Files 118 118
Lines 13553 13588 +35
==========================================
+ Hits 11403 11438 +35
Misses 2150 2150 ☔ View full report in Codecov by Harness. |
…ects Mirrors node-slack-sdk#2638: data_table rows accept raw_text, raw_number, and rich_text cells. Adds RawNumberObject (value + display text, min-length-1) and widens DataTableBlock.rows to Union[RawTextObject, RawNumberObject, RichTextBlock, Dict]. Field wording tracks the docs/node model verbatim. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
raw_number has no dedicated composition-object reference page (it is only documented inline on the data-table-block page). Match node-slack-sdk#2638's RawNumberElement, which deliberately carries no @see link for the same reason. The DataTableBlock docstring keeps the URL — that page is the block's own home. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Match the recently-added sibling blocks (AlertBlock, CardBlock, ContainerBlock, CarouselBlock), which all use the one-line block_id description. DataTableBlock had inherited the legacy verbose 5-line variant. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The docs data-table-block Fields table (and node-slack-sdk#2638) describe rows as exactly 'An array consisting of table rows.' — drop the extra cell-type sentence that was appended, per the verbatim-docs-field convention. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Matches both alphabetical order (Number < Text) and node-slack-sdk#2638's composition-objects order (RawNumberElement before RawTextElement). No behavior change — RawNumberObject extends JsonObject, so it has no dependency on the sibling class. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Match the class order in the source files: - RawNumberObjectTests before RawTextObjectTests (Number before Text, as in basic_components.py and node-slack-sdk#2638). - DataTableBlockTests moved to the end, after CarouselBlockTests, mirroring DataTableBlock's position at the end of blocks.py. Pre-existing test ordering left untouched (out of scope for this PR). Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
commented
Sep 9, 2026
zimeg
left a comment
Member
Author
There was a problem hiding this comment.
📝 A few notes for the amazing readers and kind reviewers.
| CarouselBlock(elements=[]).validate_json() | ||
|
|
||
|
|
||
| class DataTableBlockTests(unittest.TestCase): |
Member
Author
There was a problem hiding this comment.
📇 note: These tests follow CarouselBlock and holds off on wider orderings for now.
Comment on lines
+1363
to
+1365
| # ---------------------------------------------- | ||
| # RawNumberObject | ||
| # ---------------------------------------------- |
Member
Author
There was a problem hiding this comment.
🎲 note: This and the RawTextObject following might later be moved to tests for composition objects perhaps?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the net-new
data_tableBlock Kit block to the SDK models. The block displays structured, paginated data in a table with a required caption.DataTableBlockwithrows(required),caption(required),page_size,row_header_column_index, andblock_iddata_tabletype inBlock.parseDataTableBlockfromslack_sdk.models.blocksrows/captionandpage_sizerange (1-100)TableBlocktests (basic doc example, all fields, rich_text cells, empty-rows validation, required caption, page_size range)Cell types (
raw_text/raw_number/rich_text) are passed through as dicts, matching the existingTableBlockconvention in this repo.Reference
https://docs.slack.dev/reference/block-kit/blocks/data-table-block
Validation
Run in a fresh venv (
pip install -e ., Python 3.13):pytest tests/slack_sdk/models/test_blocks.py-> 90 passed (includes 6 newDataTableBlockTests)black --check --line-length 125-> 3 files unchangedflake8 --max-line-length 125-> cleanfrom slack_sdk.models.blocks import DataTableBlock-> imports OKOne block per PR;
data_visualizationis intentionally not included here.