Skip to content

feat(model): add table Block Kit block - #1611

Draft
zimeg wants to merge 4 commits into
mainfrom
chore/block-kit-table
Draft

feat(model): add table Block Kit block#1611
zimeg wants to merge 4 commits into
mainfrom
chore/block-kit-table

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds support for the table Block Kit layout block to the Java SDK, bringing it to parity with the JS (@slack/types) and Python (slack_sdk) SDKs, which already ship this block.

A table block renders tabular data as a grid of rows and cells:

  • TableBlock (type: "table") — rows (list of rows, each a list of cells; up to 100 rows, 20 cells/row), optional columnSettings, and blockId.
  • TableCell interface implemented by the three cell types:
    • RawTextTableCell (raw_text) — text
    • RawNumberTableCell (raw_number) — value, optional display text
    • RichTextBlock (rich_text) — the existing rich text block now also implements TableCell
  • TableColumnSettingalign (left/center/right), isWrapped
  • GsonTableCellFactory — polymorphic (de)serialization of cells by type, registered in GsonFactory (and the test-local factory); TableBlock registered in GsonLayoutBlockFactory
  • Blocks.table(...) builder helper, mirroring the other block helpers

Follows the existing block-model conventions (Lombok @Data @Builder @NoArgsConstructor @AllArgsConstructor, public static final String TYPE, javadoc linking to the docs).

Docs

https://docs.slack.dev/reference/block-kit/blocks/table-block

Validation

Run in this branch's worktree:

  • ./mvnw -pl slack-api-model -am test -Dtest=BlockKitTest -Djacoco.skip=trueTests run: 45, Failures: 0, Errors: 0 (includes the 2 new parseTableBlock / buildTableBlock cases)
  • ./mvnw -pl slack-api-client -am compile -Djacoco.skip=trueBUILD SUCCESS (validates the GsonFactory registration)

Note: jacoco.skip=true was required because the locally available JDK is Java 25 and the project's JaCoCo agent cannot instrument class file major version 69 (Unsupported class file major version 69). This is an environment limitation unrelated to these changes; compilation and the tests themselves pass. CI (running the project's supported JDK) should exercise coverage normally.

No changeset added — this repo uses Maven + jSlack_changelog.md, not the .changeset/ workflow.

🤖 Generated with Claude Code

Add support for the `table` layout block, which renders tabular data as a
grid of rows and cells. Cells may be `raw_text`, `raw_number`, or a
`rich_text` block, with optional per-column alignment/wrapping settings.

- TableBlock (type "table") with rows, columnSettings, blockId
- TableCell interface + RawTextTableCell, RawNumberTableCell impls;
  RichTextBlock now also implements TableCell for rich_text cells
- TableColumnSetting (align, isWrapped)
- GsonTableCellFactory for polymorphic cell (de)serialization, registered
  in GsonFactory; TableBlock registered in GsonLayoutBlockFactory
- Blocks.table(...) builder helper
- Tests covering parse, round-trip, and builder usage

Docs: https://docs.slack.dev/reference/block-kit/blocks/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

❌ Patch coverage is 77.14286% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.86%. Comparing base (e30ba9d) to head (2f5a86e).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../com/slack/api/util/json/GsonTableCellFactory.java 75.00% 3 Missing and 1 partial ⚠️
...om/slack/api/util/json/GsonLayoutBlockFactory.java 72.72% 3 Missing ⚠️
...rc/main/java/com/slack/api/model/block/Blocks.java 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1611      +/-   ##
============================================
+ Coverage     72.84%   72.86%   +0.02%     
- Complexity     4533     4543      +10     
============================================
  Files           482      483       +1     
  Lines         14423    14442      +19     
  Branches       1512     1512              
============================================
+ Hits          10506    10523      +17     
- Misses         3022     3023       +1     
- Partials        895      896       +1     
Flag Coverage Δ
jdk-14 72.86% <77.14%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@kevin-boban-glean

Copy link
Copy Markdown

@zimeg Thanks for this PR. Can this be merged please to bring parity?

@srtaalej srtaalej added enhancement M-T: A feature request for new functionality semver:minor labels Aug 28, 2026

@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.

📝 Leaving some thoughts on the first shot implementation that I think we might want to consider before merge. I'm curious if we start with a less complete implementation - table but no cells - for sake of aligning the data_table block properties but I haven't investigated too much more.

@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RawNumberTableCell implements TableCell {

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.

👁️‍🗨️ question: Is this pattern more standard than perhaps reversing the order for more "direct" imports?

- RawNumberTableCell
+ TableCellRawNumber

🪬 note: I might prefer the latter but not a blocker!

case RawTextTableCell.TYPE:
return RawTextTableCell.class;
case RawNumberTableCell.TYPE:
return RawNumberTableCell.class;

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.

🧮 question: Without testing on a personal sandbox I forget if this is stable? It's documented so no blocker here either!

Comment on lines +18 to +23
public class RawNumberTableCell implements TableCell {
public static final String TYPE = "raw_number";
private final String type = TYPE;
private Double value;
private String text;
}

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: I find raw_number is also supported with the Data Table block which makes me curious if this should be exported as a composition object instead?

🔗 https://github.com/slackapi/java-slack-sdk/tree/main/slack-api-model/src/main/java/com/slack/api/model/block/composition

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 semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants