Skip to content

feat(model): add carousel and card Block Kit blocks#1608

Closed
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-carousel-iso
Closed

feat(model): add carousel and card Block Kit blocks#1608
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-carousel-iso

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds the carousel layout block and its card element to the slack-api-model block model, following the existing block conventions (Lombok @Data @Builder, TYPE constant, factory registration, DSL helper, round-trip test).

  • CarouselBlock (type carousel): elements (1-10 CardBlock), blockId
  • CardBlock (type card): heroImage, icon, slackIcon, title, subtitle, body, subtext, actions (an ActionsBlock, max 3 buttons), blockId. At least one of heroImage/title/actions/body must be present.
  • Registered both in GsonLayoutBlockFactory
  • Added Blocks.carousel(...) and Blocks.card(...) DSL helpers
  • Added parseCarouselBlock and buildCarouselBlock (round-trip) tests in BlockKitTest

The card block is included because carousel.elements[] is an array of card blocks — the carousel cannot be modeled or tested without it. Both are net-new to the Java SDK.

Docs

Validation

Ran the touched package's tests:

./mvnw -pl slack-api-model test -Dtest=BlockKitTest -Djacoco.skip=true
=> Tests run: 45, Failures: 0, Errors: 0, Skipped: 0  (BUILD SUCCESS)

Note on -Djacoco.skip=true: this environment only has JDK 25 available, and the repo-pinned JaCoCo 0.8.7 cannot instrument Java 25 class files (Unsupported class file major version 69), which fails coverage instrumentation on every test regardless of changes. JaCoCo coverage was therefore skipped for local validation; compilation and all unit tests (including the 2 new carousel tests) pass.

No .changeset/ exists in this repo (Maven build, versioned via release tooling), so no changeset was added.

🤖 Generated with Claude Code

Co-Authored-By: Claude svc-devxp-claude@slack-corp.com

Add the `carousel` layout block and its `card` element to the
slack-api-model block model.

- CarouselBlock (type "carousel"): elements (1-10 CardBlock), block_id
- CardBlock (type "card"): hero_image, icon, slack_icon, title, subtitle,
  body, subtext, actions, block_id
- Register both in GsonLayoutBlockFactory
- Add Blocks.carousel(...) and Blocks.card(...) DSL helpers
- Add parse + round-trip tests in BlockKitTest

Refs:
- https://docs.slack.dev/reference/block-kit/blocks/carousel-block
- https://docs.slack.dev/reference/block-kit/blocks/card-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 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.30%. Comparing base (a312395) to head (c052e00).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...om/slack/api/util/json/GsonLayoutBlockFactory.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1608      +/-   ##
============================================
- Coverage     73.32%   73.30%   -0.03%     
- Complexity     4520     4521       +1     
============================================
  Files           478      478              
  Lines         14300    14304       +4     
  Branches       1490     1490              
============================================
  Hits          10486    10486              
- Misses         2923     2926       +3     
- Partials        891      892       +1     
Flag Coverage Δ
jdk-14 73.30% <75.00%> (-0.03%) ⬇️

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.

@zimeg

zimeg commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of one-block-per-PR: card is #1609, carousel is now #1614. This bundled both, so superseding it.

@zimeg zimeg closed this Jun 27, 2026
@zimeg zimeg deleted the chore/block-kit-carousel-iso branch June 27, 2026 00:24
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.

1 participant