feat(model): add card layout block#1609
Draft
zimeg wants to merge 1 commit into
Draft
Conversation
Add support for the Block Kit `card` layout block to slack-api-model. A card displays a compact, structured summary of content and can be used on its own or grouped inside a carousel. At least one of hero_image, title, actions, or body must be provided. - Add CardBlock model (hero_image, icon, slack_icon, title, subtitle, body, subtext, actions, block_id) following existing LayoutBlock conventions. - Register card in GsonLayoutBlockFactory for deserialization. - Add a Blocks.card(...) DSL helper. - Add BlockKitTest cases covering JSON round-trip and builder usage. Ref: https://docs.slack.dev/reference/block-kit/blocks/card-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 #1609 +/- ##
============================================
- Coverage 73.32% 73.29% -0.04%
- Complexity 4520 4521 +1
============================================
Files 478 478
Lines 14300 14302 +2
Branches 1490 1490
============================================
- Hits 10486 10482 -4
- Misses 2923 2932 +9
+ Partials 891 888 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This was referenced Jun 27, 2026
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 support for the Block Kit
cardlayout block toslack-api-model.A card displays a compact, structured summary of content. It can be used on its own or grouped together inside a carousel. At least one of
hero_image,title,actions, orbodymust be provided.Changes
CardBlock— newLayoutBlockmodel with fieldsheroImage(image element),icon(image element),slackIcon,title,subtitle,body,subtext(text objects),actions(list of interactive elements, e.g. buttons), andblockId, following the existing block model conventions (Lombok@Data @Builder @NoArgsConstructor @AllArgsConstructor,TYPEconstant).GsonLayoutBlockFactory— registers thecardtype for deserialization.Blocks— adds acard(...)DSL helper mirroring the other block factories.BlockKitTest— addsparseCardBlock(deserialize the docs example + JSON round-trip) andbuildCardBlock(builder/DSL + serialize round-trip).Reference
Block schema: https://docs.slack.dev/reference/block-kit/blocks/card-block
Validation
Ran the touched module's build + tests:
Result: BUILD SUCCESS —
Tests run: 45, Failures: 0, Errors: 0, Skipped: 0(includes the two new card tests).Note: JaCoCo coverage instrumentation (
jacoco-maven-plugin0.8.7) is incompatible with the only JDK available in this environment (Java 25 —Unsupported class file major version 69), so the test run was executed with-Djacoco.skip=true. This is an unrelated toolchain limitation; compilation and the tests themselves pass cleanly.🤖 Generated with Claude Code
Co-Authored-By: Claude svc-devxp-claude@slack-corp.com