feat(model): add card, carousel, and alert Block Kit blocks - #1624
feat(model): add card, carousel, and alert Block Kit blocks#1624srtaalej wants to merge 7 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1624 +/- ##
============================================
+ Coverage 73.34% 73.37% +0.02%
- Complexity 4521 4531 +10
============================================
Files 478 478
Lines 14300 14308 +8
Branches 1490 1490
============================================
+ Hits 10489 10499 +10
Misses 2920 2920
+ Partials 891 889 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
WilliamBergamin
left a comment
There was a problem hiding this comment.
This is looking good 🚀
There is one blocking comment around the slackIcon type
| * The name of a built-in Slack icon displayed next to the title and subtitle. | ||
| * Mutually exclusive with {@code icon}. | ||
| */ | ||
| private String slackIcon; |
There was a problem hiding this comment.
From these docs the type for slackIkon should be some sort of composition object with type: icon 🤔
| * An array of {@link CardBlock card} blocks. Must contain between 1 and 10 cards. | ||
| */ | ||
| @Builder.Default | ||
| private List<CardBlock> elements = new ArrayList<>(); |
There was a problem hiding this comment.
Is there a reason why we are initializing this value as an empty list?
Would not initializing it follow existing patterns?
There was a problem hiding this comment.
hmm no that was an oversight thanks for catching
| case AlertBlock.TYPE: | ||
| return AlertBlock.class; | ||
| case CardBlock.TYPE: | ||
| return CardBlock.class; | ||
| case CarouselBlock.TYPE: | ||
| return CarouselBlock.class; |
Follow project convention of not initializing List fields to empty collections — null vs empty has semantic meaning in the Slack API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ckIcon The slackIcon field on CardBlock should be a composition object with type "icon" and a name field, not a plain String. https://docs.slack.dev/reference/block-kit/composition-objects/slack-icon-object
Summary
CardBlock— structured content display (hero image, icon, title, subtitle, body, actions)CarouselBlock— horizontally scrollable collection of cards (1–10)AlertBlock— prominent notice block with severity levels (modals only)Parity with node-slack-sdk#2567 and python-slack-sdk#1865.
Test plan
BlockKitTest.java(parse + round-trip + builder)BlocksTest.javaTest app.java