Skip to content

feat(model): add card layout block#1609

Draft
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-card
Draft

feat(model): add card layout block#1609
zimeg wants to merge 1 commit into
mainfrom
chore/block-kit-card

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds support for the Block Kit card layout block to slack-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, or body must be provided.

Changes

  • CardBlock — new LayoutBlock model with fields heroImage (image element), icon (image element), slackIcon, title, subtitle, body, subtext (text objects), actions (list of interactive elements, e.g. buttons), and blockId, following the existing block model conventions (Lombok @Data @Builder @NoArgsConstructor @AllArgsConstructor, TYPE constant).
  • GsonLayoutBlockFactory — registers the card type for deserialization.
  • Blocks — adds a card(...) DSL helper mirroring the other block factories.
  • BlockKitTest — adds parseCardBlock (deserialize the docs example + JSON round-trip) and buildCardBlock (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:

./mvnw -pl slack-api-model -am test -Dtest=BlockKitTest

Result: BUILD SUCCESSTests run: 45, Failures: 0, Errors: 0, Skipped: 0 (includes the two new card tests).

Note: JaCoCo coverage instrumentation (jacoco-maven-plugin 0.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

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

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.29%. Comparing base (a312395) to head (0712684).
✅ All tests successful. No failed tests found.

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     
Flag Coverage Δ
jdk-14 73.29% <100.00%> (-0.04%) ⬇️

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.

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