Skip to content

feat(models): add data_table Block Kit block - #1900

Open
zimeg wants to merge 8 commits into
mainfrom
chore/block-kit-data-table-wt
Open

feat(models): add data_table Block Kit block#1900
zimeg wants to merge 8 commits into
mainfrom
chore/block-kit-data-table-wt

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds the net-new data_table Block Kit block to the SDK models. The block displays structured, paginated data in a table with a required caption.

  • DataTableBlock with rows (required), caption (required), page_size, row_header_column_index, and block_id
  • Registered the data_table type in Block.parse
  • Exported DataTableBlock from slack_sdk.models.blocks
  • Validators for required rows/caption and page_size range (1-100)
  • Tests mirroring the existing TableBlock tests (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 existing TableBlock convention 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 new DataTableBlockTests)
  • black --check --line-length 125 -> 3 files unchanged
  • flake8 --max-line-length 125 -> clean
  • from slack_sdk.models.blocks import DataTableBlock -> imports OK

One block per PR; data_visualization is intentionally not included here.

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

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.17%. Comparing base (c30a05d) to head (b4d3a3e).
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

zimeg and others added 4 commits September 8, 2026 17:04
…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>
@zimeg zimeg added enhancement M-T: A feature request for new functionality semver:minor models labels Sep 9, 2026
@zimeg zimeg self-assigned this Sep 9, 2026
zimeg and others added 3 commits September 8, 2026 17:32
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 zimeg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 A few notes for the amazing readers and kind reviewers.

CarouselBlock(elements=[]).validate_json()


class DataTableBlockTests(unittest.TestCase):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📇 note: These tests follow CarouselBlock and holds off on wider orderings for now.

Comment on lines +1363 to +1365
# ----------------------------------------------
# RawNumberObject
# ----------------------------------------------

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎲 note: This and the RawTextObject following might later be moved to tests for composition objects perhaps?

@zimeg
zimeg marked this pull request as ready for review September 9, 2026 02:58
@zimeg
zimeg requested a review from a team as a code owner September 9, 2026 02:58
@zimeg zimeg added this to the 3.next milestone Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality models semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant