Repository navigation
Conversation
Add the new `data_table` Block Kit layout block to the model: DataTableBlock plus its cell model (DataTableCell interface with RawTextDataTableCell, RawNumberDataTableCell, and RichTextBlock for rich_text cells), the GsonDataTableCellFactory deserializer, factory registration, and a `dataTable` builder DSL entry. Ref: https://docs.slack.dev/reference/block-kit/blocks/data-table-block Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1613 +/- ##
============================================
- Coverage 73.73% 73.72% -0.01%
- Complexity 4676 4687 +11
============================================
Files 487 488 +1
Lines 14667 14695 +28
Branches 1528 1529 +1
============================================
+ Hits 10814 10834 +20
- Misses 2944 2952 +8
Partials 909 909
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
…table # Conflicts: # slack-api-model/src/main/java/com/slack/api/util/json/GsonLayoutBlockFactory.java # slack-api-model/src/test/java/test_locally/api/model/block/BlockKitTest.java
Mirror the reviewed node SDK PR (slackapi/node-slack-sdk#2638): - Correct the max row count: the model previously stated up to 100 data rows (101 including header); the reference documents 201 rows (200 data rows plus header). The 100 cap was page_size, not the row maximum. Drop the stale count from the javadoc rather than restate it. - Align each field's javadoc with the data-table-block reference Fields table verbatim (rows, caption, page_size, row_header_column_index). - Trim RawTextDataTableCell / RawNumberDataTableCell to the terse, docs-minimal descriptions (drop the invented sorting/formatting tails); document value and text per the docs. Ref: https://docs.slack.dev/reference/block-kit/blocks/data-table-block Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Blocks.java keeps the recently-added blocks (Alert, Card, Carousel, Container, TaskCard) in a cluster at the end rather than slotting them alphabetically into the original core entries. Move the dataTable(...) builder into that cluster (after container, before taskCard) so a net-new block sits with its peers instead of splitting the old core from the new group. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…ta_table The data_table cells (raw_text / raw_number / rich_text) are the same cell model the table block uses. Rather than ship a parallel DataTableCell family, adopt the shared TableCell interface and its RawTextTableCell / RawNumberTableCell implementations in com.slack.api.model.block.composition, deserialized by a single GsonTableCellFactory: - Remove DataTableCell, RawTextDataTableCell, RawNumberDataTableCell, and GsonDataTableCellFactory. - Add TableCell, RawTextTableCell, RawNumberTableCell (in ...block.composition) and GsonTableCellFactory (in ...util.json). - DataTableBlock.rows is now List<List<TableCell>>; RichTextBlock implements TableCell; the client and model-test GsonFactory register TableCell -> GsonTableCellFactory. This is the same cell model the sibling table-block PR (#1611) introduces, placed in the same package with identical definitions, so whichever of the two lands second drops the now-duplicate files in a trivial merge. Mirrors how node (@slack/types composition objects) and python (slack_sdk basic_components) also share one cell model across both blocks. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…bject Rename the concrete TableCell implementations from RawTextTableCell / RawNumberTableCell to RawTextObject / RawNumberObject, matching the composition-object naming used by the other SDKs (python RawTextObject / RawNumberObject) and this repo's own ...Object grammar (PlainTextObject, MarkdownTextObject, OptionObject). The shared TableCell interface is the supertype the list is parameterized on (Java has no union types, so List<List<TableCell>> is how the raw_text | raw_number | rich_text union is expressed); only the implementation names change. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…import - GsonLayoutBlockFactory: move the DataTableBlock case into alphabetical order (between ContextBlock and DividerBlock) instead of after SectionBlock. - RichTextBlock: import com.slack.api.model.block.composition.TableCell and use the simple name in the implements clause rather than the fully qualified type inline. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The raw_number schema marks text as required (required: [type, value, text], text minLength 1) — the javadoc wrongly called it optional. Match the schema: text carries the display representation of the value and must be at least one character long. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Keep the text-is-display + min-length note, drop the "(for example a formatted string)" aside. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Restructure RawNumberObject and RawTextObject to per-field javadoc, mirroring the node @slack/types descriptions and matching this repo's own per-field convention (OptionObject, ConfirmationDialogObject): - class: "Defines an object containing a numeric value." / "...some text." - value: "The numeric value." - text (number): "The text used to display the value. The minimum length is 1 character." - text (text): "The text for the block. The minimum length is 1 character." Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add BlockCompositions.rawText(...) and rawNumber(...) factory helpers for the raw table cell objects, mirroring the plainText / markdownText DSL (configurator overload plus a convenience overload). Gives callers an ergonomic way to build data_table / table cells without the raw builder. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…Text Use the BlockCompositions.rawText(...) helper for the raw_text cells instead of RawTextObject.builder(), per the block-kit AGENTS.md guidance to build composition objects through BlockCompositions.* rather than raw builders. Depends on the rawText/rawNumber helpers added in slackapi/java-slack-sdk#1613. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
RawNumberObject.value is a (nullable) Double; the two-arg rawNumber convenience overload took a primitive double, narrowing the model's type. Use Double so the helper mirrors the field exactly. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
☕ Ideas to share where included I callout a pattern I'm uncertain of around rawText and rawNumber!
There was a problem hiding this comment.
🦠 note: I have some confidence this is a consistent shared type but it's not clear if it's meant to be stable because it's not in reference. Hoping to add this here and #1611 for shared implementation!
| // RawNumberObject | ||
|
|
||
| public static RawNumberObject rawNumber(ModelConfigurator<RawNumberObject.RawNumberObjectBuilder> configurator) { | ||
| return configurator.configure(RawNumberObject.builder()).build(); | ||
| } | ||
|
|
||
| public static RawNumberObject rawNumber(Double value, String text) { | ||
| return RawNumberObject.builder().value(value).text(text).build(); | ||
| } |
There was a problem hiding this comment.
👁️🗨️ note: These introduce helper functions to BlockComposition that aren't documented but IMHO are helpful for:
- RawTextObject.builder().text("Name").build()
+ BlockCompositions.rawText("Name"),
zimeg
left a comment
There was a problem hiding this comment.
🦐 Solid but some notes and questions before requesting actual review.
| /** | ||
| * A raw_text or raw_number cell. | ||
| */ | ||
| private TableCell fallback; |
There was a problem hiding this comment.
🔭 note: This might be generic to other table cells but we leave validation to the API here.
Save the table block @see links for the table block PR and move the data_table tests to their alphabetical position before task_card. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This pull request adds the
data_tablelayout block to the Java SDK model.DataTableBlock(data_table) withrows,caption,pageSize,rowHeaderColumnIndex, andblockId.TableCellinterface incom.slack.api.model.block.composition, sorowsisList<List<TableCell>>.RawTextObject(raw_text) andRawNumberObject(raw_number) composition objects that implementTableCell, matching python'sRawTextObject/RawNumberObject.ActionCellObject(action_cell) implementsTableCellwith aButtonElementelementand an optionalfallback(raw_textorraw_number) for clients without action cell support. Action cells only work indata_table, nottable.RichTextBlock(rich_text) now also implementsTableCell.GsonTableCellFactorydeserializes cells bytype, and unknown cell types parse asUnknownTableCellunlessfailOnUnknownPropertiesis set, matchingUnknownBlockandUnknownTextObject. It's registered forTableCellin the clientGsonFactoryand the model testGsonFactory.DataTableBlockis registered inGsonLayoutBlockFactory.Blocks.dataTable(...), plusBlockCompositions.actionCell(...),BlockCompositions.rawText(...)andBlockCompositions.rawNumber(...).BlockKitTestparses and builds adata_tablewith all four cell types, and covers unknown cell types.The
tableblock in #1611 builds on these shared cell types.Kotlin DSL support is left for a follow-up that covers every block the Kotlin extension doesn't have yet.
Testing
Post a message with a
data_tableblock usingchat.postMessage:Confirm
response.isOk()and that the table renders in the channel with the caption, a header row, and pagination.Read the message back with
conversations.historyand confirm the block parses as aDataTableBlockwithRawTextObjectandRawNumberObjectcells.🤖 Generated with Claude Code