Issue summary
When the Slack API returns a conversations.replies (or conversations.history) response that contains a Slack Lists item attachment, the SDK throws JsonSyntaxException whenever any ListRecord.Field.message value is a JSON
array instead of a single object. The whole API call aborts and no Message data is returned.
This is the same class of bug as #1450 (open) and #1454 (closed as dup of #1450). Both are still observable against the latest release v1.48.1 — reproduced below with a minimal payload.
Affected versions
- v1.46.0 through v1.48.1 (verified)
- Likely earlier versions back to when the field was introduced
Root cause
com.slack.api.model.list.ListRecord.Field declares message as a single Message:
// slack-api-model/src/main/java/com/slack/api/model/list/ListRecord.java
public static class Field {
...
private Message message;
...
}
Slack's API can return this value as an array of Message objects, and Gson then throws:
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column N path
$.messages[I].attachments[J].list_record.record.fields[K].message
Every other field on ListRecord.Field is modeled as a List<X> (number, select, date, user, attachment, email, phone, channel, rating, timestamp, link, reference) — only message is a scalar. That
asymmetry is what makes this fail.
Minimal reproduction
import com.google.gson.Gson;
import com.slack.api.methods.response.conversations.ConversationsRepliesResponse;
import com.slack.api.util.json.GsonFactory;
public class Repro {
public static void main(String[] args) {
// Mirrors the shape Slack returns when a Lists item's `message` field
// has multiple values (array form).
String payload =
"{\"ok\":true,\"messages\":[{\"type\":\"message\",\"user\":\"U1\",\"ts\":\"1.0\","
+ "\"text\":\"hi\",\"attachments\":[{\"list_record\":{\"record\":{\"fields\":["
+ "{\"key\":\"name\",\"message\":{\"text\":\"ok\"}},"
+ "{\"key\":\"details\",\"message\":[{\"text\":\"a\"},{\"text\":\"b\"}]}"
+ "]}}}]}]}";
Gson sdkGson = GsonFactory.createSnakeCase();
// Throws JsonSyntaxException at
// $.messages[0].attachments[0].list_record.record.fields[1].message
ConversationsRepliesResponse parsed =
sdkGson.fromJson(payload, ConversationsRepliesResponse.class);
}
}
Expected behavior
The SDK should accept both single-object and array shapes for ListRecord.Field.message, matching Slack's actual API behavior.
Issue summary
When the Slack API returns a
conversations.replies(orconversations.history) response that contains a Slack Lists item attachment, the SDK throwsJsonSyntaxExceptionwhenever anyListRecord.Field.messagevalue is a JSONarray instead of a single object. The whole API call aborts and no
Messagedata is returned.This is the same class of bug as #1450 (open) and #1454 (closed as dup of #1450). Both are still observable against the latest release v1.48.1 — reproduced below with a minimal payload.
Affected versions
Root cause
com.slack.api.model.list.ListRecord.Fielddeclaresmessageas a singleMessage:Slack's API can return this value as an array of
Messageobjects, and Gson then throws:Every other field on
ListRecord.Fieldis modeled as aList<X>(number,select,date,user,attachment,email,phone,channel,rating,timestamp,link,reference) — onlymessageis a scalar. Thatasymmetry is what makes this fail.
Minimal reproduction
Expected behavior
The SDK should accept both single-object and array shapes for
ListRecord.Field.message, matching Slack's actual API behavior.