[EXPERIMENTAL] Slack Lists message field: direction-aware MessageRef by zimeg · Pull Request #1637 · slackapi/java-slack-sdk · GitHub
Skip to content

[EXPERIMENTAL] Slack Lists message field: direction-aware MessageRef - #1637

Draft
zimeg wants to merge 1 commit into
apifrom
clack/slack-lists-message-ref
Draft

zimeg wants to merge 1 commit into
apifrom
clack/slack-lists-message-ref

Conversation

@zimeg

@zimeg zimeg commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary

Types the Slack Lists item message field as List<ListRecord.MessageRef> ({value, channel_id, ts, thread_ts?}) and adds a Gson adapter so a single type models the field's asymmetric wire shape in both directions.

Verified against the live API on two surfaces — slackLists.items.list and the nested list_record attachment in conversations.history / conversations.replies:

  • request: each MessageRef serializes to its value → message: ["<permalink>"] (the API rejects object form: must provide a string)
  • response: deserializes {value, channel_id, ts, thread_ts?} objects — always an array, thread_ts only for threaded replies; no single-object form observed. Tolerates bare-string elements defensively.

Why

The prior modeling (#1590) typed the element as a full chat Message, which does not match the payload (the real element is a lightweight message reference), and normalized a single-object↔array case the API does not actually return on these endpoints. See field-types.

This is the Java half of node-slack-sdk#2598 — node response types generate from these Java samples, so the sample must carry the real shape. It also makes node-slack-sdk#2599 / #2600 obsolete (they modeled Message | Message[] — wrong element type + an unnecessary union).

Changes

  • ListRecord.Field.message → List<MessageRef>; new ListRecord.MessageRef type.
  • New GsonListRecordMessageRefFactory (direction-aware), registered in the main + test GsonFactory.
  • Removed the now-redundant test GsonListRecordFieldFactory (default Gson handles List<MessageRef>).
  • slacklists_Test (remote): adds a message column, posts + references a message, asserts the echoed reference shape — so the generated sample carries the real field.

Verification

  • Model tests: 7/7 pass (ListRecordFieldTest, incl. request-serialize + response-deserialize).
  • Remote slacklists_Test: passes live (3/3) against the Slack API; raw capture confirms {value, channel_id, ts}.

Status — EXPERIMENTAL / breaking

This changes the field's public type (was Message-based). Flagged experimental for review; not for merge-as-is without a call on the breaking change. The sample regeneration is intentionally left to a controlled runner run (the ad-hoc regen bloated response_metadata.messages — kept out of this source PR).

🤖 Generated with Claude Code

Types ListRecord.Field.message as List<MessageRef> ({value, channel_id, ts,
thread_ts?}) and adds a Gson adapter so one type models the field's asymmetric
wire shape, verified against the live API on two surfaces (slackLists.items.list
and the conversations.history/replies nested list_record path):

- request: each MessageRef serializes to its `value` -> message: ["<permalink>"]
  (the API rejects object form: "must provide a string")
- response: deserializes {value, channel_id, ts, thread_ts?} objects, always an
  array (no single-object form observed); tolerates bare-string elements too

This supersedes the Message-typed modeling from #1590, whose element type (a
full chat Message) did not match the payload. The now-redundant test
GsonListRecordFieldFactory is removed (default Gson handles List<MessageRef>).
The remote slacklists_Test adds a message column, posts and references a
message, and asserts the echoed reference shape so the generated sample carries
the real message field. Model tests pass (7/7); the remote test passes live.

Fixes the Java half of node-slack-sdk#2598 (node response types generate from
these Java samples). Source-only; the sample regeneration lands via the runner.

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

codecov Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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