Skip to content

fix: surface initial fields in lists.items.create method arguments#1600

Open
zimeg wants to merge 7 commits into
mainfrom
fix/lists-items-create-initial-fields-typo
Open

fix: surface initial fields in lists.items.create method arguments#1600
zimeg wants to merge 7 commits into
mainfrom
fix/lists-items-create-initial-fields-typo

Conversation

@zimeg

@zimeg zimeg commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

Fix typo in RequestFormBuilder.toForm(SlackListsItemsCreateRequest) where initial_fields was being sent as intial_fields (missing second 'i'), causing list items to be created without their initial field values set.

Fixes #1599

Category

  • slack-api-client (Slack API Clients)

Example

import com.slack.api.Slack;
import com.slack.api.methods.response.slack_lists.SlackListsItemsCreateResponse;
import com.slack.api.model.block.RichTextBlock;
import com.slack.api.model.block.element.RichTextSectionElement;
import com.slack.api.model.list.ListRecord;

import java.util.Arrays;

// ...

ListRecord.Field field = ListRecord.Field.builder()
        .columnId(taskNameColId)
        .richText(Arrays.asList(RichTextBlock.builder()
                .elements(Arrays.asList(RichTextSectionElement.builder()
                        .elements(Arrays.asList(RichTextSectionElement.Text.builder()
                                .text("My new list item")
                                .build()))
                        .build()))
                .build()))
        .build();

// This now correctly sends "initial_fields" instead of "intial_fields"
SlackListsItemsCreateResponse response = slack.methods(token).slackListsItemsCreate(r -> r
        .listId("F1234ABCD")
        .initialFields(Arrays.asList(field)));

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

The `initial_fields` parameter was being sent as `intial_fields` (missing
second 'i'), causing list items to be created without their initial field
values.

Fixes #1599

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg requested a review from a team as a code owner June 10, 2026 23:27
@zimeg zimeg self-assigned this Jun 10, 2026
@zimeg zimeg added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented project:slack-api-client project:slack-api-client semver:patch labels Jun 10, 2026
zimeg and others added 2 commits June 10, 2026 16:32
Adds regression test for #1599 — ensures the created item's fields are
populated when initialFields is provided.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Verify the exact column_id and rich_text content are returned on the
created item, not just that fields are non-empty.

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

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.32%. Comparing base (b6586d9) to head (2da94f7).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1600      +/-   ##
============================================
- Coverage     73.33%   73.32%   -0.01%     
- Complexity     4521     4522       +1     
============================================
  Files           478      478              
  Lines         14300    14300              
  Branches       1490     1490              
============================================
- Hits          10487    10486       -1     
- Misses         2922     2929       +7     
+ Partials        891      885       -6     
Flag Coverage Δ
jdk-14 73.32% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪐 A comment for the reviewers!

Comment on lines +164 to +167
assertThat(createItemResponse.getItem().getFields(), is(notNullValue()));
assertThat(createItemResponse.getItem().getFields().size(), is(1));
assertThat(createItemResponse.getItem().getFields().get(0).getColumnId(), is(taskNameColId));
assertThat(createItemResponse.getItem().getFields().get(0).getText(), is("Test task item"));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪬 note: We now confirm the fields used above:

[DEBUG] createItemResponse item=ListRecord(id=Rec0B9VCSAABE, listId=F0B9KD6NECB, fields=[ListRecord.Field(key=task_name, columnId=Col0B9TKAUTND, value=[{"type":"rich_text","block_id":"h2z2t","elements":[{"type":"rich_text_section","elements":[{"type":"text","text":"Test task item"}]}]}], text=Test task item, richText=[RichTextBlock(type=rich_text, elements=[RichTextSectionElement(type=rich_text_section, elements=[RichTextSectionElement.Text(type=text, text=Test task item, style=null)])], blockId=h2z2t)], messages=null, message=null, number=null, select=null, date=null, user=null, attachment=null, checkbox=null, email=null, phone=null, channel=null, rating=null, timestamp=null, link=null, reference=null)], dateCreated=1781134963, createdBy=U09KU686163, threadTs=null, position=null, updatedTimestamp=1781134963, updatedBy=U09KU686163, viewPositions=null, platformRefs=null, isSubscribed=null, saved=null, savedFields=null)

@zimeg zimeg changed the title fix: correct typo in lists.items.create parameter name fix: surface initial fields in lists.items.create method arguments Jun 10, 2026

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Great catch @zimeg!

if (req.getInitialFields() != null) {
String json = getJsonWithGsonAnonymInnerClassHandling(req.getInitialFields());
form.add("intial_fields", json);
form.add("initial_fields", json);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Nice catch 🎉 Silent param-drops are the worst flavour of bug because nothing 4xxs and the request just succeeds with the field missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented project:slack-api-client project:slack-api-client semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

slackListsItemsCreate most likley has typo in field.

2 participants