Skip to content

Add Table and DataTable block support#455

Merged
VictorHLi404 merged 2 commits into
masterfrom
vili/table-block-support
Jun 23, 2026
Merged

Add Table and DataTable block support#455
VictorHLi404 merged 2 commits into
masterfrom
vili/table-block-support

Conversation

@VictorHLi404

Copy link
Copy Markdown
Contributor

Summary

  • Implements `TableIF` and `DataTableIF` block interfaces following the existing `@Immutable` + `@HubSpotStyle` pattern used by every other block in the codebase
  • Introduces a `blocks/table/` subfolder with a two-tier cell hierarchy: `TableCell` (`raw_text`, `rich_text`) and `DataTableCell extends TableCell` (adds `raw_number`), enforcing at compile time that `raw_number` cells are only valid in data tables
  • Registers both `Table` and `DataTable` in `Block.java`'s `@JsonSubTypes` for polymorphic deserialization
  • Extends `BlockElementLengthLimits` with shared table limits (`MAX_TABLE_ROWS`, `MAX_TABLE_COLUMNS`, `MAX_TABLE_BLOCK_ID_LENGTH`) and data-table-specific limits (`MIN_DATA_TABLE_ROWS`, `MAX_DATA_TABLE_PAGE_SIZE`)

New files

Production:

  • `TableIF` — `table` block with `column_settings`, `@Check` enforcing row/column/block_id limits
  • `DataTableIF` — `data_table` block with required `caption`, optional `page_size` and `row_header_column_index`, `@Check` enforcing min rows, consistent column counts, header-row-must-be-raw_text, and page_size bounds
  • `table/TableCell` — polymorphic root for `raw_text` + `rich_text` cells
  • `table/DataTableCell` — extends `TableCell`, adds `raw_number`
  • `table/RawTextTableCellIF`, `table/RawNumberTableCellIF`, `table/RichTextTableCellIF`, `table/UnknownTableCell`, `table/TableColumnSettingIF`

Tests:

  • `TableBlockTest` — 9 tests covering deserialization, round-trip serialization, and all `@Check` validation paths
  • `DataTableBlockTest` — 14 tests covering the same plus data-table-specific constraints

Test plan

  • `TableBlockTest` — all 9 tests pass
  • `DataTableBlockTest` — all 14 tests pass
  • Full `slack-base` module build passes

🤖 Generated with Claude Code

@yyakhnytsia yyakhnytsia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed, left comments.

Comment thread slack-base/src/main/java/com/hubspot/slack/client/models/blocks/DataTableIF.java Outdated
@JsonSubTypes(
{
@JsonSubTypes.Type(value = RawTextTableCell.class, name = RawTextTableCell.TYPE),
@JsonSubTypes.Type(value = RichTextTableCell.class, name = RichTextTableCell.TYPE),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please check if we shouldn't include RawNumberTableCellIF here as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In documentation it says that Tables supports RawNumberTableCell, but in practice / what's actually implemented it doesn't support it. Not sure where the right place to raise that issue is to Slack, but I've omitted RawNumberTableCell here because of that.

@yyakhnytsia yyakhnytsia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@yyakhnytsia

Copy link
Copy Markdown
Contributor

@VictorHLi404 Do you have access to merge this PR?

@VictorHLi404 VictorHLi404 merged commit 4d76138 into master Jun 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants