Skip to content

fix(scim): keep list-of-strings values flat when converting response keys - #2041

Closed
pcbeingused333 wants to merge 4 commits into
slackapi:mainfrom
pcbeingused333:fix/scim-schemas-nested-c3345
Closed

pcbeingused333 wants to merge 4 commits into
slackapi:mainfrom
pcbeingused333:fix/scim-schemas-nested-c3345

Conversation

@pcbeingused333

Copy link
Copy Markdown

Summary

SCIM responses with list-of-string fields (for example schemas) came back nested after the snake_case key conversion, so user.schemas from read/search/create/patch user responses was [["urn:a", "urn:b"], ["urn:a", "urn:b"]] instead of ["urn:a", "urn:b"]. No related issue.

Root cause: in _convert_dict_keys (slack_sdk/scim/v1/internal_utils.py), the branch for lists whose first element is not a dict appended _create_copy(original_value) (the whole list) once per element. The fix appends _create_copy(element). Lists of dicts such as emails take the other branch and are unchanged.

Testing

python -m pytest tests/slack_sdk/scim -q. The new test_snake_cased_list_of_strings in tests/slack_sdk/scim/test_internals.py fails before the change and passes after it.

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

This change was prepared with the help of an AI coding assistant (Claude) and submitted by a human contributor.

@pcbeingused333
pcbeingused333 requested a review from a team as a code owner November 14, 2026 18:55
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @pcbeingused333 to sign the Salesforce Inc. Contributor License Agreement.

@mwbrooks mwbrooks added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch scim-client labels Nov 15, 2026
@mwbrooks mwbrooks added this to the 3.47.1 milestone Nov 15, 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.

✅ Thanks @pcbeingused333! 🎉 Congrats on your first contribution to python-slack-sdk!

result_dict[new_key].append(new_element)
else:
result_dict[new_key].append(_create_copy(original_value))
result_dict[new_key].append(_create_copy(element))

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: Great find! Appending the element instead of the whole list fixes schemas without touching the list-of-dicts branch, and the test pins both shapes.

@mwbrooks

Copy link
Copy Markdown
Member

@pcbeingused333 Could you sign the Salesforce CLA? We need it signed before we can continue with this PR. 🙏

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.71%. Comparing base (80f2f22) to head (6c8dfcc).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2041      +/-   ##
==========================================
+ Coverage   84.69%   84.71%   +0.02%     
==========================================
  Files         118      118              
  Lines       14116    14116              
==========================================
+ Hits        11955    11959       +4     
+ Misses       2161     2157       -4     

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

@zimeg zimeg mentioned this pull request Nov 20, 2026
5 of 16 tasks
@zimeg zimeg modified the milestones: 3.48.0, 3.48.1 Nov 20, 2026
@pcbeingused333

Copy link
Copy Markdown
Author

Closing this: #1973 has since landed on main with the same fix and a test, so this change is no longer needed. Thanks!

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

Labels

bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented cla:signed scim-client semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants