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

[EXPERIMENTAL] Slack Lists message field: direction-aware MessageRef#1637
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 valuemessage: ["<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.messageList<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

❌ 28 Tests Failed:

Tests completed Failed Passed Skipped
887 28 859 11
View the top 3 failed test(s) by shortest run time
test_locally.api.methods.SlackListsTest::slackListsAccessSet
Stack Traces | 0.011s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsItemsDeleteMultiple
Stack Traces | 0.012s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsItemsList
Stack Traces | 0.012s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 1410 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsDownloadGet
Stack Traces | 0.014s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 99 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsItemsInfo
Stack Traces | 0.015s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 4465 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsItemsUpdate
Stack Traces | 0.015s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsDownloadStart
Stack Traces | 0.016s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 78 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsItemsCreate
Stack Traces | 0.016s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 737 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsAccessDelete
Stack Traces | 0.017s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsUpdate
Stack Traces | 0.018s run time
java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SlackListsTest::slackListsDownloadGet_async
Stack Traces | 0.019s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 99 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsItemsDeleteMultiple_async
Stack Traces | 0.021s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsAccessDelete_async
Stack Traces | 0.024s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsAccessSet_async
Stack Traces | 0.026s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsItemsCreate_async
Stack Traces | 0.026s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 737 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsItemsList_async
Stack Traces | 0.028s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 1410 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsItemsInfo_async
Stack Traces | 0.032s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 4465 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsItemsUpdate_async
Stack Traces | 0.032s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsDownloadStart_async
Stack Traces | 0.034s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 78 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SlackListsTest::slackListsUpdate_async
Stack Traces | 0.034s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 63 path $.response_metadata.messages[0]
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.RTMTest::test
Stack Traces | 0.054s run time
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 405150 path $.groups[0].latest.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.SearchTest::test_async
Stack Traces | 0.098s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 409529 path $.messages.matches[0].previous.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.PinsTest::test
Stack Traces | 0.119s run time
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 1759378 path $.items[0].message.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.PinsTest::test_async
Stack Traces | 0.14s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 1759378 path $.items[0].message.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.api.methods.SearchTest::test
Stack Traces | 0.151s run time
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 409529 path $.messages.matches[0].previous.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.ReactionsTest::test
Stack Traces | 0.173s run time
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 1437737 path $.items[0].message.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure
test_locally.api.methods.ReactionsTest::test_async
Stack Traces | 0.177s run time
MethodsCompletionException(ioException=null, slackApiException=null, otherException=com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 1437737 path $.items[0].message.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure)
test_locally.SlackTest::rtmStart
Stack Traces | 0.556s run time
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 405150 path $.groups[0].latest.attachments[0].list_record.record.fields[0].message
See https://github..../blob/main/Troubleshooting.md#unexpected-json-structure

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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