feat(block-kit): add composition object examples - #70
Merged
Conversation
Add composition object examples to the block-kit showcase, mirroring the block element examples: one exampleNN() per documented reference payload, each returning the full host block/view so the reference JSON round-trips verbatim, with tests asserting the complete serialized payload. Ships 9 of the 10 documented composition objects (text, option, option-group, confirmation-dialog, dispatch-action-configuration, conversation-filter, slack-file, trigger, workflow). The slack-icon object is deferred: it is a card-block sub-object and the card block is absent from the SDK, so no example payload can be produced. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Renames the composition-object example directory from composition_objects/ (compositionobjects/ in Java) to compositions/, matching the shorter path. Directory + all references (test imports, README impl links, Java package declarations) updated together via git mv so history is preserved. Canonical docs.slack.dev/reference/block-kit/composition-objects/ URLs are left untouched (hyphenated, never the underscore token) — only local relative implementation-link paths changed. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…amples These examples are surfaced in docs.slack.dev as focused snippets — only the exampleNN() body is shown, so the static imports at the top of the file are invisible to the reader and a bare plainText(...)/markdownText(...) reads as an unattributed free function. Drop the static imports and qualify every call (BlockCompositions.plainText, BlockCompositions.markdownText) so each helper in the surfaced range names its class, consistent with the sibling Blocks.*/BlockElements.* calls. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…sition index Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…rose Match "a section block containing a text object" from the text-object reference page. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…aining' phrasing Drop 'hosting'/divergent wording; unify all langs on 'An image block containing a Slack file object referenced by url/id.' Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…image example Duplicate the canonical 'An image block using slack_file with a url/id.' phrasing rather than diverging — the composition example demonstrates the same payload as blocks/image, so the wording matches by design. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Match "a static select menu containing the option group object" from the option-group-object reference page; drop 'hosted'/divergent per-lang wording. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Use "A static select menu element with several option objects." (from the option-object reference page); drop 'hosted'/divergent per-lang wording. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…amples # Conflicts: # block-kit/README.md
zimeg
commented
Sep 1, 2026
zimeg
left a comment
Member
Author
There was a problem hiding this comment.
☕ Notes on test expectations but implementations are reading solid!
| "text": "Choose the conversation to publish your result to:", | ||
| "emoji": true | ||
| }, | ||
| "optional": false |
Member
Author
There was a problem hiding this comment.
📣 note: This is an extra... "optional"... argument added from the SDK serialization but shouldn't impact the API values!
| "type": "section", | ||
| "text": { | ||
| "type": "mrkdwn", | ||
| "text": "*<fakeLink.toYourApp.com|Use Case Catalogue>*\\nUse Case Catalogue for the following departments/roles..." |
Member
Author
There was a problem hiding this comment.
🦠 note: The escaped \n is expected for these multiline string values IIUC.
zimeg
marked this pull request as ready for review
September 1, 2026 23:46
This was referenced Sep 1, 2026
Member
Author
|
⚡ Let's merge this while matching reference and slack-samples/bolt-js-examples#216 and slack-samples/bolt-python-examples#228! |
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.
Adds composition object examples to the
block-kitshowcase, the third Block Kit category after blocks and block elements. Mirrors the block element examples: oneexampleNN()per documented reference payload, each returning the full host block or view so the reference JSON round-trips verbatim, with tests asserting the complete serialized payload viaGsonFactory.createSnakeCase().What's on display
compositions/Text.javacompositions/Option.javacompositions/OptionGroup.javacompositions/ConfirmationDialog.javacompositions/DispatchActionConfiguration.javacompositions/ConversationFilter.javacompositions/SlackFile.javacompositions/Trigger.javacompositions/Workflow.javaEvery reference payload documented on each page becomes one
exampleNN(), and each test asserts the full hosted payload exactly as the docs page shows it. Input-block examples additionally assert the SDK's default-emitted fields (for exampleoptional: false), matching the existingblocks/InputTestconvention in this repo.Deferred
com.slack.api.model.blockpackage. Its docs page ships no standalone JSON example, so there is no reference payload to reproduce. Deferred until the card block lands in the SDK.Testing
Ran the CI gate locally from
block-kit/exactly as.github/workflows/test.ymldefines:mvn --batch-mode spotless:check— passesmvn --batch-mode test -Dspotless.apply.skip— passes (39 tests, 0 failures)