Skip to content

feat(block-kit): add composition object examples - #228

Draft
zimeg wants to merge 12 commits into
mainfrom
composition-object-examples
Draft

feat(block-kit): add composition object examples#228
zimeg wants to merge 12 commits into
mainfrom
composition-object-examples

Conversation

@zimeg

@zimeg zimeg commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

Adds example projects for the Block Kit composition objects documented at docs.slack.dev. Composition objects never appear on their own, so each example reproduces the object's full reference payload hosted inside a valid block, element, or view — exactly as the docs page shows it. Every example ships a test asserting the complete serialized JSON.

Mirrors the conventions of the block element examples PR (#227): one exampleNN() per docs reference payload under src/composition_objects/, matched by a test under tests/composition_objects/ comparing to_dict() against the complete expected object.

Coverage

Composition object Examples Notes
Text 1 mrkdwn text hosted in a section
Option 2 the single option object, and options in a select menu
Option group 1 option groups in a select menu
Confirmation dialog 1 a button's confirm dialog
Dispatch action configuration 1 on a multiline plain-text input
Conversation filter 1 a conversations select filter in a modal view
Slack file 2 image block by file URL, and by file ID
Trigger 1 a workflow button trigger
Workflow 1 a workflow button workflow

slack_icon is documented but has no standalone reference payload (it is a sub-object of the card block, which the SDK does not yet expose), so it is not exemplified here.

Checks

Run from block-kit/, matching the pytest@python3.14 CI job:

  • ruff check — passed
  • ruff format --diff --check — passed (57 files)
  • mypy . — passed (56 source files)
  • pytest — 45 passed

Add example projects for the Block Kit composition objects documented on
docs.slack.dev, each demonstrating the full reference payload for its object
hosted inside a valid block, element, or view. Every example ships a test that
asserts the complete serialized JSON.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg self-assigned this Aug 28, 2026
zimeg and others added 9 commits August 27, 2026 23:27
Rewrite each existing example test's `expected` reference payload so every nested dict is exploded one key:value per line with a magic trailing comma, mirroring the docs' vertical layout and keeping ruff format from re-collapsing short dicts. Values stay native `dict`/`list` literals and the `json.dumps(..., sort_keys=True)` comparison is unchanged.

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>
…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>
The split-attribute restyle of test_plan/test_rich_text/test_table/
test_task_card (from f6ab6df) is out of scope for the composition-objects
examples PR — those blocks tests were already merged (#4, #35, #100). Move
the restyle to its own PR so this one is scoped to compositions/ + README.
ruff accepts both the compact (main) and split forms, so CI stays green.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg and others added 2 commits September 1, 2026 03:53
Match the Python secondary descriptions for confirmation_dialog,
conversation_filter, dispatch_action_configuration, trigger, and workflow to
the wording already used in the JS (standard) and Java example repos, so the
same payload reads identically across languages. Python was the outlier using
a different "...whose X does Y" phrasing; JS/Java use "...with an X carrying a
Y". trigger/workflow have no JS counterpart, so they follow Java. Verified each
description against the payload it builds (e.g. the dispatch input is multiline;
the trigger carries customizable_input_parameters).

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
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